blob: dd0f5e1cc12b3bd88b524fc9be94bb6651719954 (
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
|
#! /usr/bin/env dbqn
nc‿rt‿ref ← "-nocomp"‿"-rt"‿"-ref" ∊ •args
files ← "simple"‿"syntax"‿"prim"⍟(0=≠) ('-'≠⊑)¨⊸/ •args
"Can't test runtime without the compiler!" ! ¬nc∧rt∨ref
Native ← •BQN
exec ← ((rt⌈2×ref)¬nc)◶⟨
Native˙ # Native
{𝕤⋄ ⟨DRun⟩←•Import "../dc.bqn" ⋄ DRun} # Compiled; native runtime
{𝕤⋄ •Import "../bqn.bqn"} # Self-hosted
{𝕤⋄ •Import "ref.bqn"} # Reference implementations
⟩ @
Cases ← (0<≠)◶0‿('#'≠⊑)¨⊸/ · •FLines "cases/"∾∾⟜".bqn"
c ← ∾ Cases¨ files
Trim ← ((∨`∧∨`⌾⌽)' '⊸≠)⊸/
M ← {e‿b:
Msg ← {∾⟨
"""",b,""": expected "
"to fail"⍟("!"⊸≡)e
" but "
0⊸≡◶⟨"received "∾2•Fmt⊑,"evaluation failed"⟩𝕩
⥊@+10
⟩}
("!"⊸≡◶⟨<Native,0˙⟩ e) ≢◶""‿Msg <∘Exec⎊0 b
}
r ← (M '%'⊸= (∨´⊣)◶⟨"1"≍○<⊢, Trim¨(+`-2⊸×)⊸⊔⟩ ⊢)¨ c
•Out ("All "∾(⍕≠c)∾" passed!")⍟(0=≠) ¯1↓∾r
|