From 8900d27e271428ef7998da7949c56875e3666e23 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 4 Jun 2022 01:54:19 +0300 Subject: [PATCH] move old helper utilities to test/ --- test/README.md | 4 ++++ precompiled.bqn => test/precompiled.bqn | 6 +++--- test.bqn => test/readTests.bqn | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) rename precompiled.bqn => test/precompiled.bqn (82%) rename test.bqn => test/readTests.bqn (86%) diff --git a/test/README.md b/test/README.md index 9f6ef6ff..3fea34fd 100644 --- a/test/README.md +++ b/test/README.md @@ -13,4 +13,8 @@ test/moreCfgs.sh path/to/mlochbaum/BQN // run "2+2" in a bunch of configurations ./BQN test/squeeze.bqn // fuzz-test squeezing; requires a CBQN build with -DEEQUAL_NEGZERO ./BQN test/random.bqn // various random tests make -C test/ffi // test FFI functionality + +legacy utilities: + test/readTests.bqn // read mlochbaum/BQN tests in various formats + test/precompiled.bqn // run a precompiled expression ``` \ No newline at end of file diff --git a/precompiled.bqn b/test/precompiled.bqn similarity index 82% rename from precompiled.bqn rename to test/precompiled.bqn index b442fa38..d03b0cd2 100755 --- a/precompiled.bqn +++ b/test/precompiled.bqn @@ -3,7 +3,7 @@ path←0⊑•args envP←1⊑•args -tests ← •FLines path∾"/test/cases/prim.bqn" +tests ← •FLines •wdpath•file.At path∾"/test/cases/prim.bqn" # tests ← •FLines path∾"/test/cases/identity.bqn" # tests ← •FLines path∾"/test/cases/undo.bqn" # tests ← •FLines path∾"/test/cases/under.bqn" @@ -13,12 +13,12 @@ tests ← •FLines path∾"/test/cases/prim.bqn" ('#'≠ ·⊑ ∾⟜"#")◶@‿{ (⊑'%'⊸∊)◶{𝕤 •Out 𝕩 - "src/gen/interp" •FChars ⟨1,path,𝕩⟩ •Import "cc.bqn" + "../src/gen/interp" •FChars ⟨1,path,𝕩⟩ •Import "../cc.bqn" # make ← "make"‿"singeli=1"‿"f=-DPRECOMP -march=native"‿"c" # make ← "make"‿"f=-DPRECOMP -m32"‿"lf=-m32"‿"c" make ← "make"‿"f=-DPRECOMP"‿"c" (×⊑)◶@‿{𝕤⋄•Out "############ Failed to compile! ############" ⋄ •Out¨1↓𝕩}{env⇐<"PATH="∾envP}•SH make - code‿out‿err←•SH⟨"./BQN"⟩ + code‿out‿err←•SH⟨•file.At "../BQN"⟩ •Out out {𝕤⋄•Out"exit code "∾(•Repr code) ⋄ •Out err}⍟(×code) err }‿⊢ diff --git a/test.bqn b/test/readTests.bqn similarity index 86% rename from test.bqn rename to test/readTests.bqn index a6938a12..6b1154d3 100755 --- a/test.bqn +++ b/test/readTests.bqn @@ -1,6 +1,6 @@ #! /usr/bin/env dbqn "Usage: ./test.bqn path/to/mlochbaum/BQN [-qsmev] name | ./BQN"!2≤≠•args -path←⊑•args +path←•wdpath•file.At ⊑•args args←1↓•args opt←"" {𝕊: opt↩𝕩 ⋄ args↓˜↩1}⍟('-'≡⊑) ⊑args @@ -18,7 +18,7 @@ opt←"" i←⊑𝕩⊐'%' ((1+'!'≠⊑𝕩)×verify)◶⟨(1+i)⊸↓ ⋄ {∾ ⟨"""should've errored!""∘•BQN⎊1 """ ⋄ {𝕩/˜1+𝕩='"'}𝕩↓˜1+⊑𝕩⊐'%' ⋄ """"⟩} ⋄ {∾⟨"""incorrect!""‿1⊑˜(" ⋄ i↑𝕩 ⋄ ") ≡ {" ⋄ (1+i)↓𝕩 ⋄ " }"⟩}⟩ RMC 𝕩 } - Out ← {•Out'%'⊸∊◶(verify◶⊢‿{∾⟨"""incorrect!""‿1⊑˜1≡{" ⋄ RMC 𝕩 ⋄ " }"⟩})‿Q𝕩} + Out ← {•Out(⊑'%'⊸∊)◶(verify◶⊢‿{∾⟨"""incorrect!""‿1⊑˜1≡{" ⋄ RMC 𝕩 ⋄ " }"⟩})‿Q𝕩} ((⊑'m'∊opt)⊑Out‿{•Show𝕩⋄Out𝕩})¨tests # ('%'⊸∊∨ '#'= ·⊑ ∾⟜"#")◶•Out‿@¨tests