Skip to content

Commit

Permalink
add tests for inlining/referencing variables of different types in DR…
Browse files Browse the repository at this point in the history
…AW statement (re issue #208)
  • Loading branch information
robhagemans committed Aug 14, 2022
1 parent 00fcbc5 commit 523753f
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_numeric_inline/PCBASIC.INI
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pcbasic]
font=default
quit=True
run=TEST.BAS
soft-linefeed=True
17 changes: 17 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_numeric_inline/TEST.BAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
5 ' test DRAW with numeric variables inlined
10 screen 1
20 v%=5
30 v!=5
40 v#=5
50 v$="5"
60 on error goto 1000
70 open "errors.txt" for output as 1
100 ' numeric variable inline
105 DRAW "F=v%;"
110 DRAW "L=v!;"
120 DRAW "E=v#;"
130 DRAW "G=v$;" ' type mismatch
999 end
1000 print#1, err, erl
1010 resume next

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
13 130

5 changes: 5 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_numeric_varptr/PCBASIC.INI
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pcbasic]
font=default
quit=True
run=TEST.BAS
soft-linefeed=True
17 changes: 17 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_numeric_varptr/TEST.BAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
5 ' test DRAW with numeric variables as pointer reference
10 screen 1
20 v%=5
30 v!=5
40 v#=5
50 v$="5"
60 on error goto 1000
70 open "errors.txt" for output as 1
200 ' numeric variable with varptr$
205 DRAW "F=" + VARPTR$(v%)
210 DRAW "L=" + VARPTR$(v!)
220 DRAW "E=" + VARPTR$(v#)
230 DRAW "G=" + VARPTR$(v$) ' type mismatch
999 end
1000 print#1, err, erl
1010 resume next

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
13 230

5 changes: 5 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_string_inline/PCBASIC.INI
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pcbasic]
font=default
quit=True
run=TEST.BAS
soft-linefeed=True
17 changes: 17 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_string_inline/TEST.BAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
5 ' test DRAW with string variables inlined
10 screen 1
20 v%=5
30 v!=5
40 v#=5
50 v$="D5"
60 on error goto 1000
70 open "errors.txt" for output as 1
100 ' string variable inline
105 DRAW "Xv%;" ' type mismatch
110 DRAW "Xv!;" ' type mismatch
120 DRAW "Xv#;" ' type mismatch
130 DRAW "Xv$;"
999 end
1000 print#1, err, erl
1010 resume next

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
13 105
13 110
13 120

5 changes: 5 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_string_varptr/PCBASIC.INI
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pcbasic]
font=default
quit=True
run=TEST.BAS
soft-linefeed=True
17 changes: 17 additions & 0 deletions tests/basic/gwbasic/DRAW_variable_string_varptr/TEST.BAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
5 ' test DRAW with string variables as pointer reference
10 screen 1
20 v%=5
30 v!=5
40 v#=5
50 v$="D5"
60 on error goto 1000
70 open "errors.txt" for output as 1
200 ' string variable with varptr$
205 DRAW "X=" + VARPTR$(v%) ' type mismatch
210 DRAW "X=" + VARPTR$(v!) ' type mismatch
220 DRAW "X=" + VARPTR$(v#) ' type mismatch
230 DRAW "X=" + VARPTR$(v$)
999 end
1000 print#1, err, erl
1010 resume next

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
5 205
5 210
5 220
5 230


0 comments on commit 523753f

Please sign in to comment.