diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-27 16:02:34 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-27 16:05:28 -0500 |
| commit | 021fb5911afe12e8f0085a1c1ce6ad397719fe11 (patch) | |
| tree | 5a7b18cc303efb1473b20c014ebdbf13eb027f3f /test | |
| parent | b9a41bf4639343573dbd3b9a25ca3a6e3930cd6b (diff) | |
Allow testing the runtime in dz_comp, making dzref_full and dz_rt unnecessary
Diffstat (limited to 'test')
| -rw-r--r-- | test/README.txt | 15 | ||||
| -rwxr-xr-x | test/dz_comp | 29 | ||||
| -rwxr-xr-x | test/dz_rt | 21 |
3 files changed, 35 insertions, 30 deletions
diff --git a/test/README.txt b/test/README.txt index 4a000dbc..26f2d4e6 100644 --- a/test/README.txt +++ b/test/README.txt @@ -1,16 +1,19 @@ Test scripts: - Script Compiler host Output host -- js [-prim] Self-host BQN on Javascript + Script Compiler host Output host/VM +- js [-prim] Self-host Javascript - dz_comp [-prim] dzaima/BQN dzaima/BQN -- dz_rt dzaima/BQN BQN on dzaima/BQN - dz_wasm.js dzaima/BQN WebAssembly +dz_comp uses the self-hosted compiler ../src/c.bqn by default but not +the runtime ../src/r.bqn. Pass -rt to test with the runtime, and -comp +to test dzaima/BQN only (this doesn't pass as of the time of writing). + Test cases: - js dz_comp dz_rt dz_wasm.js -- cases.bqn * * * + js dz_comp dz_wasm.js +- cases.bqn * * * - bcases.bqn * * -- prim.bqn -prim -prim * +- prim.bqn -prim -prim Contents of bin/dbqn follow (3 lines). Replace "/path/to/dzaima/" with your path. diff --git a/test/dz_comp b/test/dz_comp index dfa4bd6b..9f336b07 100755 --- a/test/dz_comp +++ b/test/dz_comp @@ -1,8 +1,31 @@ #! /usr/bin/env dbqn -⟨DRun⟩ ← •Import "../dc.bqn" +nc‿rt‿prim ← "-nocomp"‿"-rt"‿"-prim" ∊ •args +"Can't test runtime without the compiler!" ! ¬nc∧rt + +⟨DRun,DCompile⟩ ← •Import "../dc.bqn" + +GetRT ← {𝕤: + ⟨ref⟩ ← •Import "../src/pr.bqn" + provide ← ⟨ + 0≠≡ # IsArray + ⊑⟨⟩⥊0⊸⥊ # Type + ⋆⁼ # Log + ≠¨⊔ # GroupLen + ∾⊔∘⊢ # GroupOrd + !,+,-,×,÷,⋆,⌊,=,≤,≢,⥊,⊑,↕,⌜,`,⊘ + ⟩ + •COMP provide⊸(⊣»«)⌾(1⊸⊑) DCompile ref +} + +Native ← {⍎𝕩} +exec ← (rt¬nc)◶⟨Native˙, DRun˙, {𝕩⊸DRun}∘GetRT⟩ @ + c ← ∾(•LNS ∾⟜"cases.bqn")¨""‿"b" -{𝕩: c ∾↩ (¬":"⊑∘∊⊢)¨⊸/ "1 %"⊸∾¨ (0<≠)◶0‿('#'≠⊑)¨⊸/ •LNS "prim.bqn" }⍟⊢⊑(<"-prim")∊•args -M ← {e‿b: (⍎e)⊸≢◶""‿{(@+10)∾˜""""∾b∾""": expected "∾e∾" but received "∾⍕𝕩} DRun b} +{𝕩: c ∾↩ "1 %"⊸∾¨ (0<≠)◶0‿((¬":"⊑∘∊⊢)∧'#'≠⊑)¨⊸/ •LNS "prim.bqn" }⍟⊢ prim +M ← {e‿b: + Err ← {(@+10)∾˜""""∾b∾""": expected "∾e∾" but received "∾⍕𝕩} + (Native e) ≢◶""‿Err Exec b +} r ← '%' M∘((+`-2⊸×)∘=⊔⊢)¨ c •Out ("All "∾(⍕≠c)∾" passed!")⍟(0=≠) ∾r diff --git a/test/dz_rt b/test/dz_rt deleted file mode 100755 index 9d2f2aa9..00000000 --- a/test/dz_rt +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env dbqn - -# Compile and run the primitive implementations, and prim.bqn - -⟨ref⟩ ← •Import "../src/pr.bqn" -⟨DRun,DCompile⟩ ← •Import "../dc.bqn" - -provide ← ⟨ - 0≠≡ # IsArray - ⊑⟨⟩⥊0⊸⥊ # Type - ⋆⁼ # Log - ≠¨⊔ # GroupLen - ∾⊔∘⊢ # GroupOrd - !,+,-,×,÷,⋆,⌊,=,≤,≢,⥊,⊑,↕,⌜,`,⊘ -⟩ -rt ← •COMP provide⊸(⊣»«)⌾(1⊸⊑) DCompile ref - -t ← "¬⟨"‿"⟩" (1⌽⌽⊸∾) (¬∘⊑':'∊⊢)¨⊸/ •LNS "prim.bqn" -res ← rt DRun ∾ ∾⟜(@+10)¨ t - -•Out ("All "∾(⍕≠res)∾" passed!")⍟(0=≠) /res |
