Assorted tests chosen after examining lines of
code that were not being run.
This pushes the coverage over 90% !!!
Also a bugfix - test suites are good !!!
Signed-off-by: NeilBrown <neil@brown.name>
@mv *.gcov coverage ; [ -f .gcov ] && mv .gcov coverage
@ awk '/^ *[1-9]/ {ran+=1} /^ *###/ {skip+=1} \
END {printf "coverage: %6.2f%%\n", ran * 100 / (ran + skip); \
@mv *.gcov coverage ; [ -f .gcov ] && mv .gcov coverage
@ awk '/^ *[1-9]/ {ran+=1} /^ *###/ {skip+=1} \
END {printf "coverage: %6.2f%%\n", ran * 100 / (ran + skip); \
- if (ran < (ran + skip) *0.85) exit(1) }' \
+ if (ran < (ran + skip) *0.90) exit(1) }' \
coverage/oceani.mdc.gcov
@rm -f .tmp*
coverage/oceani.mdc.gcov
@rm -f .tmp*
###### test: valvar
program:
###### test: valvar
program:
+ a := 23; b:=12 ; b1 := -b
print a, b, a+b, a-b, a*b, a/b, a%b
print a<b, a<=b, a>b, a>=b, a<a, a==b, a==a
print a, b, a+b, a-b, a*b, a/b, a%b
print a<b, a<=b, a>b, a>=b, a<a, a==b, a==a
+ print +a, +b, +b1, -a, -b, -b1
+ x := True; y := False
+ print x and y, x or y, x and x, y or y, x and not x, x < y
c ::= "This is a string"
d ::= " field theory"
print c, d, c++d
c ::= "This is a string"
d ::= " field theory"
print c, d, c++d
+ aconst :: string = "unchanging"
+
###### output: valvar
23 12 35 11 276 1.91667 11
False False True True False False True
###### output: valvar
23 12 35 11 276 1.91667 11
False False True True False False True
+ 23 12 12 -23 -12 12
+ False True True False False False
This is a string field theory This is a string field theory
Next we change the value of variables
This is a string field theory This is a string field theory
Next we change the value of variables
list[ 53 ]= 9040
list[ 54 ]= 9768
list[ 53 ]= 9040
list[ 54 ]= 9768
+## Arrays
+
+We already have some array tests, but this is where we put other
+ad-hoc things array related.
+
+###### test list
+ oceani_tests += arrays
+
+###### test: arrays
+
+ program:
+ bools:[5]Boolean
+ strings:[4]string
+
+ bools[3] = strings[1] == "Hello"
+ bools[1] = strings[2] <= "there"
+
+ for i:=0; then i=i+1; while i<5:
+ print '', bools[i],
+ print
+
+###### output: arrays
+ False True False False False
+
## Test code with syntax errors
Syntax errors aren't handled well yet - the result is almost always a
## Test code with syntax errors
Syntax errors aren't handled well yet - the result is almost always a
various places that `type_err()` are called.
###### test list
various places that `type_err()` are called.
###### test list
- oceani_failing_tests += type_err1 type_err2 type_err3
+ oceani_failing_tests += type_err1 type_err2 type_err3 type_err4
.tmp.code:3:8: info: variable 'c' was set as string here.
oceani: type error in program - not running.
.tmp.code:3:8: info: variable 'c' was set as string here.
oceani: type error in program - not running.
+###### test: type_err4
+ program:
+ a:=1; b=2; c::=3
+ print a, b, c
+
+###### output: type_err4
+ .tmp.code:3:14: error: expected *unknown*type* (labels not permitted) but variable 'b' is label
+ .tmp.code:3:14: info: this is where 'b' was set to label
+ .tmp.code:3:16: error: expected label found number
+ .tmp.code:3:14: info: variable 'b' was set as label here.
+ .tmp.code:4:17: error: expected *unknown*type* (labels not permitted) but variable 'b' is label
+ .tmp.code:3:14: info: this is where 'b' was set to label
+ oceani: type error in program - not running.
## Test erroneous command line args
## Test erroneous command line args
static int __fput_loc(struct exec *loc, FILE *f)
{
static int __fput_loc(struct exec *loc, FILE *f)
{
if (loc->line >= 0) {
fprintf(f, "%d:%d: ", loc->line, loc->column);
return 1;
if (loc->line >= 0) {
fprintf(f, "%d:%d: ", loc->line, loc->column);
return 1;