clean up test stuff

This commit is contained in:
dzaima 2021-04-22 16:16:14 +03:00
parent 0527db0a24
commit 70291dc060
5 changed files with 50 additions and 41 deletions

View File

@ -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
View File

@ -0,0 +1,29 @@
#! /usr/bin/env dbqn
"Usage: ./precompiled.bqn path/to/mlochbaum/BQN ""$PATH"" [expressions, else prim tests]"!2•args
path0•args
envP1•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"
codeouterr•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

View File

@ -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 ""

View File

@ -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:;

View File

@ -1,29 +1,20 @@
#! /usr/bin/env dbqn
"Usage: ./test.bqn path/to/mlochbaum/BQN ""$PATH"" [optional expressions to evaluate]"!2•args
path0•args
envP1•args
"Usage: ./test.bqn path/to/mlochbaum/BQN [-sme] name | ./BQN"!2•args
path•args
args1•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
caseargs
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"
codeouterr•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 ""