Compare commits
2 Commits
5d81054cf6
...
4fb73b3c6f
Author | SHA1 | Date | |
---|---|---|---|
4fb73b3c6f | |||
e5c58d5fc5 |
@ -72,10 +72,10 @@ double acc_float(int c) {
|
|||||||
|
|
||||||
char* acc_word(int c) {
|
char* acc_word(int c) {
|
||||||
Dstr* val = dstr_init();
|
Dstr* val = dstr_init();
|
||||||
do {
|
while (isalpha(*inp)) {
|
||||||
dstr_appendch(val, *(inp - 1));
|
dstr_appendch(val, *(inp - 1));
|
||||||
inp++;
|
inp++;
|
||||||
} while (isalpha(*inp));
|
}
|
||||||
dstr_appendch(val, *(inp - 1));
|
dstr_appendch(val, *(inp - 1));
|
||||||
|
|
||||||
char* ret = val->buf;
|
char* ret = val->buf;
|
||||||
|
@ -84,25 +84,26 @@ bin() { ./scl.out $1 | tail -n1; }
|
|||||||
[ "$output" = "= 9.000000" ]
|
[ "$output" = "= 9.000000" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
#@test "basic blocks" {
|
@test "basic blocks" {
|
||||||
# run bin "{ 1 }"
|
run bin "{1}"
|
||||||
# [ "$output" = "= 1.000000" ]
|
[ "$output" = "= 1.000000" ]
|
||||||
#
|
|
||||||
# run bin "2 + { 3; 4 }"
|
run bin "2+{3;4}"
|
||||||
# [ "$output" = "= 6.000000" ]
|
[ "$output" = "= 6.000000" ]
|
||||||
#
|
|
||||||
# run bin "5 * { 1 + 1; 5 * 2 }"
|
run bin "5*{1+1;5*2}"
|
||||||
# [ "$output" = "50.000000" ]
|
echo $output
|
||||||
#}
|
[ "$output" = "= 50.000000" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "variable definition" {
|
||||||
|
run bin "x=1"
|
||||||
|
[ "$output" = "= 1.000000" ]
|
||||||
|
|
||||||
#@test "variable definition" {
|
|
||||||
# run bin "x = 1"
|
|
||||||
# [ "$output" = "= 1.000000" ]
|
|
||||||
#
|
|
||||||
# run bin "x = 1; x + 1"
|
# run bin "x = 1; x + 1"
|
||||||
# [ "$output" = "= 2.000000" ]
|
# [ "$output" = "= 2.000000" ]
|
||||||
#}
|
}
|
||||||
#
|
|
||||||
#@test "function definition" {
|
#@test "function definition" {
|
||||||
# run bin "f(n)=2*n; f(2)"
|
# run bin "f(n)=2*n; f(2)"
|
||||||
# [ "$output" = "= 4.000000" ]
|
# [ "$output" = "= 4.000000" ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user