aboutsummaryrefslogtreecommitdiff
path: root/test/dz_comp
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-11-27 16:02:34 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-11-27 16:05:28 -0500
commit021fb5911afe12e8f0085a1c1ce6ad397719fe11 (patch)
tree5a7b18cc303efb1473b20c014ebdbf13eb027f3f /test/dz_comp
parentb9a41bf4639343573dbd3b9a25ca3a6e3930cd6b (diff)
Allow testing the runtime in dz_comp, making dzref_full and dz_rt unnecessary
Diffstat (limited to 'test/dz_comp')
-rwxr-xr-xtest/dz_comp29
1 files changed, 26 insertions, 3 deletions
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