Skip to content

Commit c5e997b

Browse files
authored
Merge pull request #297 from boriel/feature/automatize_runtime_tests
Feature/automatize runtime tests
2 parents da51699 + af5c8bd commit c5e997b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+516
-322
lines changed

tests/runtime/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# vim:ts=4:noet:
2+
3+
.PHONY: test
4+
5+
test:
6+
./test_all
7+
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#include "lib/tst_framework.bas"
2+
3+
INIT("Testing bitwise U8")
14

25
DIM a as uByte = 1
36

@@ -16,4 +19,4 @@ PRINT
1619
PRINT 255 bxor a; " = 254"
1720
PRINT a bxor a; " = 0"
1821

19-
22+
FINISH

tests/runtime/cases/eq8.bas

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
#include "lib/tst_framework.bas"
3+
4+
INIT("Testing (byte) == (byte) [EQ8]")
5+
6+
DIM i AS Byte = -128
7+
DIM j AS Byte
8+
DIM ii, jj AS Integer
9+
DIM Counter as ULong = 0
10+
11+
DO
12+
j = -128
13+
ii = i
14+
15+
DO
16+
jj = j
17+
If (i = j) XOR (ii = jj) THEN
18+
PRINT i; "=="; j; " = "; (i <> j); " ";
19+
REPORT_FAIL
20+
End If
21+
22+
Counter = Counter + 1
23+
j = j + 1
24+
LOOP UNTIL j = -128
25+
26+
i = i + 1
27+
LOOP UNTIL i = -128
28+
29+
IF Counter <> 65536 THEN
30+
PRINT "Iterations: "; Counter; " ";
31+
REPORT_FAIL
32+
ELSE
33+
REPORT_OK
34+
END IF
35+
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
REM Byte < comparison
1+
#include "lib/tst_framework.bas"
2+
INIT("Testing (integer) >= (integer) [GEi16]")
23

34
DIM i AS Integer = -32768
45
DIM j AS Integer
56
DIM ii, jj AS Long
67
DIM Counter as ULong = 0
78

8-
PRINT "Testing (integer) >= (integer) [GEi16]"
99

1010
DO
1111
j = -32768
@@ -14,9 +14,8 @@ DO
1414
DO
1515
jj = j
1616
If (i >= j) XOR (ii >= jj) THEN
17-
PRINT i; ">="; j; " = "; (i < j); " "; PAPER 2; INK 7; FLASH 1; " ERROR "; PAPER 8; FLASH 0; TAB 31
18-
PRINT Counter
19-
STOP
17+
PRINT i; ">="; j; " = "; (i < j); " "; Counter;
18+
REPORT_FAIL
2019
End If
2120

2221
print at 5, 0; Counter; " "; i; " "; j; TAB 16
@@ -28,8 +27,9 @@ DO
2827
LOOP UNTIL i = -32768
2928

3029
IF Counter <> 65536 THEN
31-
PRINT "Iterations: "; Counter; " "; PAPER 2; INK 7; FLASH 1; " ERROR "; PAPER 8; FLASH 0; TAB 31
30+
PRINT "Iterations: "; Counter; " ";
31+
REPORT_FAIL
3232
ELSE
33-
PRINT PAPER 4; INK 7; " SUCCESS "; PAPER 8; TAB 31
33+
REPORT_OK
3434
END IF
3535

tests/runtime/cases/gei8.bas

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
#include "lib/tst_framework.bas"
3+
4+
INIT("Testing (byte) >= (byte) [GEi8]")
5+
6+
DIM i AS Byte = -128
7+
DIM j AS Byte
8+
DIM ii, jj AS Integer
9+
DIM Counter as ULong = 0
10+
11+
DO
12+
j = -128
13+
ii = i
14+
15+
DO
16+
jj = j
17+
If (i >= j) XOR (ii >= jj) THEN
18+
PRINT i; ">="; j; " = "; (i >= j); " ";
19+
REPORT_FAIL
20+
End If
21+
22+
Counter = Counter + 1
23+
j = j + 1
24+
LOOP UNTIL j = -128
25+
26+
i = i + 1
27+
LOOP UNTIL i = -128
28+
29+
IF Counter <> 65536 THEN
30+
PRINT "Iterations: "; Counter; " ";
31+
REPORT_FAIL
32+
ELSE
33+
REPORT_OK
34+
END IF
35+

tests/runtime/cases/geu8.bas

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "lib/tst_framework.bas"
2+
3+
DIM i AS uByte = 0
4+
DIM j AS uByte
5+
DIM ii, jj AS uInteger
6+
DIM Counter as ULong = 0
7+
8+
INIT("Testing (ubyte) >= (ubyte) [GEu8]")
9+
10+
DO
11+
j = 0
12+
ii = i
13+
14+
DO
15+
jj = j
16+
If (i >= j) XOR (ii >= jj) THEN
17+
PRINT i; ">="; j; " = "; (i < j); " ";
18+
REPORT_FAIL
19+
End If
20+
21+
Counter = Counter + 1
22+
j = j + 1
23+
LOOP UNTIL j = 0
24+
25+
i = i + 1
26+
LOOP UNTIL i = 0
27+
28+
IF Counter <> 65536 THEN
29+
PRINT "Iterations: "; Counter; " ";
30+
REPORT_FAIL
31+
ELSE
32+
REPORT_OK
33+
END IF
34+
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
REM Byte < comparison
1+
#include "lib/tst_framework.bas"
22

