Files
akbasic/tests/language/numeric/truth_value_arithmetic.bas
Logikoma 7d0ec1fe83
All checks were successful
akbasic CI Build / cmake_build (push) Successful in 3m50s
akbasic CI Build / coverage (push) Successful in 4m4s
akbasic CI Build / sanitizers (push) Successful in 4m48s
akbasic CI Build / akgl_build (push) Successful in 9m55s
akbasic CI Build / mutation_test (push) Successful in 17m50s
Keep BASIC fixtures within the input line limit
Reflow the approved reference cases, shorten local fixture comments, and split the executable docs line so the 80-byte input buffer can read every source line.

Co-authored-by: andrew <andrew@aklabs.net>
2026-08-04 16:12:42 -04:00

17 lines
798 B
QBasic

10 REM A truth value carries its payload in boolvalue, not floatval. The three
20 REM numeric operators were `if ( INTEGER ) ... else <treat as float>`, and
30 REM that else was a catch-all, not a float branch -- so a truth value
40 REM on the LEFT computed 0 - 1 into a field nothing reads, kept its BOOLEAN
50 REM type, and printed `true` instead of -2. Silent, and wrong twice over.
60 A# = 1
70 PRINT (A# == 1)
80 REM On the RIGHT it stays legal and stays -1, the same property that
90 REM lets AND and OR double as logical operators. Refusing it would have
100 REM broken every condition in the language.
110 PRINT 5 - (A# == 1)
120 PRINT 5 * (A# == 1)
130 PRINT 5 + (A# == 1)
140 PRINT 4 - (A# == 2)
150 REM And on the left it is refused by name rather than computed.
160 PRINT (A# == 1) - 1