From 357a9ab4e25a0101121761c503e14ba38d32093c Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 17 Jul 2020 07:28:21 -0400 Subject: Move some files around --- test/bt | 2 +- test/dt.js | 26 -------------------------- test/nt.js | 19 +++++++++++++++++++ test/t.js | 29 ++++++++++++++++++----------- 4 files changed, 38 insertions(+), 38 deletions(-) delete mode 100755 test/dt.js create mode 100755 test/nt.js (limited to 'test') diff --git a/test/bt b/test/bt index 5679f686..29c1e1e5 100755 --- a/test/bt +++ b/test/bt @@ -1,6 +1,6 @@ #! /usr/bin/env dbqn -dRun ← ⟨"dRun"⟩ •EX •path∾"../dcshim.bqn" +dRun ← ⟨"dRun"⟩ •EX •path∾"../cshim.bqn" l ← ∾(•LNS •path∾∾⟜"cases.bqn")¨""‿"b" { l ∾↩ "1 %"⊸∾¨ (3≤≠)◶0‿(('#'≠2⊸⊑)∧" "≡2⊸↑)¨⊸/ •LNS •path∾"testref.bqn" }⍟⊢(<"-ref")∊•args c ← (¬"{"⊑∘∊⊢)¨⊸/ l diff --git a/test/dt.js b/test/dt.js deleted file mode 100755 index 49636a66..00000000 --- a/test/dt.js +++ /dev/null @@ -1,26 +0,0 @@ -//usr/bin/env node "$0" $@;exit $? -const execFile = require('child_process').execFile - , load=f=>require('fs').readFileSync(__dirname+'/'+f,'utf8') - , runWasm=w=>new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(w))) - .exports.fn() - -const t=load('cases.bqn').split('\n').filter(x=>x).map(x=>x.split(' % ')) - , test=t.map(e=>'"'+e[1]+'"').join('\n') - , expt=t.map(e=>+e[0]) - -var compiler = execFile( - __dirname+'/../dcshim.bqn', - [ '{•←Compile𝕩}¨⟨'+test+'⟩' ], - function (error, stdout, stderr) { - const rslt=stdout.split('\n').filter(a=>a.length) - .map(a=>runWasm(a.split("‿").map(n=>+n))) - , pass=rslt.map((r,i)=>r===expt[i]) - , fail=pass.map((p,i)=>p?-1:i).filter(i=>i>=0) - console.log( - fail.length - ? fail.map(i=>'"'+t[i][1]+'": expected '+expt[i]+' but received '+rslt[i]) - : "All passed!" - ) - process.exit(+(fail.length>0)) - } -); diff --git a/test/nt.js b/test/nt.js new file mode 100755 index 00000000..5cd38556 --- /dev/null +++ b/test/nt.js @@ -0,0 +1,19 @@ +//usr/bin/env node "$0" $@;exit $? +const bqn=require(require('os').homedir+'/bin/bqn') + , load=f=>require('fs').readFileSync(__dirname+'/'+f,'utf8') + , runWasm=w=>new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(w))) + .exports.fn() + +const t=load('cases.bqn').split('\n').filter(x=>x).map(x=>x.split(' % ')) + , test=t.map(e=>'"'+e[1]+'"').join('\n') + , expt=t.map(e=>+e[0]) + , rslt=bqn(load('../nc.bqn','utf8').concat('Compile¨⟨'+test+'⟩')) + .a.map((a,i)=>runWasm(a.a)) + , pass=rslt.map((r,i)=>r===expt[i]) + , fail=pass.map((p,i)=>p?-1:i).filter(i=>i>=0) +console.log( + fail.length + ? fail.map(i=>'"'+t[i][1]+'": expected '+expt[i]+' but received '+rslt[i]) + : "All passed!" +) +process.exit(+(fail.length>0)) diff --git a/test/t.js b/test/t.js index f958bbb3..88310720 100755 --- a/test/t.js +++ b/test/t.js @@ -1,5 +1,5 @@ //usr/bin/env node "$0" $@;exit $? -const bqn=require(require('os').homedir+'/bin/bqn') +const execFile = require('child_process').execFile , load=f=>require('fs').readFileSync(__dirname+'/'+f,'utf8') , runWasm=w=>new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(w))) .exports.fn() @@ -7,13 +7,20 @@ const bqn=require(require('os').homedir+'/bin/bqn') const t=load('cases.bqn').split('\n').filter(x=>x).map(x=>x.split(' % ')) , test=t.map(e=>'"'+e[1]+'"').join('\n') , expt=t.map(e=>+e[0]) - , rslt=bqn(load('../c.bqn','utf8').concat('Compile¨⟨'+test+'⟩')) - .a.map((a,i)=>runWasm(a.a)) - , pass=rslt.map((r,i)=>r===expt[i]) - , fail=pass.map((p,i)=>p?-1:i).filter(i=>i>=0) -console.log( - fail.length - ? fail.map(i=>'"'+t[i][1]+'": expected '+expt[i]+' but received '+rslt[i]) - : "All passed!" -) -process.exit(+(fail.length>0)) + +var compiler = execFile( + __dirname+'/../cshim.bqn', + [ '{•←Compile𝕩}¨⟨'+test+'⟩' ], + function (error, stdout, stderr) { + const rslt=stdout.split('\n').filter(a=>a.length) + .map(a=>runWasm(a.split("‿").map(n=>+n))) + , pass=rslt.map((r,i)=>r===expt[i]) + , fail=pass.map((p,i)=>p?-1:i).filter(i=>i>=0) + console.log( + fail.length + ? fail.map(i=>'"'+t[i][1]+'": expected '+expt[i]+' but received '+rslt[i]) + : "All passed!" + ) + process.exit(+(fail.length>0)) + } +); -- cgit v1.2.3