Compare commits

..

No commits in common. "4fb73b3c6f4baa248a28a87d01694412d630d6a5" and "5d81054cf6f3599c3591d22ba6d5fda5fb10d4c9" have entirely different histories.

2 changed files with 18 additions and 19 deletions

View File

@ -72,10 +72,10 @@ double acc_float(int c) {
char* acc_word(int c) {
Dstr* val = dstr_init();
while (isalpha(*inp)) {
do {
dstr_appendch(val, *(inp - 1));
inp++;
}
} while (isalpha(*inp));
dstr_appendch(val, *(inp - 1));
char* ret = val->buf;

View File

@ -84,26 +84,25 @@ bin() { ./scl.out $1 | tail -n1; }
[ "$output" = "= 9.000000" ]
}
@test "basic blocks" {
run bin "{1}"
[ "$output" = "= 1.000000" ]
run bin "2+{3;4}"
[ "$output" = "= 6.000000" ]
run bin "5*{1+1;5*2}"
echo $output
[ "$output" = "= 50.000000" ]
}
@test "variable definition" {
run bin "x=1"
[ "$output" = "= 1.000000" ]
#@test "basic blocks" {
# run bin "{ 1 }"
# [ "$output" = "= 1.000000" ]
#
# run bin "2 + { 3; 4 }"
# [ "$output" = "= 6.000000" ]
#
# run bin "5 * { 1 + 1; 5 * 2 }"
# [ "$output" = "50.000000" ]
#}
#@test "variable definition" {
# run bin "x = 1"
# [ "$output" = "= 1.000000" ]
#
# run bin "x = 1; x + 1"
# [ "$output" = "= 2.000000" ]
}
#}
#
#@test "function definition" {
# run bin "f(n)=2*n; f(2)"
# [ "$output" = "= 4.000000" ]