clean up test stuff
This commit is contained in:
parent
0527db0a24
commit
70291dc060
@ -7,11 +7,11 @@ build/run:
|
||||
|
||||
Time safe prim tests with self-hosted compiler:
|
||||
|
||||
`time ./primSafe.bqn path/to/mlochbaum/BQN | ./BQN`
|
||||
`time ./test.bqn path/to/mlochbaum/BQN -s prim | ./BQN`
|
||||
|
||||
Test precompiled safe prim tests:
|
||||
|
||||
1. uncomment [this](https://github.com/dzaima/CBQN/blob/528279b8e3e0fb108868f47b7bdfe772c26f10c3/src/main.c#L101-L106)
|
||||
2. `./test.bqn path/to/mlochbaum/BQN "$PATH"`
|
||||
2. `./precompiled.bqn path/to/mlochbaum/BQN "$PATH"`
|
||||
|
||||
Any file without an explicit copyright message is copyright (c) 2021 dzaima, GNU GPLv3 - see LICENSE
|
||||
29
precompiled.bqn
Executable file
29
precompiled.bqn
Executable file
@ -0,0 +1,29 @@
|
||||
#! /usr/bin/env dbqn
|
||||
"Usage: ./precompiled.bqn path/to/mlochbaum/BQN ""$PATH"" [expressions, else prim tests]"!2≤≠•args
|
||||
path←0⊑•args
|
||||
envP←1⊑•args
|
||||
|
||||
tests ← •FLines 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"
|
||||
# tests ← •FLines path∾"/test/cases/fill.bqn"
|
||||
{tests↩𝕩}⍟(×≠) 2↓•args
|
||||
|
||||
('#'≠ ·⊑ ∾⟜"#")◶@‿{
|
||||
'%'⊸∊◶{𝕤
|
||||
•Out 𝕩
|
||||
"src/interp" •FChars ⟨1,path,𝕩⟩ •Import "cc.bqn"
|
||||
(×⊑)◶@‿{𝕤⋄•Out "############ Failed to compile! ############" ⋄ •Out¨1↓𝕩}{env⇐<"PATH="∾envP}•SH"./debugBuild"
|
||||
code‿out‿err←•SH"./BQN"
|
||||
•Out out
|
||||
{𝕤⋄•Out"exit code "∾(⍕code) ⋄ •Out err}⍟(×code) err
|
||||
}‿{𝕤
|
||||
# •Out 𝕩
|
||||
# "src/interp" •FChars ⟨1,path,3↓𝕩⟩ •Import "cc.bqn"
|
||||
# (×⊑)◶@‿{𝕤⋄•Out "############ Failed to compile! ############" ⋄ •Out¨1↓𝕩}{env⇐<"PATH="∾envP}•SH"./debugBuild"
|
||||
# code‿out‿err←•SH"./BQN"
|
||||
# •Out out
|
||||
# {𝕤⋄•Out"exit code "∾(⍕code) ⋄ •Out err}⍟(×code) err
|
||||
}
|
||||
}¨tests
|
||||
11
primSafe.bqn
11
primSafe.bqn
@ -1,11 +0,0 @@
|
||||
#! /usr/bin/env dbqn
|
||||
"Usage: ./primSafe.bqn path/to/mlochbaum/BQN | ./BQN"!1≤≠•args
|
||||
path←⊑•args
|
||||
case←"prim"
|
||||
{case↩⊑𝕩}⍟(×≠) 1↓•args
|
||||
case∾↩".bqn"
|
||||
|
||||
|
||||
('%'⊸∊∨ '#'= ·⊑ ∾⟜"#")◶•Out‿@¨•FLines path∾"/test/cases/"∾case
|
||||
•Out """finished"""
|
||||
•Out ""
|
||||
4
src/vm.c
4
src/vm.c
@ -295,7 +295,7 @@ B evalBC(Body* b, Scope* sc) { // doesn't consume
|
||||
vmStack[stackNum] = bcPos;
|
||||
for(i32 i = 0; i < bcDepth; i++) printf(" ");
|
||||
printBC(sbc); printf("@%d << ", bcPos);
|
||||
for (i32 i = 0; i < sh; i++) { if(i)printf(" ⋄ "); print(stack[i]); } puts(""); fflush(stdout);
|
||||
for (i32 i = 0; i < b->maxStack; i++) { if(i)printf(" ⋄ "); print(gStack[i]); } puts(""); fflush(stdout);
|
||||
bcCtr++;
|
||||
for (i32 i = 0; i < sc->varAm; i++) validate(sc->vars[i]);
|
||||
#endif
|
||||
@ -384,7 +384,7 @@ B evalBC(Body* b, Scope* sc) { // doesn't consume
|
||||
#ifdef DEBUG_VM
|
||||
for(i32 i = 0; i < bcDepth; i++) printf(" ");
|
||||
printBC(sbc); printf("@%ld: ", sbc-c(I32Arr,b->comp->bc)->a);
|
||||
for (i32 i = 0; i < sh; i++) { if(i)printf(" ⋄ "); print(stack[i]); } puts(""); fflush(stdout);
|
||||
for (i32 i = 0; i < b->maxStack; i++) { if(i)printf(" ⋄ "); print(gStack[i]); } puts(""); fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
end:;
|
||||
|
||||
43
test.bqn
43
test.bqn
@ -1,29 +1,20 @@
|
||||
#! /usr/bin/env dbqn
|
||||
"Usage: ./test.bqn path/to/mlochbaum/BQN ""$PATH"" [optional expressions to evaluate]"!2≤≠•args
|
||||
path←0⊑•args
|
||||
envP←1⊑•args
|
||||
"Usage: ./test.bqn path/to/mlochbaum/BQN [-sme] name | ./BQN"!2≤≠•args
|
||||
path←⊑•args
|
||||
args←1↓•args
|
||||
opt←""
|
||||
{𝕊: opt↩𝕩 ⋄ args↓˜↩1}⍟('-'≡⊑) ⊑args
|
||||
|
||||
tests ← •FLines 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"
|
||||
# tests ← •FLines path∾"/test/cases/fill.bqn"
|
||||
{tests↩𝕩}⍟(×≠) 2↓•args
|
||||
"Missing argument!"!1=≠args
|
||||
case←⊑args
|
||||
case∾↩".bqn"
|
||||
tests ← •FLines path∾"/test/cases/"∾case
|
||||
tests/˜↩ (('#'≢⊑)∧0<≠)¨tests
|
||||
{𝕊: tests/˜↩{"! %"≢3↑𝕩}¨tests}⍟⊑ 's'∊opt
|
||||
{𝕊: tests/˜↩{"! %"≡3↑𝕩}¨tests}⍟⊑ 'e'∊opt
|
||||
Out ← {•Out'%'⊸∊◶⊢‿{𝕩↓˜1+⊑𝕩⊐'%'}𝕩}
|
||||
|
||||
('#'≠ ·⊑ ∾⟜"#")◶@‿{
|
||||
'%'⊸∊◶{𝕤
|
||||
•Out 𝕩
|
||||
"src/interp" •FChars ⟨1,path,𝕩⟩ •Import "cc.bqn"
|
||||
(×⊑)◶@‿{𝕤⋄•Out "############ Failed to compile! ############" ⋄ •Out¨1↓𝕩}{env⇐<"PATH="∾envP}•SH"./debugBuild"
|
||||
code‿out‿err←•SH"./BQN"
|
||||
•Out out
|
||||
{𝕤⋄•Out"exit code "∾(⍕code) ⋄ •Out err}⍟(×code) err
|
||||
}‿{𝕤
|
||||
# •Out 𝕩
|
||||
# "src/interp" •FChars ⟨1,path,3↓𝕩⟩ •Import "cc.bqn"
|
||||
# (×⊑)◶@‿{𝕤⋄•Out "############ Failed to compile! ############" ⋄ •Out¨1↓𝕩}{env⇐<"PATH="∾envP}•SH"./debugBuild"
|
||||
# code‿out‿err←•SH"./BQN"
|
||||
# •Out out
|
||||
# {𝕤⋄•Out"exit code "∾(⍕code) ⋄ •Out err}⍟(×code) err
|
||||
}
|
||||
}¨tests
|
||||
((⊑'m'∊opt)⊑Out‿{•Show𝕩⋄Out𝕩})¨tests
|
||||
# ('%'⊸∊∨ '#'= ·⊑ ∾⟜"#")◶•Out‿@¨tests
|
||||
•Out """finished"""
|
||||
•Out ""
|
||||
Loading…
Reference in New Issue
Block a user