aboutsummaryrefslogtreecommitdiff
path: root/test/dz_comp
blob: 4a8d9f2227a7c539cc7658fa03bf6c36c146eb77 (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
36
37
38
39
40
41
42
43
#! /usr/bin/env dbqn

ncrt  "-nocomp""-rt"  args
files  "simple""syntax""prim"(0=) ('-'≠⊑)¨⊸/ args
"Can't test runtime without the compiler!" ! ¬ncrt

DRun,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⊸⥊)⊘⊢     # Fill
    ⋆⁼              # Log
    ≠¨⊔             # GroupLen
    ∾⊔∘⊢            # GroupOrd
    !,+,-,×,÷,,,=,,,,,,,`,{𝕘𝔽},
  
  rt  COMP provide(⊣»«)(1⊸⊑) DCompile ref
}

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

Cases  (0<)0('#'≠⊑)¨⊸/ · FLines "cases/"∾∾⟜".bqn"
c   Cases¨ files
Trim  ((∨`∧∨`⌾⌽)' '⊸≠)/
M  {eb:
  Msg  {∾⟨
    """",b,""": expected "
    "to fail"("!"⊸≡)e
    " but "
    0⊸≡◶⟨"received "2Pretty,"evaluation failed"𝕩
    ⥊@+10
  }
  ("!"⊸≡◶⟨<Native,0˙⟩ e) ≢◶""Msg <Exec0 b
}
r  (M '%'= (∨´⊣)◶⟨"1"≍○<, Trim¨(+`-2⊸×)⊸⊔⟩ )¨ c
Out ("All "(⍕≠c)" passed!")(0=) ¯1↓∾r