diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-09-08 21:14:26 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-09-08 21:14:26 -0400 |
| commit | 2ff502e46f9d7e6929059479da2e160d0cbbf5de (patch) | |
| tree | 4bc056b8ffbdbd3e4f24cec4c7a68d8345b1bb07 | |
| parent | 176c78f51809ba3648d7a4cdedc78553df5904ae (diff) | |
Organize tests scripts a little better and add README
| -rw-r--r-- | test/README.txt | 20 | ||||
| -rwxr-xr-x | test/dz_comp (renamed from test/bt) | 2 | ||||
| -rwxr-xr-x | test/dz_rt (renamed from test/cmpref.bqn) | 6 | ||||
| -rwxr-xr-x | test/dz_wasm.js (renamed from test/tw.js) | 0 | ||||
| -rwxr-xr-x | test/js (renamed from test/tj.js) | 8 | ||||
| -rw-r--r-- | test/prim.bqn (renamed from test/testref.bqn) | 0 |
6 files changed, 28 insertions, 8 deletions
diff --git a/test/README.txt b/test/README.txt new file mode 100644 index 00000000..12eb9bf1 --- /dev/null +++ b/test/README.txt @@ -0,0 +1,20 @@ +Test scripts: + + Script Compiler host Output host +- js [-prim] Self-host BQN on Javascript +- dz_comp [-prim] dzaima/BQN dzaima/BQN +- dz_rt dzaima/BQN BQN on dzaima/BQN +- dz_wasm.js dzaima/BQN WebAssembly + +Test cases: + js dz_comp dz_rt dz_wasm.js +- cases.bqn * * * +- bcases.bqn * * +- prim.bqn -prim -prim * + +Contents of bin/dbqn follow (3 lines). Replace "/path/to/dzaima/" with +your path. To work on dz_rt, add "-e •compstart↩¯1" before "-f". + +#! /bin/bash + +java -jar /path/to/dzaima/BQN/BQN.jar -f "$@" @@ -2,7 +2,7 @@ dRun ← •EX •path∾"../dc.bqn" c ← ∾(•LNS •path∾∾⟜"cases.bqn")¨""‿"b" -{𝕩: c ∾↩ (¬":"⊑∘∊⊢)¨⊸/ "1 %"⊸∾¨ (3≤≠)◶0‿(('#'≠2⊸⊑)∧" "≡2⊸↑)¨⊸/ •LNS •path∾"testref.bqn" }⍟⊢⊑(<"-ref")∊•args +{𝕩: c ∾↩ (¬":"⊑∘∊⊢)¨⊸/ "1 %"⊸∾¨ (3≤≠)◶0‿(('#'≠2⊸⊑)∧" "≡2⊸↑)¨⊸/ •LNS •path∾"prim.bqn" }⍟⊢⊑(<"-prim")∊•args M ← {e‿b: (⍎e)⊸≢◶""‿{(@+10)∾˜""""∾b∾""": expected "∾e∾" but received "∾⍕𝕩} DRun b} r ← '%' M∘((+`-2⊸×)∘=⊔⊢)¨ c • ← ("All "∾(⍕≠c)∾" passed!")⍟(0=≠) ∾r diff --git a/test/cmpref.bqn b/test/dz_rt index 23bccd17..f83a787d 100755 --- a/test/cmpref.bqn +++ b/test/dz_rt @@ -1,10 +1,10 @@ #!/usr/bin/env dbqn -# Compile and run the primitive implementations, and testref.bqn +# Compile and run the primitive implementations, and prim.bqn impl ← •LNS •path∾"../src/r.bqn" -drun ← ((<•path∾"../dc.bqn")∾<"DRun") •EX •path∾"../dzref" +drun ← •EX •path∾"../dc.bqn" chrs←⟨ "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔" @@ -55,6 +55,6 @@ E_redef ← { # handles [fmd] [←↩] } pre ∾↩ E_isdef◶E_proc‿E_redef¨ impl -t ← (¬∘⊑':'∊⊢)¨⊸/ 3⊸↓⌾(3⊸⊑) •LNS •path∾"testref.bqn" +t ← (¬∘⊑':'∊⊢)¨⊸/ 3⊸↓⌾(3⊸⊑) •LNS •path∾"prim.bqn" res ← DRun ∾ ∾⟜(@+10)¨ pre ∾ E_proc¨ t • ← ("All "∾(⍕≠res)∾" passed!")⍟(0=≠) /res diff --git a/test/tw.js b/test/dz_wasm.js index b8faa668..b8faa668 100755 --- a/test/tw.js +++ b/test/dz_wasm.js @@ -3,15 +3,15 @@ let bqn = require(__dirname+'/../docs/bqn.js'); let load = f=>require('fs').readFileSync(__dirname+'/'+f,'utf8'); let args = process.argv.slice(2); -let ref = args[0]==="-ref"; +let prim = args[0]==="-prim"; -if (ref || args.length==0) { +if (prim || args.length==0) { let t = (load('cases.bqn')+load('bcases.bqn')) .split('\n').filter(x=>x).map(x=>x.split(' % ')); let test = t.map(e=>e[1]); let expt = t.map(e=>+e[0]); - if (ref) { - let r = load('testref.bqn').split('\n') + if (prim) { + let r = load('prim.bqn').split('\n') .filter(x=>x.charAt(0)===' ' &&x.charAt(1)===' ' &&x.charAt(2)!=='#' diff --git a/test/testref.bqn b/test/prim.bqn index bf455944..bf455944 100644 --- a/test/testref.bqn +++ b/test/prim.bqn |