33
DIM i AS Integer = -32768
44
DIM j AS Integer
55
DIM ii, jj AS Long
66
DIM Counter as ULong = 0
77

8-
PRINT "Testing (integer) > (integer) [GTi16]"
8+
INIT("Testing (integer) > (integer) [GTi16]")
99

1010
DO
1111
j = -32768
@@ -14,9 +14,8 @@ DO
1414
DO
1515
jj = j
1616
If (i > j) XOR (ii > jj) THEN
17-
PRINT i; ">"; j; " = "; (i < j); " "; PAPER 2; INK 7; FLASH 1; " ERROR "; PAPER 8; FLASH 0; TAB 31
18-
PRINT Counter
19-
STOP
17+
PRINT i; ">"; j; " = "; (i < j); " "; Counter
18+
REPORT_FAIL
2019
End If
2120

2221
print at 5, 0; Counter; " "; i; " "; j; TAB 16
@@ -28,8 +27,9 @@ DO
2827
LOOP UNTIL i = -32768
2928

3029
IF Counter <> 65536 THEN
31-
PRINT "Iterations: "; Counter; " "; PAPER 2; INK 7; FLASH 1; " ERROR "; PAPER 8; FLASH 0; TAB 31
30+
PRINT "Iterations: "; Counter; " "
31+
REPORT_FAIL
3232
ELSE
33-
PRINT PAPER 4; INK 7; " SUCCESS "; PAPER 8; TAB 31
33+
REPORT_OK
3434
END IF
3535

tests/runtime/cases/gti8.bas

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "lib/tst_framework.bas"
2+
3+
DIM i AS Byte = -128
4+
DIM j AS Byte
5+
DIM ii, jj AS Integer
6+
DIM Counter as ULong = 0
7+
8+
INIT("Testing (byte) > (byte) [GTi8]")
9+
10+
DO
11+
j = -128
12+
ii = i
13+
14+
DO
15+
jj = j
16+
If (i > j) XOR (ii > jj) THEN
17+
PRINT i; ">"; j; " = "; (i > j); " ";
18+
REPORT_FAIL
19+
End If
20+
21+
Counter = Counter + 1
22+
j = j + 1
23+
LOOP UNTIL j = -128
24+
25+
i = i + 1
26+
LOOP UNTIL i = -128
27+
28+
IF Counter <> 65536 THEN
29+
PRINT "Iterations: "; Counter; " ";
30+
REPORT_FAIL
31+
ELSE
32+
REPORT_OK
33+
END IF
34+
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
REM Byte < comparison
1+
#include "lib/tst_framework.bas"
22

33
DIM i AS Integer = -32768
44
DIM j AS Integer
55
DIM ii, jj AS Long
66
DIM Counter as ULong = 0
77

8-
PRINT "Testing (integer) <= (integer) [LEi16]"
8+
INIT("Testing (integer) <= (integer) [LEi16]")
99

1010
DO
1111
j = -32768
@@ -14,9 +14,8 @@ DO
1414
DO
1515
jj = j
1616
If (i <= j) XOR (ii <= jj) THEN
17-
PRINT i; "<="; j; " = "; (i <= j); " "; PAPER 2; INK 7; FLASH 1; " ERROR "; PAPER 8; FLASH 0; TAB 31
18-
PRINT Counter
19-
STOP
17+
PRINT i; "<="; j; " = "; (i <= j); " "; Counter
18+
REPORT_FAIL
2019
End If
2120

2221
'print at 5, 0; Counter; " "; i; " "; j; TAB 16
@@ -28,8 +27,9 @@ DO
2827
LOOP UNTIL i = -32768
2928

3029
IF Counter <> 65536 THEN
31-
PRINT "Iterations: "; Counter; " "; PAPER 2; INK 7; FLASH 1; " ERROR "; PAPER 8; FLASH 0; TAB 31
30+
PRINT "Iterations: "; Counter; " "
31+
REPORT_FAIL
3232
ELSE
33-
PRINT PAPER 4; INK 7; " SUCCESS "; PAPER 8; TAB 31
33+
REPORT_OK
3434
END IF
3535

tests/runtime/cases/lei8.bas

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "lib/tst_framework.bas"
2+
3+
DIM i AS Byte = -128
4+
DIM j AS Byte
5+
DIM ii, jj AS Integer
6+
DIM Counter as ULong = 0
7+
8+
INIT("Testing (byte) <= (byte) [LEi8]")
9+
10+
DO
11+
j = -128
12+
ii = i
13+
14+
DO
15+
jj = j
16+
If (i <= j) XOR (ii <= jj) THEN
17+
PRINT i; "<="; j; " = "; (i <= j); " ";
18+
REPORT_FAIL
19+
End If
20+
21+
Counter = Counter + 1
22+
j = j + 1
23+
LOOP UNTIL j = -128
24+
25+
i = i + 1
26+
LOOP UNTIL i = -128
27+
28+
IF Counter <> 65536 THEN
29+
PRINT "Iterations: "; Counter; " ";
30+
REPORT_FAIL
31+
ELSE
32+
REPORT_OK
33+
END IF
34+

0 commit comments

Comments
 (0)