#! /usr/bin/env dbqn nc‿rt‿prim ← "-nocomp"‿"-rt"‿"-prim" ∊ •args "Can't test runtime without the compiler!" ! ¬nc∧rt ⟨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⊸⥊ # 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 ← {e‿b: Err ← {(@+10)∾˜""""∾b∾""": expected "∾e∾" but received "∾⍕𝕩} (Native e) ≢◶""‿Err Exec b } r ← '%' M∘((+`-2⊸×)∘=⊔⊢)¨ c •Out ("All "∾(⍕≠c)∾" passed!")⍟(0=≠) ∾r