Initial commit
diff --git a/units-test.js b/units-test.js
new file mode 100644
index 0000000..b94fb92
--- /dev/null
+++ b/units-test.js
@@ -0,0 +1,31 @@
+const units = require('./units.lib.js');
+
+const readline = require("readline");
+const rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout
+});
+
+
+units().then(Module => {
+ let test = Module.cwrap('test_int', 'number', ['number', 'number']);
+ let _do_a_conversion = Module.cwrap('do_a_conversion', 'number', ['number', 'number']);
+
+ function do_a_conversion(from, to) {
+ let from_c = Module.stringToNewUTF8(from);
+ let to_c = Module.stringToNewUTF8(to);
+ let lenBefore = globalThis.printBuffer.length;
+ _do_a_conversion(from_c, to === "" ? 0 : to_c);
+ return globalThis.printBuffer.slice(lenBefore).trim();
+ }
+
+ let ask = () => rl.question("From ", from => {
+ rl.question("To ", to => {
+ console.log(do_a_conversion(from, to));
+ ask();
+ });
+ });
+
+ ask();
+
+});