fix bug in float < and > comparisons

This commit is contained in:
Irmen de Jong 2021-03-18 01:14:22 +01:00
parent 3df182b8c3
commit b30b8b7368
5 changed files with 22 additions and 13 deletions

View File

@ -428,7 +428,9 @@ var_fac1_greater_f .proc
cmp #1
beq +
lda #0
+ rts
rts
+ lda #1
rts
.pend
var_fac1_greatereq_f .proc

View File

@ -6,8 +6,8 @@ clean:
rm -f *.prg *.asm *.vice-*
test: clean
p8compile *.p8 >/dev/null
p8compile -target cx16 *.p8 >/dev/null
for program in *.prg; do \
echo "RUNNING:" $$program ; \
x64sc $$program >/dev/null ; \
x16emu -run -prg $$program >/dev/null ; \
done

View File

@ -5,11 +5,14 @@ all: test
clean:
rm -f *.prg *.asm *.vice-* test_*.p8
test: clean
test: clean generate test_prgs
generate:
python make_tests.py
p8compile -noopt -target cx16 *.p8 >/dev/null
test_prgs:
for program in *.prg; do \
echo "RUNNING:" $$program ; \
x16emu -run -prg $$program >/dev/null ; \
done

View File

@ -33,9 +33,14 @@ def gen_test(dt, comparison, left, right, expected):
stmt_ok = lambda ix: f"error({ix})"
stmt_else = lambda ix: "num_successes++"
def c(number):
if dt not in ("byte", "ubyte"):
return f"({number} as {dt})"
return str(number)
print(
f""" left = {left}
right = {right}
f""" left = {c(left)}
right = {c(right)}
"""
)
@ -43,7 +48,7 @@ f""" left = {left}
index += 1
print(
f""" ; test #{index}
if {left} {comparison} {right} {{
if {c(left)} {comparison} {c(right)} {{
{stmt_ok(index)}
}} else {{
{stmt_else(index)}
@ -53,7 +58,7 @@ f""" ; test #{index}
index += 1
print(
f""" ; test #{index}
if {left} {comparison} right {{
if {c(left)} {comparison} right {{
{stmt_ok(index)}
}} else {{
{stmt_else(index)}
@ -63,7 +68,7 @@ f""" ; test #{index}
index += 1
print(
f""" ; test #{index}
if {left} {comparison} right+zero {{
if {c(left)} {comparison} right+zero {{
{stmt_ok(index)}
}} else {{
{stmt_else(index)}
@ -73,7 +78,7 @@ f""" ; test #{index}
index += 1
print(
f""" ; test #{index}
if left {comparison} {right} {{
if left {comparison} {c(right)} {{
{stmt_ok(index)}
}} else {{
{stmt_else(index)}
@ -103,7 +108,7 @@ f""" ; test #{index}
index += 1
print(
f""" ; test #{index}
if left+zero {comparison} {right} {{
if left+zero {comparison} {c(right)} {{
{stmt_ok(index)}
}} else {{
{stmt_else(index)}

View File

@ -4,7 +4,6 @@ TODO
- fix errors in comparison changes (first complete the new comparison test generation tool)
- fix imageviewer only showing first image (likely fixed by the one above)
- fix X register (evalstack) issue in arithmetic/builtins.prg
- add cx16 vload()
- optimize several inner loops in gfx2