aboutsummaryrefslogtreecommitdiff
path: root/test/dz_comp
blob: 67fef043f2c51575176ac2f8bc3b2b9683f41d1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env dbqn

ncrtprim  "-nocomp""-rt""-prim"  args
"Can't test runtime without the compiler!" ! ¬ncrtDRun,DCompile  Import "../dc.bqn"

GetRT  {𝕤:
  ref,glyphs  Import "../src/pr.bqn"
  PrimInd  {⊑rt<𝕩}
  Decompose  ((glyphs)>PrimInd)◶⟨•Decompose,0⊸≍⟩
  provide      Type           # Type
    Decompose       # Decompose
    glyphs⊑˜PrimInd # Glyph
    ⊑⟨⟩⥊0⊸⥊         # GetFill
    ⋆⁼              # Log
    ≠¨⊔             # GroupLen
    ∾⊔∘⊢            # GroupOrd
    !,+,-,×,÷,⋆,⌊,=,≤,≢,⥊,⊑,↕,⌜,`,⊘
    rt  COMP provide(⊣»«)(1⊸⊑) DCompile ref
}

Native  {⍎𝕩}
exec  (rt¬nc)◶⟨Native˙, DRun˙, {𝕩⊸DRun}∘GetRT @

c  (FLines ∾⟜"cases.bqn")¨"""b"
{𝕩: c ∾↩ "1 %"⊸∾¨ (0<)0((¬":"⊑∘∊⊢)'#'≠⊑)¨⊸/ FLines "prim.bqn" }⍟⊢ prim
M  {eb:
  Err  {(@+10)∾˜""""b""": expected "e" but received "∾⍕𝕩}
  (Native e) ≢◶""Err Exec b
}
r  '%' M((+`-2⊸×)=⊔⊢)¨ cOut ("All "(⍕≠c)" passed!")(0=) r