aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-11-27 15:25:40 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-11-27 16:05:28 -0500
commitb9a41bf4639343573dbd3b9a25ca3a6e3930cd6b (patch)
tree40b75fb773f5b9ee41e057cdf05c74ffb0e9066e /test
parent1741d5078e9ef8617c99f1fb9c98d1583e072df9 (diff)
Use pr.bqn for dz_rt instead of rewriting runtime code
Diffstat (limited to 'test')
-rwxr-xr-xtest/dz_rt65
1 files changed, 13 insertions, 52 deletions
diff --git a/test/dz_rt b/test/dz_rt
index 4c7c6c89..9d2f2aa9 100755
--- a/test/dz_rt
+++ b/test/dz_rt
@@ -2,59 +2,20 @@
# Compile and run the primitive implementations, and prim.bqn
-impl ← •LNS "../src/r.bqn"
-
-⟨DRun⟩ ← •Import "../dc.bqn"
-
-chrs←⟨
- "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔"
- "˙˜˘¨⌜⁼´˝`"
- "∘⊸⟜○⌾⎉⚇⍟◶⊘"
+⟨ref⟩ ← •Import "../src/pr.bqn"
+⟨DRun,DCompile⟩ ← •Import "../dc.bqn"
+
+provide ← ⟨
+ 0≠≡ # IsArray
+ ⊑⟨⟩⥊0⊸⥊ # Type
+ ⋆⁼ # Log
+ ≠¨⊔ # GroupLen
+ ∾⊔∘⊢ # GroupOrd
+ !,+,-,×,÷,⋆,⌊,=,≤,≢,⥊,⊑,↕,⌜,`,⊘
-nc ← ≠¨chrs
-chr ← ∾chrs
-itr ← 0⥊˜≠chr
-
-init ← " "⊸∾¨(/⟜"_"¨nc/0‿1‿1)∾¨(nc/"FMD")∾¨(nc+´⊸↑⥊"ABC"∾⌜•a)
-post ← ∾⟜" "¨/⟜"_"¨nc/0‿0‿1
-names ← init∾¨'0'∾¨post
-
-Inc ← {
- i←⊑chr⊐𝕩
- n←0 ⋄ itr↩{n↩1+𝕩}⌾(i⊑⊢)itr
- names↩((i⊑init)∾('0'+n)∾i⊑post)⌾(i⊑⊢)names
-}
-
-# built-in assumptions
-Mod ← {((⊑chr⊐𝕨)⊑names) ∾ " ← " ∾ 𝕩}
-
-pre ← ⟨
- "IsArray ← 0≠≡"
- "Type ← ⊑⟨⟩⥊0⊸⥊"
- "Log ← ⋆⁼"
- "GroupLen← ≠¨⊔"
- "GroupOrd← ∾⊔∘⊢"
- '!' Mod "{𝕩 ⋄ ≤1}⍟(1≢⊢)"
-⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘"
-
-
-# checks if line is a builtin redefinition
-E_isdef ← (3≤≠)◶⟨0,∧´⟨chr," ","←↩"⟩∊˜¨3⊸↑⟩
-
-# removes comments and replaces built-ins with names
-E_proc ← {
- l←≠chr
- q←≠`𝕩='"' ⋄ q∨↩≠`q<𝕩=''' ⋄ f←¬∨`q<𝕩='#'
- ∾ (((l×f/q)+chr⊸⊐) (≥⟜l)◶⟨⊑⟜names,⥊∘⊢⟩¨ ⊢) f/𝕩
-}
+rt ← •COMP provide⊸(⊣»«)⌾(1⊸⊑) DCompile ref
-E_redef ← { # handles [fmd] [←↩]
- tail ← E_proc 3↓𝕩 # must use old def
- Inc ⊑𝕩
- (E_proc 1↑𝕩) ∾ "←" ∾ tail
-}
+t ← "¬⟨"‿"⟩" (1⌽⌽⊸∾) (¬∘⊑':'∊⊢)¨⊸/ •LNS "prim.bqn"
+res ← rt DRun ∾ ∾⟜(@+10)¨ t
-pre ∾↩ E_isdef◶E_proc‿E_redef¨ impl
-t ← ⟨"¬⟨"⟩∾⟨"⟩"⟩∾˜ (¬∘⊑':'∊⊢)¨⊸/ •LNS "prim.bqn"
-res ← DRun ∾ ∾⟜(@+10)¨ pre ∾ E_proc¨ t
•Out ("All "∾(⍕≠res)∾" passed!")⍟(0=≠) /res