explain integer math sin/cos routines better

This commit is contained in:
Irmen de Jong 2024-05-29 19:48:27 +02:00
parent 1feead2260
commit af64af2397
87 changed files with 20 additions and 674798 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "byte"
uword @shared comparison
sub start() {
txt.print("\ngreater-than tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>number: ")
test_cmp_number()
txt.print("\n>var: ")
test_cmp_var()
txt.print("\n>array[]: ")
test_cmp_array()
txt.print("\n>expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
byte @shared x
success = 0
x=-1
; direct jump
if x>-1
goto lbl1a
goto skip1a
lbl1a: fail_byte(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>-1
goto cx16.r3
goto skip1b
lbl1b: fail_byte(2)
skip1b:
; no else
if x>-1
fail_byte(3)
; with else
if x>-1
fail_byte(4)
else
success++
; direct jump
if x>0
goto lbl2a
goto skip2a
lbl2a: fail_byte(5)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>0
goto cx16.r3
goto skip2b
lbl2b: fail_byte(6)
skip2b:
; no else
if x>0
fail_byte(7)
; with else
if x>0
fail_byte(8)
else
success++
; direct jump
if x>1
goto lbl3a
goto skip3a
lbl3a: fail_byte(9)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>1
goto cx16.r3
goto skip3b
lbl3b: fail_byte(10)
skip3b:
; no else
if x>1
fail_byte(11)
; with else
if x>1
fail_byte(12)
else
success++
x=0
; direct jump
if x>-1
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>-1
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>-1
success++
; with else
if x>-1
success++
else
cx16.r0L++
; direct jump
if x>0
goto lbl5a
goto skip5a
lbl5a: fail_byte(13)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>0
goto cx16.r3
goto skip5b
lbl5b: fail_byte(14)
skip5b:
; no else
if x>0
fail_byte(15)
; with else
if x>0
fail_byte(16)
else
success++
; direct jump
if x>1
goto lbl6a
goto skip6a
lbl6a: fail_byte(17)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>1
goto cx16.r3
goto skip6b
lbl6b: fail_byte(18)
skip6b:
; no else
if x>1
fail_byte(19)
; with else
if x>1
fail_byte(20)
else
success++
x=1
; direct jump
if x>-1
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>-1
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>-1
success++
; with else
if x>-1
success++
else
cx16.r0L++
; direct jump
if x>0
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>0
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>0
success++
; with else
if x>0
success++
else
cx16.r0L++
; direct jump
if x>1
goto lbl9a
goto skip9a
lbl9a: fail_byte(21)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>1
goto cx16.r3
goto skip9b
lbl9b: fail_byte(22)
skip9b:
; no else
if x>1
fail_byte(23)
; with else
if x>1
fail_byte(24)
else
success++
verify_success(18)
}
sub test_cmp_var() {
byte @shared x, value
success = 0
x=-1
value=-1
; direct jump
if x>value
goto lbl1a
goto skip1a
lbl1a: fail_byte(25)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>value
goto cx16.r3
goto skip1b
lbl1b: fail_byte(26)
skip1b:
; no else
if x>value
fail_byte(27)
; with else
if x>value
fail_byte(28)
else
success++
value=0
; direct jump
if x>value
goto lbl2a
goto skip2a
lbl2a: fail_byte(29)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>value
goto cx16.r3
goto skip2b
lbl2b: fail_byte(30)
skip2b:
; no else
if x>value
fail_byte(31)
; with else
if x>value
fail_byte(32)
else
success++
value=1
; direct jump
if x>value
goto lbl3a
goto skip3a
lbl3a: fail_byte(33)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>value
goto cx16.r3
goto skip3b
lbl3b: fail_byte(34)
skip3b:
; no else
if x>value
fail_byte(35)
; with else
if x>value
fail_byte(36)
else
success++
x=0
value=-1
; direct jump
if x>value
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>value
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>value
success++
; with else
if x>value
success++
else
cx16.r0L++
value=0
; direct jump
if x>value
goto lbl5a
goto skip5a
lbl5a: fail_byte(37)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>value
goto cx16.r3
goto skip5b
lbl5b: fail_byte(38)
skip5b:
; no else
if x>value
fail_byte(39)
; with else
if x>value
fail_byte(40)
else
success++
value=1
; direct jump
if x>value
goto lbl6a
goto skip6a
lbl6a: fail_byte(41)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>value
goto cx16.r3
goto skip6b
lbl6b: fail_byte(42)
skip6b:
; no else
if x>value
fail_byte(43)
; with else
if x>value
fail_byte(44)
else
success++
x=1
value=-1
; direct jump
if x>value
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>value
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>value
success++
; with else
if x>value
success++
else
cx16.r0L++
value=0
; direct jump
if x>value
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>value
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>value
success++
; with else
if x>value
success++
else
cx16.r0L++
value=1
; direct jump
if x>value
goto lbl9a
goto skip9a
lbl9a: fail_byte(45)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>value
goto cx16.r3
goto skip9b
lbl9b: fail_byte(46)
skip9b:
; no else
if x>value
fail_byte(47)
; with else
if x>value
fail_byte(48)
else
success++
verify_success(18)
}
sub test_cmp_array() {
byte @shared x
byte[] values = [0, 0]
success = 0
x=-1
values[1]=-1
; direct jump
if x>values[1]
goto lbl1a
goto skip1a
lbl1a: fail_byte(49)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_byte(50)
skip1b:
; no else
if x>values[1]
fail_byte(51)
; with else
if x>values[1]
fail_byte(52)
else
success++
values[1]=0
; direct jump
if x>values[1]
goto lbl2a
goto skip2a
lbl2a: fail_byte(53)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_byte(54)
skip2b:
; no else
if x>values[1]
fail_byte(55)
; with else
if x>values[1]
fail_byte(56)
else
success++
values[1]=1
; direct jump
if x>values[1]
goto lbl3a
goto skip3a
lbl3a: fail_byte(57)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_byte(58)
skip3b:
; no else
if x>values[1]
fail_byte(59)
; with else
if x>values[1]
fail_byte(60)
else
success++
x=0
values[1]=-1
; direct jump
if x>values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
values[1]=0
; direct jump
if x>values[1]
goto lbl5a
goto skip5a
lbl5a: fail_byte(61)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>values[1]
goto cx16.r3
goto skip5b
lbl5b: fail_byte(62)
skip5b:
; no else
if x>values[1]
fail_byte(63)
; with else
if x>values[1]
fail_byte(64)
else
success++
values[1]=1
; direct jump
if x>values[1]
goto lbl6a
goto skip6a
lbl6a: fail_byte(65)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>values[1]
goto cx16.r3
goto skip6b
lbl6b: fail_byte(66)
skip6b:
; no else
if x>values[1]
fail_byte(67)
; with else
if x>values[1]
fail_byte(68)
else
success++
x=1
values[1]=-1
; direct jump
if x>values[1]
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>values[1]
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
values[1]=0
; direct jump
if x>values[1]
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>values[1]
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>values[1]
goto lbl9a
goto skip9a
lbl9a: fail_byte(69)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>values[1]
goto cx16.r3
goto skip9b
lbl9b: fail_byte(70)
skip9b:
; no else
if x>values[1]
fail_byte(71)
; with else
if x>values[1]
fail_byte(72)
else
success++
verify_success(18)
}
sub test_cmp_expr() {
byte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=-1
; direct jump
if x>cx16.r4sL+-1-cx16.r5sL
goto lbl1a
goto skip1a
lbl1a: fail_byte(73)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip1b
lbl1b: fail_byte(74)
skip1b:
; no else
if x>cx16.r4sL+-1-cx16.r5sL
fail_byte(75)
; with else
if x>cx16.r4sL+-1-cx16.r5sL
fail_byte(76)
else
success++
; direct jump
if x>cx16.r4sL+0-cx16.r5sL
goto lbl2a
goto skip2a
lbl2a: fail_byte(77)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip2b
lbl2b: fail_byte(78)
skip2b:
; no else
if x>cx16.r4sL+0-cx16.r5sL
fail_byte(79)
; with else
if x>cx16.r4sL+0-cx16.r5sL
fail_byte(80)
else
success++
; direct jump
if x>cx16.r4sL+1-cx16.r5sL
goto lbl3a
goto skip3a
lbl3a: fail_byte(81)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip3b
lbl3b: fail_byte(82)
skip3b:
; no else
if x>cx16.r4sL+1-cx16.r5sL
fail_byte(83)
; with else
if x>cx16.r4sL+1-cx16.r5sL
fail_byte(84)
else
success++
x=0
; direct jump
if x>cx16.r4sL+-1-cx16.r5sL
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>cx16.r4sL+-1-cx16.r5sL
success++
; with else
if x>cx16.r4sL+-1-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>cx16.r4sL+0-cx16.r5sL
goto lbl5a
goto skip5a
lbl5a: fail_byte(85)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip5b
lbl5b: fail_byte(86)
skip5b:
; no else
if x>cx16.r4sL+0-cx16.r5sL
fail_byte(87)
; with else
if x>cx16.r4sL+0-cx16.r5sL
fail_byte(88)
else
success++
; direct jump
if x>cx16.r4sL+1-cx16.r5sL
goto lbl6a
goto skip6a
lbl6a: fail_byte(89)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip6b
lbl6b: fail_byte(90)
skip6b:
; no else
if x>cx16.r4sL+1-cx16.r5sL
fail_byte(91)
; with else
if x>cx16.r4sL+1-cx16.r5sL
fail_byte(92)
else
success++
x=1
; direct jump
if x>cx16.r4sL+-1-cx16.r5sL
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>cx16.r4sL+-1-cx16.r5sL
success++
; with else
if x>cx16.r4sL+-1-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>cx16.r4sL+0-cx16.r5sL
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>cx16.r4sL+0-cx16.r5sL
success++
; with else
if x>cx16.r4sL+0-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>cx16.r4sL+1-cx16.r5sL
goto lbl9a
goto skip9a
lbl9a: fail_byte(93)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip9b
lbl9b: fail_byte(94)
skip9b:
; no else
if x>cx16.r4sL+1-cx16.r5sL
fail_byte(95)
; with else
if x>cx16.r4sL+1-cx16.r5sL
fail_byte(96)
else
success++
verify_success(18)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "byte"
uword @shared comparison
sub start() {
txt.print("\ngreater-equal tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>=number: ")
test_cmp_number()
txt.print("\n>=var: ")
test_cmp_var()
txt.print("\n>=array[]: ")
test_cmp_array()
txt.print("\n>=expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
byte @shared x
success = 0
x=-1
; direct jump
if x>=-1
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=-1
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=-1
success++
; with else
if x>=-1
success++
else
cx16.r0L++
; direct jump
if x>=0
goto lbl2a
goto skip2a
lbl2a: fail_byte(1)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=0
goto cx16.r3
goto skip2b
lbl2b: fail_byte(2)
skip2b:
; no else
if x>=0
fail_byte(3)
; with else
if x>=0
fail_byte(4)
else
success++
; direct jump
if x>=1
goto lbl3a
goto skip3a
lbl3a: fail_byte(5)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=1
goto cx16.r3
goto skip3b
lbl3b: fail_byte(6)
skip3b:
; no else
if x>=1
fail_byte(7)
; with else
if x>=1
fail_byte(8)
else
success++
x=0
; direct jump
if x>=-1
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=-1
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=-1
success++
; with else
if x>=-1
success++
else
cx16.r0L++
; direct jump
if x>=0
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=0
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=0
success++
; with else
if x>=0
success++
else
cx16.r0L++
; direct jump
if x>=1
goto lbl6a
goto skip6a
lbl6a: fail_byte(9)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=1
goto cx16.r3
goto skip6b
lbl6b: fail_byte(10)
skip6b:
; no else
if x>=1
fail_byte(11)
; with else
if x>=1
fail_byte(12)
else
success++
x=1
; direct jump
if x>=-1
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=-1
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=-1
success++
; with else
if x>=-1
success++
else
cx16.r0L++
; direct jump
if x>=0
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=0
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=0
success++
; with else
if x>=0
success++
else
cx16.r0L++
; direct jump
if x>=1
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=1
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=1
success++
; with else
if x>=1
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_var() {
byte @shared x, value
success = 0
x=-1
value=-1
; direct jump
if x>=value
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=value
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=0
; direct jump
if x>=value
goto lbl2a
goto skip2a
lbl2a: fail_byte(13)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=value
goto cx16.r3
goto skip2b
lbl2b: fail_byte(14)
skip2b:
; no else
if x>=value
fail_byte(15)
; with else
if x>=value
fail_byte(16)
else
success++
value=1
; direct jump
if x>=value
goto lbl3a
goto skip3a
lbl3a: fail_byte(17)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=value
goto cx16.r3
goto skip3b
lbl3b: fail_byte(18)
skip3b:
; no else
if x>=value
fail_byte(19)
; with else
if x>=value
fail_byte(20)
else
success++
x=0
value=-1
; direct jump
if x>=value
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=value
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=0
; direct jump
if x>=value
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=value
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=1
; direct jump
if x>=value
goto lbl6a
goto skip6a
lbl6a: fail_byte(21)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=value
goto cx16.r3
goto skip6b
lbl6b: fail_byte(22)
skip6b:
; no else
if x>=value
fail_byte(23)
; with else
if x>=value
fail_byte(24)
else
success++
x=1
value=-1
; direct jump
if x>=value
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=value
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=0
; direct jump
if x>=value
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=value
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=1
; direct jump
if x>=value
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=value
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_array() {
byte @shared x
byte[] values = [0, 0]
success = 0
x=-1
values[1]=-1
; direct jump
if x>=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=0
; direct jump
if x>=values[1]
goto lbl2a
goto skip2a
lbl2a: fail_byte(25)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_byte(26)
skip2b:
; no else
if x>=values[1]
fail_byte(27)
; with else
if x>=values[1]
fail_byte(28)
else
success++
values[1]=1
; direct jump
if x>=values[1]
goto lbl3a
goto skip3a
lbl3a: fail_byte(29)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_byte(30)
skip3b:
; no else
if x>=values[1]
fail_byte(31)
; with else
if x>=values[1]
fail_byte(32)
else
success++
x=0
values[1]=-1
; direct jump
if x>=values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=0
; direct jump
if x>=values[1]
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=values[1]
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl6a
goto skip6a
lbl6a: fail_byte(33)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=values[1]
goto cx16.r3
goto skip6b
lbl6b: fail_byte(34)
skip6b:
; no else
if x>=values[1]
fail_byte(35)
; with else
if x>=values[1]
fail_byte(36)
else
success++
x=1
values[1]=-1
; direct jump
if x>=values[1]
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=values[1]
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=0
; direct jump
if x>=values[1]
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=values[1]
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=values[1]
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_expr() {
byte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=-1
; direct jump
if x>=cx16.r4sL+-1-cx16.r5sL
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=cx16.r4sL+-1-cx16.r5sL
success++
; with else
if x>=cx16.r4sL+-1-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4sL+0-cx16.r5sL
goto lbl2a
goto skip2a
lbl2a: fail_byte(37)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip2b
lbl2b: fail_byte(38)
skip2b:
; no else
if x>=cx16.r4sL+0-cx16.r5sL
fail_byte(39)
; with else
if x>=cx16.r4sL+0-cx16.r5sL
fail_byte(40)
else
success++
; direct jump
if x>=cx16.r4sL+1-cx16.r5sL
goto lbl3a
goto skip3a
lbl3a: fail_byte(41)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip3b
lbl3b: fail_byte(42)
skip3b:
; no else
if x>=cx16.r4sL+1-cx16.r5sL
fail_byte(43)
; with else
if x>=cx16.r4sL+1-cx16.r5sL
fail_byte(44)
else
success++
x=0
; direct jump
if x>=cx16.r4sL+-1-cx16.r5sL
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=cx16.r4sL+-1-cx16.r5sL
success++
; with else
if x>=cx16.r4sL+-1-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4sL+0-cx16.r5sL
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=cx16.r4sL+0-cx16.r5sL
success++
; with else
if x>=cx16.r4sL+0-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4sL+1-cx16.r5sL
goto lbl6a
goto skip6a
lbl6a: fail_byte(45)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip6b
lbl6b: fail_byte(46)
skip6b:
; no else
if x>=cx16.r4sL+1-cx16.r5sL
fail_byte(47)
; with else
if x>=cx16.r4sL+1-cx16.r5sL
fail_byte(48)
else
success++
x=1
; direct jump
if x>=cx16.r4sL+-1-cx16.r5sL
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=cx16.r4sL+-1-cx16.r5sL
success++
; with else
if x>=cx16.r4sL+-1-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4sL+0-cx16.r5sL
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=cx16.r4sL+0-cx16.r5sL
success++
; with else
if x>=cx16.r4sL+0-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4sL+1-cx16.r5sL
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=cx16.r4sL+1-cx16.r5sL
success++
; with else
if x>=cx16.r4sL+1-cx16.r5sL
success++
else
cx16.r0L++
verify_success(27)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "byte"
uword @shared comparison
sub start() {
txt.print("\nless-than tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<number: ")
test_cmp_number()
txt.print("\n<var: ")
test_cmp_var()
txt.print("\n<array[]: ")
test_cmp_array()
txt.print("\n<expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
byte @shared x
success = 0
x=-1
; direct jump
if x<-1
goto lbl1a
goto skip1a
lbl1a: fail_byte(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<-1
goto cx16.r3
goto skip1b
lbl1b: fail_byte(2)
skip1b:
; no else
if x<-1
fail_byte(3)
; with else
if x<-1
fail_byte(4)
else
success++
; direct jump
if x<0
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<0
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<0
success++
; with else
if x<0
success++
else
cx16.r0L++
; direct jump
if x<1
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<1
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<1
success++
; with else
if x<1
success++
else
cx16.r0L++
x=0
; direct jump
if x<-1
goto lbl4a
goto skip4a
lbl4a: fail_byte(5)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<-1
goto cx16.r3
goto skip4b
lbl4b: fail_byte(6)
skip4b:
; no else
if x<-1
fail_byte(7)
; with else
if x<-1
fail_byte(8)
else
success++
; direct jump
if x<0
goto lbl5a
goto skip5a
lbl5a: fail_byte(9)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<0
goto cx16.r3
goto skip5b
lbl5b: fail_byte(10)
skip5b:
; no else
if x<0
fail_byte(11)
; with else
if x<0
fail_byte(12)
else
success++
; direct jump
if x<1
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<1
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<1
success++
; with else
if x<1
success++
else
cx16.r0L++
x=1
; direct jump
if x<-1
goto lbl7a
goto skip7a
lbl7a: fail_byte(13)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<-1
goto cx16.r3
goto skip7b
lbl7b: fail_byte(14)
skip7b:
; no else
if x<-1
fail_byte(15)
; with else
if x<-1
fail_byte(16)
else
success++
; direct jump
if x<0
goto lbl8a
goto skip8a
lbl8a: fail_byte(17)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<0
goto cx16.r3
goto skip8b
lbl8b: fail_byte(18)
skip8b:
; no else
if x<0
fail_byte(19)
; with else
if x<0
fail_byte(20)
else
success++
; direct jump
if x<1
goto lbl9a
goto skip9a
lbl9a: fail_byte(21)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<1
goto cx16.r3
goto skip9b
lbl9b: fail_byte(22)
skip9b:
; no else
if x<1
fail_byte(23)
; with else
if x<1
fail_byte(24)
else
success++
verify_success(18)
}
sub test_cmp_var() {
byte @shared x, value
success = 0
x=-1
value=-1
; direct jump
if x<value
goto lbl1a
goto skip1a
lbl1a: fail_byte(25)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<value
goto cx16.r3
goto skip1b
lbl1b: fail_byte(26)
skip1b:
; no else
if x<value
fail_byte(27)
; with else
if x<value
fail_byte(28)
else
success++
value=0
; direct jump
if x<value
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<value
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<value
success++
; with else
if x<value
success++
else
cx16.r0L++
value=1
; direct jump
if x<value
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<value
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<value
success++
; with else
if x<value
success++
else
cx16.r0L++
x=0
value=-1
; direct jump
if x<value
goto lbl4a
goto skip4a
lbl4a: fail_byte(29)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<value
goto cx16.r3
goto skip4b
lbl4b: fail_byte(30)
skip4b:
; no else
if x<value
fail_byte(31)
; with else
if x<value
fail_byte(32)
else
success++
value=0
; direct jump
if x<value
goto lbl5a
goto skip5a
lbl5a: fail_byte(33)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<value
goto cx16.r3
goto skip5b
lbl5b: fail_byte(34)
skip5b:
; no else
if x<value
fail_byte(35)
; with else
if x<value
fail_byte(36)
else
success++
value=1
; direct jump
if x<value
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<value
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<value
success++
; with else
if x<value
success++
else
cx16.r0L++
x=1
value=-1
; direct jump
if x<value
goto lbl7a
goto skip7a
lbl7a: fail_byte(37)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<value
goto cx16.r3
goto skip7b
lbl7b: fail_byte(38)
skip7b:
; no else
if x<value
fail_byte(39)
; with else
if x<value
fail_byte(40)
else
success++
value=0
; direct jump
if x<value
goto lbl8a
goto skip8a
lbl8a: fail_byte(41)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<value
goto cx16.r3
goto skip8b
lbl8b: fail_byte(42)
skip8b:
; no else
if x<value
fail_byte(43)
; with else
if x<value
fail_byte(44)
else
success++
value=1
; direct jump
if x<value
goto lbl9a
goto skip9a
lbl9a: fail_byte(45)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<value
goto cx16.r3
goto skip9b
lbl9b: fail_byte(46)
skip9b:
; no else
if x<value
fail_byte(47)
; with else
if x<value
fail_byte(48)
else
success++
verify_success(18)
}
sub test_cmp_array() {
byte @shared x
byte[] values = [0, 0]
success = 0
x=-1
values[1]=-1
; direct jump
if x<values[1]
goto lbl1a
goto skip1a
lbl1a: fail_byte(49)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_byte(50)
skip1b:
; no else
if x<values[1]
fail_byte(51)
; with else
if x<values[1]
fail_byte(52)
else
success++
values[1]=0
; direct jump
if x<values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x<values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
x=0
values[1]=-1
; direct jump
if x<values[1]
goto lbl4a
goto skip4a
lbl4a: fail_byte(53)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_byte(54)
skip4b:
; no else
if x<values[1]
fail_byte(55)
; with else
if x<values[1]
fail_byte(56)
else
success++
values[1]=0
; direct jump
if x<values[1]
goto lbl5a
goto skip5a
lbl5a: fail_byte(57)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<values[1]
goto cx16.r3
goto skip5b
lbl5b: fail_byte(58)
skip5b:
; no else
if x<values[1]
fail_byte(59)
; with else
if x<values[1]
fail_byte(60)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<values[1]
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
x=1
values[1]=-1
; direct jump
if x<values[1]
goto lbl7a
goto skip7a
lbl7a: fail_byte(61)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<values[1]
goto cx16.r3
goto skip7b
lbl7b: fail_byte(62)
skip7b:
; no else
if x<values[1]
fail_byte(63)
; with else
if x<values[1]
fail_byte(64)
else
success++
values[1]=0
; direct jump
if x<values[1]
goto lbl8a
goto skip8a
lbl8a: fail_byte(65)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<values[1]
goto cx16.r3
goto skip8b
lbl8b: fail_byte(66)
skip8b:
; no else
if x<values[1]
fail_byte(67)
; with else
if x<values[1]
fail_byte(68)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl9a
goto skip9a
lbl9a: fail_byte(69)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<values[1]
goto cx16.r3
goto skip9b
lbl9b: fail_byte(70)
skip9b:
; no else
if x<values[1]
fail_byte(71)
; with else
if x<values[1]
fail_byte(72)
else
success++
verify_success(18)
}
sub test_cmp_expr() {
byte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=-1
; direct jump
if x<cx16.r4sL+-1-cx16.r5sL
goto lbl1a
goto skip1a
lbl1a: fail_byte(73)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip1b
lbl1b: fail_byte(74)
skip1b:
; no else
if x<cx16.r4sL+-1-cx16.r5sL
fail_byte(75)
; with else
if x<cx16.r4sL+-1-cx16.r5sL
fail_byte(76)
else
success++
; direct jump
if x<cx16.r4sL+0-cx16.r5sL
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<cx16.r4sL+0-cx16.r5sL
success++
; with else
if x<cx16.r4sL+0-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x<cx16.r4sL+1-cx16.r5sL
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<cx16.r4sL+1-cx16.r5sL
success++
; with else
if x<cx16.r4sL+1-cx16.r5sL
success++
else
cx16.r0L++
x=0
; direct jump
if x<cx16.r4sL+-1-cx16.r5sL
goto lbl4a
goto skip4a
lbl4a: fail_byte(77)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip4b
lbl4b: fail_byte(78)
skip4b:
; no else
if x<cx16.r4sL+-1-cx16.r5sL
fail_byte(79)
; with else
if x<cx16.r4sL+-1-cx16.r5sL
fail_byte(80)
else
success++
; direct jump
if x<cx16.r4sL+0-cx16.r5sL
goto lbl5a
goto skip5a
lbl5a: fail_byte(81)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip5b
lbl5b: fail_byte(82)
skip5b:
; no else
if x<cx16.r4sL+0-cx16.r5sL
fail_byte(83)
; with else
if x<cx16.r4sL+0-cx16.r5sL
fail_byte(84)
else
success++
; direct jump
if x<cx16.r4sL+1-cx16.r5sL
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<cx16.r4sL+1-cx16.r5sL
success++
; with else
if x<cx16.r4sL+1-cx16.r5sL
success++
else
cx16.r0L++
x=1
; direct jump
if x<cx16.r4sL+-1-cx16.r5sL
goto lbl7a
goto skip7a
lbl7a: fail_byte(85)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip7b
lbl7b: fail_byte(86)
skip7b:
; no else
if x<cx16.r4sL+-1-cx16.r5sL
fail_byte(87)
; with else
if x<cx16.r4sL+-1-cx16.r5sL
fail_byte(88)
else
success++
; direct jump
if x<cx16.r4sL+0-cx16.r5sL
goto lbl8a
goto skip8a
lbl8a: fail_byte(89)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip8b
lbl8b: fail_byte(90)
skip8b:
; no else
if x<cx16.r4sL+0-cx16.r5sL
fail_byte(91)
; with else
if x<cx16.r4sL+0-cx16.r5sL
fail_byte(92)
else
success++
; direct jump
if x<cx16.r4sL+1-cx16.r5sL
goto lbl9a
goto skip9a
lbl9a: fail_byte(93)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip9b
lbl9b: fail_byte(94)
skip9b:
; no else
if x<cx16.r4sL+1-cx16.r5sL
fail_byte(95)
; with else
if x<cx16.r4sL+1-cx16.r5sL
fail_byte(96)
else
success++
verify_success(18)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "byte"
uword @shared comparison
sub start() {
txt.print("\nless-equal tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<=number: ")
test_cmp_number()
txt.print("\n<=var: ")
test_cmp_var()
txt.print("\n<=array[]: ")
test_cmp_array()
txt.print("\n<=expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
byte @shared x
success = 0
x=-1
; direct jump
if x<=-1
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=-1
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=-1
success++
; with else
if x<=-1
success++
else
cx16.r0L++
; direct jump
if x<=0
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=0
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=0
success++
; with else
if x<=0
success++
else
cx16.r0L++
; direct jump
if x<=1
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=1
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=1
success++
; with else
if x<=1
success++
else
cx16.r0L++
x=0
; direct jump
if x<=-1
goto lbl4a
goto skip4a
lbl4a: fail_byte(1)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=-1
goto cx16.r3
goto skip4b
lbl4b: fail_byte(2)
skip4b:
; no else
if x<=-1
fail_byte(3)
; with else
if x<=-1
fail_byte(4)
else
success++
; direct jump
if x<=0
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=0
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=0
success++
; with else
if x<=0
success++
else
cx16.r0L++
; direct jump
if x<=1
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=1
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=1
success++
; with else
if x<=1
success++
else
cx16.r0L++
x=1
; direct jump
if x<=-1
goto lbl7a
goto skip7a
lbl7a: fail_byte(5)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=-1
goto cx16.r3
goto skip7b
lbl7b: fail_byte(6)
skip7b:
; no else
if x<=-1
fail_byte(7)
; with else
if x<=-1
fail_byte(8)
else
success++
; direct jump
if x<=0
goto lbl8a
goto skip8a
lbl8a: fail_byte(9)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=0
goto cx16.r3
goto skip8b
lbl8b: fail_byte(10)
skip8b:
; no else
if x<=0
fail_byte(11)
; with else
if x<=0
fail_byte(12)
else
success++
; direct jump
if x<=1
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=1
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=1
success++
; with else
if x<=1
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_var() {
byte @shared x, value
success = 0
x=-1
value=-1
; direct jump
if x<=value
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=value
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
value=0
; direct jump
if x<=value
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=value
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
value=1
; direct jump
if x<=value
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=value
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
x=0
value=-1
; direct jump
if x<=value
goto lbl4a
goto skip4a
lbl4a: fail_byte(13)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=value
goto cx16.r3
goto skip4b
lbl4b: fail_byte(14)
skip4b:
; no else
if x<=value
fail_byte(15)
; with else
if x<=value
fail_byte(16)
else
success++
value=0
; direct jump
if x<=value
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=value
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
value=1
; direct jump
if x<=value
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=value
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
x=1
value=-1
; direct jump
if x<=value
goto lbl7a
goto skip7a
lbl7a: fail_byte(17)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=value
goto cx16.r3
goto skip7b
lbl7b: fail_byte(18)
skip7b:
; no else
if x<=value
fail_byte(19)
; with else
if x<=value
fail_byte(20)
else
success++
value=0
; direct jump
if x<=value
goto lbl8a
goto skip8a
lbl8a: fail_byte(21)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=value
goto cx16.r3
goto skip8b
lbl8b: fail_byte(22)
skip8b:
; no else
if x<=value
fail_byte(23)
; with else
if x<=value
fail_byte(24)
else
success++
value=1
; direct jump
if x<=value
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=value
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_array() {
byte @shared x
byte[] values = [0, 0]
success = 0
x=-1
values[1]=-1
; direct jump
if x<=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
values[1]=0
; direct jump
if x<=values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x<=values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
x=0
values[1]=-1
; direct jump
if x<=values[1]
goto lbl4a
goto skip4a
lbl4a: fail_byte(25)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_byte(26)
skip4b:
; no else
if x<=values[1]
fail_byte(27)
; with else
if x<=values[1]
fail_byte(28)
else
success++
values[1]=0
; direct jump
if x<=values[1]
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=values[1]
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x<=values[1]
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=values[1]
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
x=1
values[1]=-1
; direct jump
if x<=values[1]
goto lbl7a
goto skip7a
lbl7a: fail_byte(29)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=values[1]
goto cx16.r3
goto skip7b
lbl7b: fail_byte(30)
skip7b:
; no else
if x<=values[1]
fail_byte(31)
; with else
if x<=values[1]
fail_byte(32)
else
success++
values[1]=0
; direct jump
if x<=values[1]
goto lbl8a
goto skip8a
lbl8a: fail_byte(33)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=values[1]
goto cx16.r3
goto skip8b
lbl8b: fail_byte(34)
skip8b:
; no else
if x<=values[1]
fail_byte(35)
; with else
if x<=values[1]
fail_byte(36)
else
success++
values[1]=1
; direct jump
if x<=values[1]
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=values[1]
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_expr() {
byte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=-1
; direct jump
if x<=cx16.r4sL+-1-cx16.r5sL
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=cx16.r4sL+-1-cx16.r5sL
success++
; with else
if x<=cx16.r4sL+-1-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x<=cx16.r4sL+0-cx16.r5sL
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=cx16.r4sL+0-cx16.r5sL
success++
; with else
if x<=cx16.r4sL+0-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x<=cx16.r4sL+1-cx16.r5sL
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=cx16.r4sL+1-cx16.r5sL
success++
; with else
if x<=cx16.r4sL+1-cx16.r5sL
success++
else
cx16.r0L++
x=0
; direct jump
if x<=cx16.r4sL+-1-cx16.r5sL
goto lbl4a
goto skip4a
lbl4a: fail_byte(37)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip4b
lbl4b: fail_byte(38)
skip4b:
; no else
if x<=cx16.r4sL+-1-cx16.r5sL
fail_byte(39)
; with else
if x<=cx16.r4sL+-1-cx16.r5sL
fail_byte(40)
else
success++
; direct jump
if x<=cx16.r4sL+0-cx16.r5sL
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=cx16.r4sL+0-cx16.r5sL
success++
; with else
if x<=cx16.r4sL+0-cx16.r5sL
success++
else
cx16.r0L++
; direct jump
if x<=cx16.r4sL+1-cx16.r5sL
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=cx16.r4sL+1-cx16.r5sL
success++
; with else
if x<=cx16.r4sL+1-cx16.r5sL
success++
else
cx16.r0L++
x=1
; direct jump
if x<=cx16.r4sL+-1-cx16.r5sL
goto lbl7a
goto skip7a
lbl7a: fail_byte(41)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=cx16.r4sL+-1-cx16.r5sL
goto cx16.r3
goto skip7b
lbl7b: fail_byte(42)
skip7b:
; no else
if x<=cx16.r4sL+-1-cx16.r5sL
fail_byte(43)
; with else
if x<=cx16.r4sL+-1-cx16.r5sL
fail_byte(44)
else
success++
; direct jump
if x<=cx16.r4sL+0-cx16.r5sL
goto lbl8a
goto skip8a
lbl8a: fail_byte(45)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=cx16.r4sL+0-cx16.r5sL
goto cx16.r3
goto skip8b
lbl8b: fail_byte(46)
skip8b:
; no else
if x<=cx16.r4sL+0-cx16.r5sL
fail_byte(47)
; with else
if x<=cx16.r4sL+0-cx16.r5sL
fail_byte(48)
else
success++
; direct jump
if x<=cx16.r4sL+1-cx16.r5sL
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=cx16.r4sL+1-cx16.r5sL
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=cx16.r4sL+1-cx16.r5sL
success++
; with else
if x<=cx16.r4sL+1-cx16.r5sL
success++
else
cx16.r0L++
verify_success(27)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,745 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "float"
uword @shared comparison
sub start() {
txt.print("\n(in)equality tests for datatype: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("==0: ")
test_is_zero()
txt.print("\n!=0: ")
test_not_zero()
txt.print("\n==number: ")
test_is_number()
txt.print("\n!=number: ")
test_not_number()
txt.print("\n==var: ")
test_is_var()
txt.print("\n!=var: ")
test_not_var()
txt.print("\n==array[]: ")
test_is_array()
txt.print("\n!=array[]: ")
test_not_array()
txt.print("\n==expr: ")
test_is_expr()
txt.print("\n!=expr: ")
test_not_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx, byte v1) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.chrout(':')
txt.print_b(v1)
txt.print(" **")
}
sub fail_ubyte(uword idx, ubyte v1) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.chrout(':')
txt.print_ub(v1)
txt.print(" **")
}
sub fail_word(uword idx, word v1) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.chrout(':')
txt.print_w(v1)
txt.print(" **")
}
sub fail_uword(uword idx, uword v1) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.chrout(':')
txt.print_uw(v1)
txt.print(" **")
}
sub fail_float(uword idx, float v1) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.chrout(':')
floats.print(v1)
txt.print(" **")
}
sub test_is_zero() {
float @shared x
success = 0
x=0.0
; direct jump
if x==0
goto lbl1
goto skip1
lbl1: success++
skip1:
; indirect jump
cx16.r3 = &lbl2
if x==0
goto cx16.r3
goto skip2
lbl2: success++
skip2:
; no else
if x==0
success++
; with else
if x==0
success++
else
cx16.r0L++
x = 1234.56
; direct jump
if x==0
goto skip3
success++
skip3:
; indirect jump
cx16.r3 = &skip4
if x==0
goto cx16.r3
success++
skip4:
; no else
success++
if x==0
success--
; with else
if x==0
cx16.r0L++
else
success++
verify_success(8)
}
sub test_not_zero() {
float @shared x
success = 0
x=1234.56
; direct jump
if x!=0
goto lbl1
goto skip1
lbl1: success++
skip1:
; indirect jump
cx16.r3 = &lbl2
if x!=0
goto cx16.r3
goto skip2
lbl2: success++
skip2:
; no else
if x!=0
success++
; with else
if x!=0
success++
else
cx16.r0L++
x = 0.0
; direct jump
if x!=0
goto skip3
success++
skip3:
; indirect jump
cx16.r3 = &skip4
if x!=0
goto cx16.r3
success++
skip4:
; no else
success++
if x!=0
success--
; with else
if x!=0
cx16.r0L++
else
success++
verify_success(8)
}
sub test_is_number() {
float @shared x
success = 0
x=0.0
; direct jump
if x==1234.56
goto lbl1a
goto skip1a
lbl1a: fail_float(1,0.0)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x==1234.56
goto cx16.r3
goto skip1b
lbl1b: fail_float(2,0.0)
skip1b:
; no else
if x==1234.56
fail_float(3,0.0)
; with else
if x==1234.56
fail_float(4,0.0)
else
cx16.r0L++
x=1234.56
; direct jump
if x==1234.56
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x==1234.56
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x==1234.56
success++
; with else
if x==1234.56
success++
else
cx16.r0L++
verify_success(4)
}
sub test_not_number() {
float @shared x
success = 0
x=0.0
; direct jump
if x!=1234.56
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x!=1234.56
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x!=1234.56
success++
; with else
if x!=1234.56
success++
else
cx16.r0L++
x=1234.56
; direct jump
if x!=1234.56
goto lbl2a
goto skip2a
lbl2a: fail_float(5,1234.56)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x!=1234.56
goto cx16.r3
goto skip2b
lbl2b: fail_float(6,1234.56)
skip2b:
; no else
if x!=1234.56
fail_float(7,1234.56)
; with else
if x!=1234.56
fail_float(8,1234.56)
else
cx16.r0L++
verify_success(4)
}
sub test_is_var() {
float @shared x, value
success = 0
x=0.0
value=1234.56
; direct jump
if x==value
goto lbl1a
goto skip1a
lbl1a: fail_float(9,0.0)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x==value
goto cx16.r3
goto skip1b
lbl1b: fail_float(10,0.0)
skip1b:
; no else
if x==value
fail_float(11,0.0)
; with else
if x==value
fail_float(12,0.0)
else
cx16.r0L++
x=1234.56
value=1234.56
; direct jump
if x==value
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x==value
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x==value
success++
; with else
if x==value
success++
else
cx16.r0L++
verify_success(4)
}
sub test_not_var() {
float @shared x, value
success = 0
x=0.0
value=1234.56
; direct jump
if x!=value
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x!=value
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x!=value
success++
; with else
if x!=value
success++
else
cx16.r0L++
x=1234.56
value=1234.56
; direct jump
if x!=value
goto lbl2a
goto skip2a
lbl2a: fail_float(13,1234.56)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x!=value
goto cx16.r3
goto skip2b
lbl2b: fail_float(14,1234.56)
skip2b:
; no else
if x!=value
fail_float(15,1234.56)
; with else
if x!=value
fail_float(16,1234.56)
else
cx16.r0L++
verify_success(4)
}
sub test_is_expr() {
float @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0.0
; direct jump
if x==f4+1234.56-f5
goto lbl1a
goto skip1a
lbl1a: fail_float(17,0.0)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x==f4+1234.56-f5
goto cx16.r3
goto skip1b
lbl1b: fail_float(18,0.0)
skip1b:
; no else
if x==f4+1234.56-f5
fail_float(19,0.0)
; with else
if x==f4+1234.56-f5
fail_float(20,0.0)
else
cx16.r0L++
x=1234.56
; direct jump
if x==f4+1234.56-f5
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x==f4+1234.56-f5
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x==f4+1234.56-f5
success++
; with else
if x==f4+1234.56-f5
success++
else
cx16.r0L++
verify_success(4)
}
sub test_not_expr() {
float @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0.0
; direct jump
if x!=f4+1234.56-f5
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x!=f4+1234.56-f5
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x!=f4+1234.56-f5
success++
; with else
if x!=f4+1234.56-f5
success++
else
cx16.r0L++
x=1234.56
; direct jump
if x!=f4+1234.56-f5
goto lbl2a
goto skip2a
lbl2a: fail_float(21,1234.56)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x!=f4+1234.56-f5
goto cx16.r3
goto skip2b
lbl2b: fail_float(22,1234.56)
skip2b:
; no else
if x!=f4+1234.56-f5
fail_float(23,1234.56)
; with else
if x!=f4+1234.56-f5
fail_float(24,1234.56)
else
cx16.r0L++
verify_success(4)
}
sub test_is_array() {
float @shared x
float[] values = [0, 0]
float[] sources = [0, 0]
success = 0
x=0.0
sources[1]=0.0
values[1]=1234.56
; direct jump
if x==values[1]
goto lbl1a
goto skip1a
lbl1a: fail_float(25,0.0)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x==values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_float(26,0.0)
skip1b:
; no else
if x==values[1]
fail_float(27,0.0)
; with else
if x==values[1]
fail_float(28,0.0)
else
cx16.r0L++
; direct jump
if sources[1]==values[1]
goto lbl1c
goto skip1c
lbl1c: fail_float(29,0.0)
skip1c:
; indirect jump
cx16.r3 = &lbl1d
if sources[1]==values[1]
goto cx16.r3
goto skip1d
lbl1d: fail_float(30,0.0)
skip1d:
; no else
if sources[1]==values[1]
fail_float(31,0.0)
; with else
if sources[1]==values[1]
fail_float(32,0.0)
else
cx16.r0L++
x=1234.56
sources[1]=1234.56
values[1]=1234.56
; direct jump
if x==values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x==values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x==values[1]
success++
; with else
if x==values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]==values[1]
goto lbl2c
goto skip2c
lbl2c: success++
skip2c:
; indirect jump
cx16.r3 = &lbl2d
if sources[1]==values[1]
goto cx16.r3
goto skip2d
lbl2d: success++
skip2d:
; no else
if sources[1]==values[1]
success++
; with else
if sources[1]==values[1]
success++
else
cx16.r0L++
verify_success(8)
}
sub test_not_array() {
float @shared x
float[] values = [0, 0]
float[] sources = [0, 0]
success = 0
x=0.0
sources[1]=0.0
values[1]=1234.56
; direct jump
if x!=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x!=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x!=values[1]
success++
; with else
if x!=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]!=values[1]
goto lbl1c
goto skip1c
lbl1c: success++
skip1c:
; indirect jump
cx16.r3 = &lbl1d
if sources[1]!=values[1]
goto cx16.r3
goto skip1d
lbl1d: success++
skip1d:
; no else
if sources[1]!=values[1]
success++
; with else
if sources[1]!=values[1]
success++
else
cx16.r0L++
x=1234.56
sources[1]=1234.56
values[1]=1234.56
; direct jump
if x!=values[1]
goto lbl2a
goto skip2a
lbl2a: fail_float(33,1234.56)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x!=values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_float(34,1234.56)
skip2b:
; no else
if x!=values[1]
fail_float(35,1234.56)
; with else
if x!=values[1]
fail_float(36,1234.56)
else
cx16.r0L++
; direct jump
if sources[1]!=values[1]
goto lbl2c
goto skip2c
lbl2c: fail_float(37,1234.56)
skip2c:
; indirect jump
cx16.r3 = &lbl2d
if sources[1]!=values[1]
goto cx16.r3
goto skip2d
lbl2d: fail_float(38,1234.56)
skip2d:
; no else
if sources[1]!=values[1]
fail_float(39,1234.56)
; with else
if sources[1]!=values[1]
fail_float(40,1234.56)
else
cx16.r0L++
verify_success(8)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,482 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "float"
uword @shared comparison
sub start() {
txt.print("\ngreater-than tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>number: ")
test_cmp_number()
txt.print("\n>var: ")
test_cmp_var()
txt.print("\n>array[]: ")
test_cmp_array()
txt.print("\n>expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
float @shared x
success = 0
x=0.0
; direct jump
if x>0.0
goto lbl1a
goto skip1a
lbl1a: fail_float(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>0.0
goto cx16.r3
goto skip1b
lbl1b: fail_float(2)
skip1b:
; no else
if x>0.0
fail_float(3)
; with else
if x>0.0
fail_float(4)
else
success++
; direct jump
if x>1234.56
goto lbl2a
goto skip2a
lbl2a: fail_float(5)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>1234.56
goto cx16.r3
goto skip2b
lbl2b: fail_float(6)
skip2b:
; no else
if x>1234.56
fail_float(7)
; with else
if x>1234.56
fail_float(8)
else
success++
x=1234.56
; direct jump
if x>0.0
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>0.0
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>0.0
success++
; with else
if x>0.0
success++
else
cx16.r0L++
; direct jump
if x>1234.56
goto lbl4a
goto skip4a
lbl4a: fail_float(9)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>1234.56
goto cx16.r3
goto skip4b
lbl4b: fail_float(10)
skip4b:
; no else
if x>1234.56
fail_float(11)
; with else
if x>1234.56
fail_float(12)
else
success++
verify_success(7)
}
sub test_cmp_var() {
float @shared x, value
success = 0
x=0.0
value=0.0
; direct jump
if x>value
goto lbl1a
goto skip1a
lbl1a: fail_float(13)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>value
goto cx16.r3
goto skip1b
lbl1b: fail_float(14)
skip1b:
; no else
if x>value
fail_float(15)
; with else
if x>value
fail_float(16)
else
success++
value=1234.56
; direct jump
if x>value
goto lbl2a
goto skip2a
lbl2a: fail_float(17)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>value
goto cx16.r3
goto skip2b
lbl2b: fail_float(18)
skip2b:
; no else
if x>value
fail_float(19)
; with else
if x>value
fail_float(20)
else
success++
x=1234.56
value=0.0
; direct jump
if x>value
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>value
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>value
success++
; with else
if x>value
success++
else
cx16.r0L++
value=1234.56
; direct jump
if x>value
goto lbl4a
goto skip4a
lbl4a: fail_float(21)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>value
goto cx16.r3
goto skip4b
lbl4b: fail_float(22)
skip4b:
; no else
if x>value
fail_float(23)
; with else
if x>value
fail_float(24)
else
success++
verify_success(7)
}
sub test_cmp_array() {
float @shared x
float[] values = [0, 0]
success = 0
x=0.0
values[1]=0.0
; direct jump
if x>values[1]
goto lbl1a
goto skip1a
lbl1a: fail_float(25)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_float(26)
skip1b:
; no else
if x>values[1]
fail_float(27)
; with else
if x>values[1]
fail_float(28)
else
success++
values[1]=1234.56
; direct jump
if x>values[1]
goto lbl2a
goto skip2a
lbl2a: fail_float(29)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_float(30)
skip2b:
; no else
if x>values[1]
fail_float(31)
; with else
if x>values[1]
fail_float(32)
else
success++
x=1234.56
values[1]=0.0
; direct jump
if x>values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
values[1]=1234.56
; direct jump
if x>values[1]
goto lbl4a
goto skip4a
lbl4a: fail_float(33)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_float(34)
skip4b:
; no else
if x>values[1]
fail_float(35)
; with else
if x>values[1]
fail_float(36)
else
success++
verify_success(7)
}
sub test_cmp_expr() {
float @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0.0
; direct jump
if x>f4+0.0-f5
goto lbl1a
goto skip1a
lbl1a: fail_float(37)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>f4+0.0-f5
goto cx16.r3
goto skip1b
lbl1b: fail_float(38)
skip1b:
; no else
if x>f4+0.0-f5
fail_float(39)
; with else
if x>f4+0.0-f5
fail_float(40)
else
success++
; direct jump
if x>f4+1234.56-f5
goto lbl2a
goto skip2a
lbl2a: fail_float(41)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>f4+1234.56-f5
goto cx16.r3
goto skip2b
lbl2b: fail_float(42)
skip2b:
; no else
if x>f4+1234.56-f5
fail_float(43)
; with else
if x>f4+1234.56-f5
fail_float(44)
else
success++
x=1234.56
; direct jump
if x>f4+0.0-f5
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>f4+0.0-f5
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>f4+0.0-f5
success++
; with else
if x>f4+0.0-f5
success++
else
cx16.r0L++
; direct jump
if x>f4+1234.56-f5
goto lbl4a
goto skip4a
lbl4a: fail_float(45)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>f4+1234.56-f5
goto cx16.r3
goto skip4b
lbl4b: fail_float(46)
skip4b:
; no else
if x>f4+1234.56-f5
fail_float(47)
; with else
if x>f4+1234.56-f5
fail_float(48)
else
success++
verify_success(7)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,482 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "float"
uword @shared comparison
sub start() {
txt.print("\ngreater-equal tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>=number: ")
test_cmp_number()
txt.print("\n>=var: ")
test_cmp_var()
txt.print("\n>=array[]: ")
test_cmp_array()
txt.print("\n>=expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
float @shared x
success = 0
x=0.0
; direct jump
if x>=0.0
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=0.0
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=0.0
success++
; with else
if x>=0.0
success++
else
cx16.r0L++
; direct jump
if x>=1234.56
goto lbl2a
goto skip2a
lbl2a: fail_float(1)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=1234.56
goto cx16.r3
goto skip2b
lbl2b: fail_float(2)
skip2b:
; no else
if x>=1234.56
fail_float(3)
; with else
if x>=1234.56
fail_float(4)
else
success++
x=1234.56
; direct jump
if x>=0.0
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=0.0
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>=0.0
success++
; with else
if x>=0.0
success++
else
cx16.r0L++
; direct jump
if x>=1234.56
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=1234.56
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=1234.56
success++
; with else
if x>=1234.56
success++
else
cx16.r0L++
verify_success(13)
}
sub test_cmp_var() {
float @shared x, value
success = 0
x=0.0
value=0.0
; direct jump
if x>=value
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=value
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=1234.56
; direct jump
if x>=value
goto lbl2a
goto skip2a
lbl2a: fail_float(5)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=value
goto cx16.r3
goto skip2b
lbl2b: fail_float(6)
skip2b:
; no else
if x>=value
fail_float(7)
; with else
if x>=value
fail_float(8)
else
success++
x=1234.56
value=0.0
; direct jump
if x>=value
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=value
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=1234.56
; direct jump
if x>=value
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=value
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
verify_success(13)
}
sub test_cmp_array() {
float @shared x
float[] values = [0, 0]
success = 0
x=0.0
values[1]=0.0
; direct jump
if x>=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=1234.56
; direct jump
if x>=values[1]
goto lbl2a
goto skip2a
lbl2a: fail_float(9)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_float(10)
skip2b:
; no else
if x>=values[1]
fail_float(11)
; with else
if x>=values[1]
fail_float(12)
else
success++
x=1234.56
values[1]=0.0
; direct jump
if x>=values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=1234.56
; direct jump
if x>=values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
verify_success(13)
}
sub test_cmp_expr() {
float @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0.0
; direct jump
if x>=f4+0.0-f5
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=f4+0.0-f5
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=f4+0.0-f5
success++
; with else
if x>=f4+0.0-f5
success++
else
cx16.r0L++
; direct jump
if x>=f4+1234.56-f5
goto lbl2a
goto skip2a
lbl2a: fail_float(13)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=f4+1234.56-f5
goto cx16.r3
goto skip2b
lbl2b: fail_float(14)
skip2b:
; no else
if x>=f4+1234.56-f5
fail_float(15)
; with else
if x>=f4+1234.56-f5
fail_float(16)
else
success++
x=1234.56
; direct jump
if x>=f4+0.0-f5
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=f4+0.0-f5
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x>=f4+0.0-f5
success++
; with else
if x>=f4+0.0-f5
success++
else
cx16.r0L++
; direct jump
if x>=f4+1234.56-f5
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=f4+1234.56-f5
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=f4+1234.56-f5
success++
; with else
if x>=f4+1234.56-f5
success++
else
cx16.r0L++
verify_success(13)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,482 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "float"
uword @shared comparison
sub start() {
txt.print("\nless-than tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<number: ")
test_cmp_number()
txt.print("\n<var: ")
test_cmp_var()
txt.print("\n<array[]: ")
test_cmp_array()
txt.print("\n<expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
float @shared x
success = 0
x=0.0
; direct jump
if x<0.0
goto lbl1a
goto skip1a
lbl1a: fail_float(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<0.0
goto cx16.r3
goto skip1b
lbl1b: fail_float(2)
skip1b:
; no else
if x<0.0
fail_float(3)
; with else
if x<0.0
fail_float(4)
else
success++
; direct jump
if x<1234.56
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<1234.56
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<1234.56
success++
; with else
if x<1234.56
success++
else
cx16.r0L++
x=1234.56
; direct jump
if x<0.0
goto lbl3a
goto skip3a
lbl3a: fail_float(5)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<0.0
goto cx16.r3
goto skip3b
lbl3b: fail_float(6)
skip3b:
; no else
if x<0.0
fail_float(7)
; with else
if x<0.0
fail_float(8)
else
success++
; direct jump
if x<1234.56
goto lbl4a
goto skip4a
lbl4a: fail_float(9)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<1234.56
goto cx16.r3
goto skip4b
lbl4b: fail_float(10)
skip4b:
; no else
if x<1234.56
fail_float(11)
; with else
if x<1234.56
fail_float(12)
else
success++
verify_success(7)
}
sub test_cmp_var() {
float @shared x, value
success = 0
x=0.0
value=0.0
; direct jump
if x<value
goto lbl1a
goto skip1a
lbl1a: fail_float(13)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<value
goto cx16.r3
goto skip1b
lbl1b: fail_float(14)
skip1b:
; no else
if x<value
fail_float(15)
; with else
if x<value
fail_float(16)
else
success++
value=1234.56
; direct jump
if x<value
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<value
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<value
success++
; with else
if x<value
success++
else
cx16.r0L++
x=1234.56
value=0.0
; direct jump
if x<value
goto lbl3a
goto skip3a
lbl3a: fail_float(17)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<value
goto cx16.r3
goto skip3b
lbl3b: fail_float(18)
skip3b:
; no else
if x<value
fail_float(19)
; with else
if x<value
fail_float(20)
else
success++
value=1234.56
; direct jump
if x<value
goto lbl4a
goto skip4a
lbl4a: fail_float(21)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<value
goto cx16.r3
goto skip4b
lbl4b: fail_float(22)
skip4b:
; no else
if x<value
fail_float(23)
; with else
if x<value
fail_float(24)
else
success++
verify_success(7)
}
sub test_cmp_array() {
float @shared x
float[] values = [0, 0]
success = 0
x=0.0
values[1]=0.0
; direct jump
if x<values[1]
goto lbl1a
goto skip1a
lbl1a: fail_float(25)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_float(26)
skip1b:
; no else
if x<values[1]
fail_float(27)
; with else
if x<values[1]
fail_float(28)
else
success++
values[1]=1234.56
; direct jump
if x<values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
x=1234.56
values[1]=0.0
; direct jump
if x<values[1]
goto lbl3a
goto skip3a
lbl3a: fail_float(29)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_float(30)
skip3b:
; no else
if x<values[1]
fail_float(31)
; with else
if x<values[1]
fail_float(32)
else
success++
values[1]=1234.56
; direct jump
if x<values[1]
goto lbl4a
goto skip4a
lbl4a: fail_float(33)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_float(34)
skip4b:
; no else
if x<values[1]
fail_float(35)
; with else
if x<values[1]
fail_float(36)
else
success++
verify_success(7)
}
sub test_cmp_expr() {
float @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0.0
; direct jump
if x<f4+0.0-f5
goto lbl1a
goto skip1a
lbl1a: fail_float(37)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<f4+0.0-f5
goto cx16.r3
goto skip1b
lbl1b: fail_float(38)
skip1b:
; no else
if x<f4+0.0-f5
fail_float(39)
; with else
if x<f4+0.0-f5
fail_float(40)
else
success++
; direct jump
if x<f4+1234.56-f5
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<f4+1234.56-f5
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<f4+1234.56-f5
success++
; with else
if x<f4+1234.56-f5
success++
else
cx16.r0L++
x=1234.56
; direct jump
if x<f4+0.0-f5
goto lbl3a
goto skip3a
lbl3a: fail_float(41)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<f4+0.0-f5
goto cx16.r3
goto skip3b
lbl3b: fail_float(42)
skip3b:
; no else
if x<f4+0.0-f5
fail_float(43)
; with else
if x<f4+0.0-f5
fail_float(44)
else
success++
; direct jump
if x<f4+1234.56-f5
goto lbl4a
goto skip4a
lbl4a: fail_float(45)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<f4+1234.56-f5
goto cx16.r3
goto skip4b
lbl4b: fail_float(46)
skip4b:
; no else
if x<f4+1234.56-f5
fail_float(47)
; with else
if x<f4+1234.56-f5
fail_float(48)
else
success++
verify_success(7)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,482 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "float"
uword @shared comparison
sub start() {
txt.print("\nless-equal tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<=number: ")
test_cmp_number()
txt.print("\n<=var: ")
test_cmp_var()
txt.print("\n<=array[]: ")
test_cmp_array()
txt.print("\n<=expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
float @shared x
success = 0
x=0.0
; direct jump
if x<=0.0
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=0.0
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=0.0
success++
; with else
if x<=0.0
success++
else
cx16.r0L++
; direct jump
if x<=1234.56
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=1234.56
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=1234.56
success++
; with else
if x<=1234.56
success++
else
cx16.r0L++
x=1234.56
; direct jump
if x<=0.0
goto lbl3a
goto skip3a
lbl3a: fail_float(1)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=0.0
goto cx16.r3
goto skip3b
lbl3b: fail_float(2)
skip3b:
; no else
if x<=0.0
fail_float(3)
; with else
if x<=0.0
fail_float(4)
else
success++
; direct jump
if x<=1234.56
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=1234.56
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x<=1234.56
success++
; with else
if x<=1234.56
success++
else
cx16.r0L++
verify_success(13)
}
sub test_cmp_var() {
float @shared x, value
success = 0
x=0.0
value=0.0
; direct jump
if x<=value
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=value
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
value=1234.56
; direct jump
if x<=value
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=value
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
x=1234.56
value=0.0
; direct jump
if x<=value
goto lbl3a
goto skip3a
lbl3a: fail_float(5)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=value
goto cx16.r3
goto skip3b
lbl3b: fail_float(6)
skip3b:
; no else
if x<=value
fail_float(7)
; with else
if x<=value
fail_float(8)
else
success++
value=1234.56
; direct jump
if x<=value
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=value
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
verify_success(13)
}
sub test_cmp_array() {
float @shared x
float[] values = [0, 0]
success = 0
x=0.0
values[1]=0.0
; direct jump
if x<=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
values[1]=1234.56
; direct jump
if x<=values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
x=1234.56
values[1]=0.0
; direct jump
if x<=values[1]
goto lbl3a
goto skip3a
lbl3a: fail_float(9)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_float(10)
skip3b:
; no else
if x<=values[1]
fail_float(11)
; with else
if x<=values[1]
fail_float(12)
else
success++
values[1]=1234.56
; direct jump
if x<=values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
verify_success(13)
}
sub test_cmp_expr() {
float @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0.0
; direct jump
if x<=f4+0.0-f5
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=f4+0.0-f5
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=f4+0.0-f5
success++
; with else
if x<=f4+0.0-f5
success++
else
cx16.r0L++
; direct jump
if x<=f4+1234.56-f5
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=f4+1234.56-f5
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=f4+1234.56-f5
success++
; with else
if x<=f4+1234.56-f5
success++
else
cx16.r0L++
x=1234.56
; direct jump
if x<=f4+0.0-f5
goto lbl3a
goto skip3a
lbl3a: fail_float(13)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=f4+0.0-f5
goto cx16.r3
goto skip3b
lbl3b: fail_float(14)
skip3b:
; no else
if x<=f4+0.0-f5
fail_float(15)
; with else
if x<=f4+0.0-f5
fail_float(16)
else
success++
; direct jump
if x<=f4+1234.56-f5
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=f4+1234.56-f5
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x<=f4+1234.56-f5
success++
; with else
if x<=f4+1234.56-f5
success++
else
cx16.r0L++
verify_success(13)
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "ubyte"
uword @shared comparison
sub start() {
txt.print("\ngreater-than tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>number: ")
test_cmp_number()
txt.print("\n>var: ")
test_cmp_var()
txt.print("\n>array[]: ")
test_cmp_array()
txt.print("\n>expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
ubyte @shared x
success = 0
x=0
; direct jump
if x>0
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>0
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(2)
skip1b:
; no else
if x>0
fail_ubyte(3)
; with else
if x>0
fail_ubyte(4)
else
success++
; direct jump
if x>1
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(5)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>1
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(6)
skip2b:
; no else
if x>1
fail_ubyte(7)
; with else
if x>1
fail_ubyte(8)
else
success++
; direct jump
if x>255
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(9)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>255
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(10)
skip3b:
; no else
if x>255
fail_ubyte(11)
; with else
if x>255
fail_ubyte(12)
else
success++
x=1
; direct jump
if x>0
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>0
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>0
success++
; with else
if x>0
success++
else
cx16.r0L++
; direct jump
if x>1
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(13)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>1
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(14)
skip5b:
; no else
if x>1
fail_ubyte(15)
; with else
if x>1
fail_ubyte(16)
else
success++
; direct jump
if x>255
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(17)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>255
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(18)
skip6b:
; no else
if x>255
fail_ubyte(19)
; with else
if x>255
fail_ubyte(20)
else
success++
x=255
; direct jump
if x>0
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>0
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>0
success++
; with else
if x>0
success++
else
cx16.r0L++
; direct jump
if x>1
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>1
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>1
success++
; with else
if x>1
success++
else
cx16.r0L++
; direct jump
if x>255
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(21)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>255
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(22)
skip9b:
; no else
if x>255
fail_ubyte(23)
; with else
if x>255
fail_ubyte(24)
else
success++
verify_success(18)
}
sub test_cmp_var() {
ubyte @shared x, value
success = 0
x=0
value=0
; direct jump
if x>value
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(25)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>value
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(26)
skip1b:
; no else
if x>value
fail_ubyte(27)
; with else
if x>value
fail_ubyte(28)
else
success++
value=1
; direct jump
if x>value
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(29)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>value
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(30)
skip2b:
; no else
if x>value
fail_ubyte(31)
; with else
if x>value
fail_ubyte(32)
else
success++
value=255
; direct jump
if x>value
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(33)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>value
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(34)
skip3b:
; no else
if x>value
fail_ubyte(35)
; with else
if x>value
fail_ubyte(36)
else
success++
x=1
value=0
; direct jump
if x>value
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>value
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>value
success++
; with else
if x>value
success++
else
cx16.r0L++
value=1
; direct jump
if x>value
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(37)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>value
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(38)
skip5b:
; no else
if x>value
fail_ubyte(39)
; with else
if x>value
fail_ubyte(40)
else
success++
value=255
; direct jump
if x>value
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(41)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>value
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(42)
skip6b:
; no else
if x>value
fail_ubyte(43)
; with else
if x>value
fail_ubyte(44)
else
success++
x=255
value=0
; direct jump
if x>value
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>value
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>value
success++
; with else
if x>value
success++
else
cx16.r0L++
value=1
; direct jump
if x>value
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>value
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>value
success++
; with else
if x>value
success++
else
cx16.r0L++
value=255
; direct jump
if x>value
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(45)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>value
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(46)
skip9b:
; no else
if x>value
fail_ubyte(47)
; with else
if x>value
fail_ubyte(48)
else
success++
verify_success(18)
}
sub test_cmp_array() {
ubyte @shared x
ubyte[] values = [0, 0]
success = 0
x=0
values[1]=0
; direct jump
if x>values[1]
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(49)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(50)
skip1b:
; no else
if x>values[1]
fail_ubyte(51)
; with else
if x>values[1]
fail_ubyte(52)
else
success++
values[1]=1
; direct jump
if x>values[1]
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(53)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(54)
skip2b:
; no else
if x>values[1]
fail_ubyte(55)
; with else
if x>values[1]
fail_ubyte(56)
else
success++
values[1]=255
; direct jump
if x>values[1]
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(57)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(58)
skip3b:
; no else
if x>values[1]
fail_ubyte(59)
; with else
if x>values[1]
fail_ubyte(60)
else
success++
x=1
values[1]=0
; direct jump
if x>values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>values[1]
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(61)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>values[1]
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(62)
skip5b:
; no else
if x>values[1]
fail_ubyte(63)
; with else
if x>values[1]
fail_ubyte(64)
else
success++
values[1]=255
; direct jump
if x>values[1]
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(65)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>values[1]
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(66)
skip6b:
; no else
if x>values[1]
fail_ubyte(67)
; with else
if x>values[1]
fail_ubyte(68)
else
success++
x=255
values[1]=0
; direct jump
if x>values[1]
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>values[1]
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>values[1]
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>values[1]
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
values[1]=255
; direct jump
if x>values[1]
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(69)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>values[1]
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(70)
skip9b:
; no else
if x>values[1]
fail_ubyte(71)
; with else
if x>values[1]
fail_ubyte(72)
else
success++
verify_success(18)
}
sub test_cmp_expr() {
ubyte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0
; direct jump
if x>cx16.r4L+0-cx16.r5L
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(73)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(74)
skip1b:
; no else
if x>cx16.r4L+0-cx16.r5L
fail_ubyte(75)
; with else
if x>cx16.r4L+0-cx16.r5L
fail_ubyte(76)
else
success++
; direct jump
if x>cx16.r4L+1-cx16.r5L
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(77)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(78)
skip2b:
; no else
if x>cx16.r4L+1-cx16.r5L
fail_ubyte(79)
; with else
if x>cx16.r4L+1-cx16.r5L
fail_ubyte(80)
else
success++
; direct jump
if x>cx16.r4L+255-cx16.r5L
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(81)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(82)
skip3b:
; no else
if x>cx16.r4L+255-cx16.r5L
fail_ubyte(83)
; with else
if x>cx16.r4L+255-cx16.r5L
fail_ubyte(84)
else
success++
x=1
; direct jump
if x>cx16.r4L+0-cx16.r5L
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>cx16.r4L+0-cx16.r5L
success++
; with else
if x>cx16.r4L+0-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>cx16.r4L+1-cx16.r5L
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(85)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(86)
skip5b:
; no else
if x>cx16.r4L+1-cx16.r5L
fail_ubyte(87)
; with else
if x>cx16.r4L+1-cx16.r5L
fail_ubyte(88)
else
success++
; direct jump
if x>cx16.r4L+255-cx16.r5L
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(89)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(90)
skip6b:
; no else
if x>cx16.r4L+255-cx16.r5L
fail_ubyte(91)
; with else
if x>cx16.r4L+255-cx16.r5L
fail_ubyte(92)
else
success++
x=255
; direct jump
if x>cx16.r4L+0-cx16.r5L
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>cx16.r4L+0-cx16.r5L
success++
; with else
if x>cx16.r4L+0-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>cx16.r4L+1-cx16.r5L
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>cx16.r4L+1-cx16.r5L
success++
; with else
if x>cx16.r4L+1-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>cx16.r4L+255-cx16.r5L
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(93)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(94)
skip9b:
; no else
if x>cx16.r4L+255-cx16.r5L
fail_ubyte(95)
; with else
if x>cx16.r4L+255-cx16.r5L
fail_ubyte(96)
else
success++
verify_success(18)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "ubyte"
uword @shared comparison
sub start() {
txt.print("\ngreater-equal tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>=number: ")
test_cmp_number()
txt.print("\n>=var: ")
test_cmp_var()
txt.print("\n>=array[]: ")
test_cmp_array()
txt.print("\n>=expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
ubyte @shared x
success = 0
x=0
; direct jump
if x>=0
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=0
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=0
success++
; with else
if x>=0
success++
else
cx16.r0L++
; direct jump
if x>=1
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(1)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=1
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(2)
skip2b:
; no else
if x>=1
fail_ubyte(3)
; with else
if x>=1
fail_ubyte(4)
else
success++
; direct jump
if x>=255
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(5)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=255
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(6)
skip3b:
; no else
if x>=255
fail_ubyte(7)
; with else
if x>=255
fail_ubyte(8)
else
success++
x=1
; direct jump
if x>=0
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=0
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=0
success++
; with else
if x>=0
success++
else
cx16.r0L++
; direct jump
if x>=1
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=1
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=1
success++
; with else
if x>=1
success++
else
cx16.r0L++
; direct jump
if x>=255
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(9)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=255
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(10)
skip6b:
; no else
if x>=255
fail_ubyte(11)
; with else
if x>=255
fail_ubyte(12)
else
success++
x=255
; direct jump
if x>=0
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=0
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=0
success++
; with else
if x>=0
success++
else
cx16.r0L++
; direct jump
if x>=1
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=1
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=1
success++
; with else
if x>=1
success++
else
cx16.r0L++
; direct jump
if x>=255
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=255
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=255
success++
; with else
if x>=255
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_var() {
ubyte @shared x, value
success = 0
x=0
value=0
; direct jump
if x>=value
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=value
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=1
; direct jump
if x>=value
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(13)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=value
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(14)
skip2b:
; no else
if x>=value
fail_ubyte(15)
; with else
if x>=value
fail_ubyte(16)
else
success++
value=255
; direct jump
if x>=value
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(17)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=value
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(18)
skip3b:
; no else
if x>=value
fail_ubyte(19)
; with else
if x>=value
fail_ubyte(20)
else
success++
x=1
value=0
; direct jump
if x>=value
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=value
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=1
; direct jump
if x>=value
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=value
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=255
; direct jump
if x>=value
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(21)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=value
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(22)
skip6b:
; no else
if x>=value
fail_ubyte(23)
; with else
if x>=value
fail_ubyte(24)
else
success++
x=255
value=0
; direct jump
if x>=value
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=value
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=1
; direct jump
if x>=value
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=value
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
value=255
; direct jump
if x>=value
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=value
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=value
success++
; with else
if x>=value
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_array() {
ubyte @shared x
ubyte[] values = [0, 0]
success = 0
x=0
values[1]=0
; direct jump
if x>=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(25)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(26)
skip2b:
; no else
if x>=values[1]
fail_ubyte(27)
; with else
if x>=values[1]
fail_ubyte(28)
else
success++
values[1]=255
; direct jump
if x>=values[1]
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(29)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(30)
skip3b:
; no else
if x>=values[1]
fail_ubyte(31)
; with else
if x>=values[1]
fail_ubyte(32)
else
success++
x=1
values[1]=0
; direct jump
if x>=values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=values[1]
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=255
; direct jump
if x>=values[1]
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(33)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=values[1]
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(34)
skip6b:
; no else
if x>=values[1]
fail_ubyte(35)
; with else
if x>=values[1]
fail_ubyte(36)
else
success++
x=255
values[1]=0
; direct jump
if x>=values[1]
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=values[1]
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=values[1]
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
values[1]=255
; direct jump
if x>=values[1]
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=values[1]
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_expr() {
ubyte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0
; direct jump
if x>=cx16.r4L+0-cx16.r5L
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=cx16.r4L+0-cx16.r5L
success++
; with else
if x>=cx16.r4L+0-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4L+1-cx16.r5L
goto lbl2a
goto skip2a
lbl2a: fail_ubyte(37)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip2b
lbl2b: fail_ubyte(38)
skip2b:
; no else
if x>=cx16.r4L+1-cx16.r5L
fail_ubyte(39)
; with else
if x>=cx16.r4L+1-cx16.r5L
fail_ubyte(40)
else
success++
; direct jump
if x>=cx16.r4L+255-cx16.r5L
goto lbl3a
goto skip3a
lbl3a: fail_ubyte(41)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip3b
lbl3b: fail_ubyte(42)
skip3b:
; no else
if x>=cx16.r4L+255-cx16.r5L
fail_ubyte(43)
; with else
if x>=cx16.r4L+255-cx16.r5L
fail_ubyte(44)
else
success++
x=1
; direct jump
if x>=cx16.r4L+0-cx16.r5L
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x>=cx16.r4L+0-cx16.r5L
success++
; with else
if x>=cx16.r4L+0-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4L+1-cx16.r5L
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=cx16.r4L+1-cx16.r5L
success++
; with else
if x>=cx16.r4L+1-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4L+255-cx16.r5L
goto lbl6a
goto skip6a
lbl6a: fail_ubyte(45)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip6b
lbl6b: fail_ubyte(46)
skip6b:
; no else
if x>=cx16.r4L+255-cx16.r5L
fail_ubyte(47)
; with else
if x>=cx16.r4L+255-cx16.r5L
fail_ubyte(48)
else
success++
x=255
; direct jump
if x>=cx16.r4L+0-cx16.r5L
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x>=cx16.r4L+0-cx16.r5L
success++
; with else
if x>=cx16.r4L+0-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4L+1-cx16.r5L
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x>=cx16.r4L+1-cx16.r5L
success++
; with else
if x>=cx16.r4L+1-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x>=cx16.r4L+255-cx16.r5L
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=cx16.r4L+255-cx16.r5L
success++
; with else
if x>=cx16.r4L+255-cx16.r5L
success++
else
cx16.r0L++
verify_success(27)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "ubyte"
uword @shared comparison
sub start() {
txt.print("\nless-than tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<number: ")
test_cmp_number()
txt.print("\n<var: ")
test_cmp_var()
txt.print("\n<array[]: ")
test_cmp_array()
txt.print("\n<expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
ubyte @shared x
success = 0
x=0
; direct jump
if x<0
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<0
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(2)
skip1b:
; no else
if x<0
fail_ubyte(3)
; with else
if x<0
fail_ubyte(4)
else
success++
; direct jump
if x<1
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<1
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<1
success++
; with else
if x<1
success++
else
cx16.r0L++
; direct jump
if x<255
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<255
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<255
success++
; with else
if x<255
success++
else
cx16.r0L++
x=1
; direct jump
if x<0
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(5)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<0
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(6)
skip4b:
; no else
if x<0
fail_ubyte(7)
; with else
if x<0
fail_ubyte(8)
else
success++
; direct jump
if x<1
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(9)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<1
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(10)
skip5b:
; no else
if x<1
fail_ubyte(11)
; with else
if x<1
fail_ubyte(12)
else
success++
; direct jump
if x<255
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<255
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<255
success++
; with else
if x<255
success++
else
cx16.r0L++
x=255
; direct jump
if x<0
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(13)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<0
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(14)
skip7b:
; no else
if x<0
fail_ubyte(15)
; with else
if x<0
fail_ubyte(16)
else
success++
; direct jump
if x<1
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(17)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<1
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(18)
skip8b:
; no else
if x<1
fail_ubyte(19)
; with else
if x<1
fail_ubyte(20)
else
success++
; direct jump
if x<255
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(21)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<255
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(22)
skip9b:
; no else
if x<255
fail_ubyte(23)
; with else
if x<255
fail_ubyte(24)
else
success++
verify_success(18)
}
sub test_cmp_var() {
ubyte @shared x, value
success = 0
x=0
value=0
; direct jump
if x<value
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(25)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<value
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(26)
skip1b:
; no else
if x<value
fail_ubyte(27)
; with else
if x<value
fail_ubyte(28)
else
success++
value=1
; direct jump
if x<value
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<value
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<value
success++
; with else
if x<value
success++
else
cx16.r0L++
value=255
; direct jump
if x<value
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<value
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<value
success++
; with else
if x<value
success++
else
cx16.r0L++
x=1
value=0
; direct jump
if x<value
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(29)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<value
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(30)
skip4b:
; no else
if x<value
fail_ubyte(31)
; with else
if x<value
fail_ubyte(32)
else
success++
value=1
; direct jump
if x<value
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(33)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<value
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(34)
skip5b:
; no else
if x<value
fail_ubyte(35)
; with else
if x<value
fail_ubyte(36)
else
success++
value=255
; direct jump
if x<value
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<value
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<value
success++
; with else
if x<value
success++
else
cx16.r0L++
x=255
value=0
; direct jump
if x<value
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(37)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<value
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(38)
skip7b:
; no else
if x<value
fail_ubyte(39)
; with else
if x<value
fail_ubyte(40)
else
success++
value=1
; direct jump
if x<value
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(41)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<value
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(42)
skip8b:
; no else
if x<value
fail_ubyte(43)
; with else
if x<value
fail_ubyte(44)
else
success++
value=255
; direct jump
if x<value
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(45)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<value
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(46)
skip9b:
; no else
if x<value
fail_ubyte(47)
; with else
if x<value
fail_ubyte(48)
else
success++
verify_success(18)
}
sub test_cmp_array() {
ubyte @shared x
ubyte[] values = [0, 0]
success = 0
x=0
values[1]=0
; direct jump
if x<values[1]
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(49)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(50)
skip1b:
; no else
if x<values[1]
fail_ubyte(51)
; with else
if x<values[1]
fail_ubyte(52)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
values[1]=255
; direct jump
if x<values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
x=1
values[1]=0
; direct jump
if x<values[1]
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(53)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(54)
skip4b:
; no else
if x<values[1]
fail_ubyte(55)
; with else
if x<values[1]
fail_ubyte(56)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(57)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<values[1]
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(58)
skip5b:
; no else
if x<values[1]
fail_ubyte(59)
; with else
if x<values[1]
fail_ubyte(60)
else
success++
values[1]=255
; direct jump
if x<values[1]
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<values[1]
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
x=255
values[1]=0
; direct jump
if x<values[1]
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(61)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<values[1]
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(62)
skip7b:
; no else
if x<values[1]
fail_ubyte(63)
; with else
if x<values[1]
fail_ubyte(64)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(65)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<values[1]
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(66)
skip8b:
; no else
if x<values[1]
fail_ubyte(67)
; with else
if x<values[1]
fail_ubyte(68)
else
success++
values[1]=255
; direct jump
if x<values[1]
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(69)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<values[1]
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(70)
skip9b:
; no else
if x<values[1]
fail_ubyte(71)
; with else
if x<values[1]
fail_ubyte(72)
else
success++
verify_success(18)
}
sub test_cmp_expr() {
ubyte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0
; direct jump
if x<cx16.r4L+0-cx16.r5L
goto lbl1a
goto skip1a
lbl1a: fail_ubyte(73)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip1b
lbl1b: fail_ubyte(74)
skip1b:
; no else
if x<cx16.r4L+0-cx16.r5L
fail_ubyte(75)
; with else
if x<cx16.r4L+0-cx16.r5L
fail_ubyte(76)
else
success++
; direct jump
if x<cx16.r4L+1-cx16.r5L
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<cx16.r4L+1-cx16.r5L
success++
; with else
if x<cx16.r4L+1-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x<cx16.r4L+255-cx16.r5L
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<cx16.r4L+255-cx16.r5L
success++
; with else
if x<cx16.r4L+255-cx16.r5L
success++
else
cx16.r0L++
x=1
; direct jump
if x<cx16.r4L+0-cx16.r5L
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(77)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(78)
skip4b:
; no else
if x<cx16.r4L+0-cx16.r5L
fail_ubyte(79)
; with else
if x<cx16.r4L+0-cx16.r5L
fail_ubyte(80)
else
success++
; direct jump
if x<cx16.r4L+1-cx16.r5L
goto lbl5a
goto skip5a
lbl5a: fail_ubyte(81)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip5b
lbl5b: fail_ubyte(82)
skip5b:
; no else
if x<cx16.r4L+1-cx16.r5L
fail_ubyte(83)
; with else
if x<cx16.r4L+1-cx16.r5L
fail_ubyte(84)
else
success++
; direct jump
if x<cx16.r4L+255-cx16.r5L
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<cx16.r4L+255-cx16.r5L
success++
; with else
if x<cx16.r4L+255-cx16.r5L
success++
else
cx16.r0L++
x=255
; direct jump
if x<cx16.r4L+0-cx16.r5L
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(85)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(86)
skip7b:
; no else
if x<cx16.r4L+0-cx16.r5L
fail_ubyte(87)
; with else
if x<cx16.r4L+0-cx16.r5L
fail_ubyte(88)
else
success++
; direct jump
if x<cx16.r4L+1-cx16.r5L
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(89)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(90)
skip8b:
; no else
if x<cx16.r4L+1-cx16.r5L
fail_ubyte(91)
; with else
if x<cx16.r4L+1-cx16.r5L
fail_ubyte(92)
else
success++
; direct jump
if x<cx16.r4L+255-cx16.r5L
goto lbl9a
goto skip9a
lbl9a: fail_ubyte(93)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip9b
lbl9b: fail_ubyte(94)
skip9b:
; no else
if x<cx16.r4L+255-cx16.r5L
fail_ubyte(95)
; with else
if x<cx16.r4L+255-cx16.r5L
fail_ubyte(96)
else
success++
verify_success(18)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,956 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
ubyte success = 0
str datatype = "ubyte"
uword @shared comparison
sub start() {
txt.print("\nless-equal tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<=number: ")
test_cmp_number()
txt.print("\n<=var: ")
test_cmp_var()
txt.print("\n<=array[]: ")
test_cmp_array()
txt.print("\n<=expr: ")
test_cmp_expr()
test_stack.test()
}
sub verify_success(ubyte expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_ub(success)
txt.print(" success, expected ")
txt.print_ub(expected)
}
}
sub fail_byte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_ubyte(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_float(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_number() {
ubyte @shared x
success = 0
x=0
; direct jump
if x<=0
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=0
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=0
success++
; with else
if x<=0
success++
else
cx16.r0L++
; direct jump
if x<=1
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=1
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=1
success++
; with else
if x<=1
success++
else
cx16.r0L++
; direct jump
if x<=255
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=255
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=255
success++
; with else
if x<=255
success++
else
cx16.r0L++
x=1
; direct jump
if x<=0
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(1)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=0
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(2)
skip4b:
; no else
if x<=0
fail_ubyte(3)
; with else
if x<=0
fail_ubyte(4)
else
success++
; direct jump
if x<=1
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=1
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=1
success++
; with else
if x<=1
success++
else
cx16.r0L++
; direct jump
if x<=255
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=255
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=255
success++
; with else
if x<=255
success++
else
cx16.r0L++
x=255
; direct jump
if x<=0
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(5)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=0
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(6)
skip7b:
; no else
if x<=0
fail_ubyte(7)
; with else
if x<=0
fail_ubyte(8)
else
success++
; direct jump
if x<=1
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(9)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=1
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(10)
skip8b:
; no else
if x<=1
fail_ubyte(11)
; with else
if x<=1
fail_ubyte(12)
else
success++
; direct jump
if x<=255
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=255
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=255
success++
; with else
if x<=255
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_var() {
ubyte @shared x, value
success = 0
x=0
value=0
; direct jump
if x<=value
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=value
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
value=1
; direct jump
if x<=value
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=value
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
value=255
; direct jump
if x<=value
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=value
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
x=1
value=0
; direct jump
if x<=value
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(13)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=value
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(14)
skip4b:
; no else
if x<=value
fail_ubyte(15)
; with else
if x<=value
fail_ubyte(16)
else
success++
value=1
; direct jump
if x<=value
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=value
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
value=255
; direct jump
if x<=value
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=value
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
x=255
value=0
; direct jump
if x<=value
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(17)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=value
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(18)
skip7b:
; no else
if x<=value
fail_ubyte(19)
; with else
if x<=value
fail_ubyte(20)
else
success++
value=1
; direct jump
if x<=value
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(21)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=value
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(22)
skip8b:
; no else
if x<=value
fail_ubyte(23)
; with else
if x<=value
fail_ubyte(24)
else
success++
value=255
; direct jump
if x<=value
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=value
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=value
success++
; with else
if x<=value
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_array() {
ubyte @shared x
ubyte[] values = [0, 0]
success = 0
x=0
values[1]=0
; direct jump
if x<=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x<=values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
values[1]=255
; direct jump
if x<=values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
x=1
values[1]=0
; direct jump
if x<=values[1]
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(25)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(26)
skip4b:
; no else
if x<=values[1]
fail_ubyte(27)
; with else
if x<=values[1]
fail_ubyte(28)
else
success++
values[1]=1
; direct jump
if x<=values[1]
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=values[1]
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
values[1]=255
; direct jump
if x<=values[1]
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=values[1]
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
x=255
values[1]=0
; direct jump
if x<=values[1]
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(29)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=values[1]
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(30)
skip7b:
; no else
if x<=values[1]
fail_ubyte(31)
; with else
if x<=values[1]
fail_ubyte(32)
else
success++
values[1]=1
; direct jump
if x<=values[1]
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(33)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=values[1]
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(34)
skip8b:
; no else
if x<=values[1]
fail_ubyte(35)
; with else
if x<=values[1]
fail_ubyte(36)
else
success++
values[1]=255
; direct jump
if x<=values[1]
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=values[1]
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
verify_success(27)
}
sub test_cmp_expr() {
ubyte @shared x
cx16.r4 = 1
cx16.r5 = 1
float @shared f4 = 1.0
float @shared f5 = 1.0
success = 0
x=0
; direct jump
if x<=cx16.r4L+0-cx16.r5L
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=cx16.r4L+0-cx16.r5L
success++
; with else
if x<=cx16.r4L+0-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x<=cx16.r4L+1-cx16.r5L
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=cx16.r4L+1-cx16.r5L
success++
; with else
if x<=cx16.r4L+1-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x<=cx16.r4L+255-cx16.r5L
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=cx16.r4L+255-cx16.r5L
success++
; with else
if x<=cx16.r4L+255-cx16.r5L
success++
else
cx16.r0L++
x=1
; direct jump
if x<=cx16.r4L+0-cx16.r5L
goto lbl4a
goto skip4a
lbl4a: fail_ubyte(37)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip4b
lbl4b: fail_ubyte(38)
skip4b:
; no else
if x<=cx16.r4L+0-cx16.r5L
fail_ubyte(39)
; with else
if x<=cx16.r4L+0-cx16.r5L
fail_ubyte(40)
else
success++
; direct jump
if x<=cx16.r4L+1-cx16.r5L
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x<=cx16.r4L+1-cx16.r5L
success++
; with else
if x<=cx16.r4L+1-cx16.r5L
success++
else
cx16.r0L++
; direct jump
if x<=cx16.r4L+255-cx16.r5L
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=cx16.r4L+255-cx16.r5L
success++
; with else
if x<=cx16.r4L+255-cx16.r5L
success++
else
cx16.r0L++
x=255
; direct jump
if x<=cx16.r4L+0-cx16.r5L
goto lbl7a
goto skip7a
lbl7a: fail_ubyte(41)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=cx16.r4L+0-cx16.r5L
goto cx16.r3
goto skip7b
lbl7b: fail_ubyte(42)
skip7b:
; no else
if x<=cx16.r4L+0-cx16.r5L
fail_ubyte(43)
; with else
if x<=cx16.r4L+0-cx16.r5L
fail_ubyte(44)
else
success++
; direct jump
if x<=cx16.r4L+1-cx16.r5L
goto lbl8a
goto skip8a
lbl8a: fail_ubyte(45)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=cx16.r4L+1-cx16.r5L
goto cx16.r3
goto skip8b
lbl8b: fail_ubyte(46)
skip8b:
; no else
if x<=cx16.r4L+1-cx16.r5L
fail_ubyte(47)
; with else
if x<=cx16.r4L+1-cx16.r5L
fail_ubyte(48)
else
success++
; direct jump
if x<=cx16.r4L+255-cx16.r5L
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=cx16.r4L+255-cx16.r5L
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x<=cx16.r4L+255-cx16.r5L
success++
; with else
if x<=cx16.r4L+255-cx16.r5L
success++
else
cx16.r0L++
verify_success(27)
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,816 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
uword success = 0
str datatype = "uword"
uword @shared comparison
sub start() {
txt.print("\ngreater-than split words array tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>array[]: ")
test_cmp_array()
test_stack.test()
}
sub verify_success(uword expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_uw(success)
txt.print(" success, expected ")
txt.print_uw(expected)
}
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_array() {
uword @shared x
uword[] @split values = [0, 0]
uword[] @split sources = [0, 0]
success = 0
x=0
sources[1]=0
values[1]=0
; direct jump
if x>values[1]
goto lbl1a
goto skip1a
lbl1a: fail_uword(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_uword(2)
skip1b:
; no else
if x>values[1]
fail_uword(3)
; with else
if x>values[1]
fail_uword(4)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl1c
goto skip1c
lbl1c: fail_uword(5)
skip1c:
; indirect jump
cx16.r3 = &lbl1d
if sources[1]>values[1]
goto cx16.r3
goto skip1d
lbl1d: fail_uword(6)
skip1d:
; no else
if sources[1]>values[1]
fail_uword(7)
; with else
if sources[1]>values[1]
fail_uword(8)
else
success++
values[1]=1
; direct jump
if x>values[1]
goto lbl2a
goto skip2a
lbl2a: fail_uword(9)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_uword(10)
skip2b:
; no else
if x>values[1]
fail_uword(11)
; with else
if x>values[1]
fail_uword(12)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl2c
goto skip2c
lbl2c: fail_uword(13)
skip2c:
; indirect jump
cx16.r3 = &lbl2d
if sources[1]>values[1]
goto cx16.r3
goto skip2d
lbl2d: fail_uword(14)
skip2d:
; no else
if sources[1]>values[1]
fail_uword(15)
; with else
if sources[1]>values[1]
fail_uword(16)
else
success++
values[1]=30464
; direct jump
if x>values[1]
goto lbl3a
goto skip3a
lbl3a: fail_uword(17)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_uword(18)
skip3b:
; no else
if x>values[1]
fail_uword(19)
; with else
if x>values[1]
fail_uword(20)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl3c
goto skip3c
lbl3c: fail_uword(21)
skip3c:
; indirect jump
cx16.r3 = &lbl3d
if sources[1]>values[1]
goto cx16.r3
goto skip3d
lbl3d: fail_uword(22)
skip3d:
; no else
if sources[1]>values[1]
fail_uword(23)
; with else
if sources[1]>values[1]
fail_uword(24)
else
success++
values[1]=65535
; direct jump
if x>values[1]
goto lbl4a
goto skip4a
lbl4a: fail_uword(25)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_uword(26)
skip4b:
; no else
if x>values[1]
fail_uword(27)
; with else
if x>values[1]
fail_uword(28)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl4c
goto skip4c
lbl4c: fail_uword(29)
skip4c:
; indirect jump
cx16.r3 = &lbl4d
if sources[1]>values[1]
goto cx16.r3
goto skip4d
lbl4d: fail_uword(30)
skip4d:
; no else
if sources[1]>values[1]
fail_uword(31)
; with else
if sources[1]>values[1]
fail_uword(32)
else
success++
x=1
sources[1]=1
values[1]=0
; direct jump
if x>values[1]
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>values[1]
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>values[1]
goto lbl5c
goto skip5c
lbl5c: success++
skip5c:
; indirect jump
cx16.r3 = &lbl5d
if sources[1]>values[1]
goto cx16.r3
goto skip5d
lbl5d: success++
skip5d:
; no else
if sources[1]>values[1]
success++
; with else
if sources[1]>values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>values[1]
goto lbl6a
goto skip6a
lbl6a: fail_uword(33)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>values[1]
goto cx16.r3
goto skip6b
lbl6b: fail_uword(34)
skip6b:
; no else
if x>values[1]
fail_uword(35)
; with else
if x>values[1]
fail_uword(36)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl6c
goto skip6c
lbl6c: fail_uword(37)
skip6c:
; indirect jump
cx16.r3 = &lbl6d
if sources[1]>values[1]
goto cx16.r3
goto skip6d
lbl6d: fail_uword(38)
skip6d:
; no else
if sources[1]>values[1]
fail_uword(39)
; with else
if sources[1]>values[1]
fail_uword(40)
else
success++
values[1]=30464
; direct jump
if x>values[1]
goto lbl7a
goto skip7a
lbl7a: fail_uword(41)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>values[1]
goto cx16.r3
goto skip7b
lbl7b: fail_uword(42)
skip7b:
; no else
if x>values[1]
fail_uword(43)
; with else
if x>values[1]
fail_uword(44)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl7c
goto skip7c
lbl7c: fail_uword(45)
skip7c:
; indirect jump
cx16.r3 = &lbl7d
if sources[1]>values[1]
goto cx16.r3
goto skip7d
lbl7d: fail_uword(46)
skip7d:
; no else
if sources[1]>values[1]
fail_uword(47)
; with else
if sources[1]>values[1]
fail_uword(48)
else
success++
values[1]=65535
; direct jump
if x>values[1]
goto lbl8a
goto skip8a
lbl8a: fail_uword(49)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>values[1]
goto cx16.r3
goto skip8b
lbl8b: fail_uword(50)
skip8b:
; no else
if x>values[1]
fail_uword(51)
; with else
if x>values[1]
fail_uword(52)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl8c
goto skip8c
lbl8c: fail_uword(53)
skip8c:
; indirect jump
cx16.r3 = &lbl8d
if sources[1]>values[1]
goto cx16.r3
goto skip8d
lbl8d: fail_uword(54)
skip8d:
; no else
if sources[1]>values[1]
fail_uword(55)
; with else
if sources[1]>values[1]
fail_uword(56)
else
success++
x=30464
sources[1]=30464
values[1]=0
; direct jump
if x>values[1]
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>values[1]
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>values[1]
goto lbl9c
goto skip9c
lbl9c: success++
skip9c:
; indirect jump
cx16.r3 = &lbl9d
if sources[1]>values[1]
goto cx16.r3
goto skip9d
lbl9d: success++
skip9d:
; no else
if sources[1]>values[1]
success++
; with else
if sources[1]>values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>values[1]
goto lbl10a
goto skip10a
lbl10a: success++
skip10a:
; indirect jump
cx16.r3 = &lbl10b
if x>values[1]
goto cx16.r3
goto skip10b
lbl10b: success++
skip10b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>values[1]
goto lbl10c
goto skip10c
lbl10c: success++
skip10c:
; indirect jump
cx16.r3 = &lbl10d
if sources[1]>values[1]
goto cx16.r3
goto skip10d
lbl10d: success++
skip10d:
; no else
if sources[1]>values[1]
success++
; with else
if sources[1]>values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x>values[1]
goto lbl11a
goto skip11a
lbl11a: fail_uword(57)
skip11a:
; indirect jump
cx16.r3 = &lbl11b
if x>values[1]
goto cx16.r3
goto skip11b
lbl11b: fail_uword(58)
skip11b:
; no else
if x>values[1]
fail_uword(59)
; with else
if x>values[1]
fail_uword(60)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl11c
goto skip11c
lbl11c: fail_uword(61)
skip11c:
; indirect jump
cx16.r3 = &lbl11d
if sources[1]>values[1]
goto cx16.r3
goto skip11d
lbl11d: fail_uword(62)
skip11d:
; no else
if sources[1]>values[1]
fail_uword(63)
; with else
if sources[1]>values[1]
fail_uword(64)
else
success++
values[1]=65535
; direct jump
if x>values[1]
goto lbl12a
goto skip12a
lbl12a: fail_uword(65)
skip12a:
; indirect jump
cx16.r3 = &lbl12b
if x>values[1]
goto cx16.r3
goto skip12b
lbl12b: fail_uword(66)
skip12b:
; no else
if x>values[1]
fail_uword(67)
; with else
if x>values[1]
fail_uword(68)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl12c
goto skip12c
lbl12c: fail_uword(69)
skip12c:
; indirect jump
cx16.r3 = &lbl12d
if sources[1]>values[1]
goto cx16.r3
goto skip12d
lbl12d: fail_uword(70)
skip12d:
; no else
if sources[1]>values[1]
fail_uword(71)
; with else
if sources[1]>values[1]
fail_uword(72)
else
success++
x=65535
sources[1]=65535
values[1]=0
; direct jump
if x>values[1]
goto lbl13a
goto skip13a
lbl13a: success++
skip13a:
; indirect jump
cx16.r3 = &lbl13b
if x>values[1]
goto cx16.r3
goto skip13b
lbl13b: success++
skip13b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>values[1]
goto lbl13c
goto skip13c
lbl13c: success++
skip13c:
; indirect jump
cx16.r3 = &lbl13d
if sources[1]>values[1]
goto cx16.r3
goto skip13d
lbl13d: success++
skip13d:
; no else
if sources[1]>values[1]
success++
; with else
if sources[1]>values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>values[1]
goto lbl14a
goto skip14a
lbl14a: success++
skip14a:
; indirect jump
cx16.r3 = &lbl14b
if x>values[1]
goto cx16.r3
goto skip14b
lbl14b: success++
skip14b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>values[1]
goto lbl14c
goto skip14c
lbl14c: success++
skip14c:
; indirect jump
cx16.r3 = &lbl14d
if sources[1]>values[1]
goto cx16.r3
goto skip14d
lbl14d: success++
skip14d:
; no else
if sources[1]>values[1]
success++
; with else
if sources[1]>values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x>values[1]
goto lbl15a
goto skip15a
lbl15a: success++
skip15a:
; indirect jump
cx16.r3 = &lbl15b
if x>values[1]
goto cx16.r3
goto skip15b
lbl15b: success++
skip15b:
; no else
if x>values[1]
success++
; with else
if x>values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>values[1]
goto lbl15c
goto skip15c
lbl15c: success++
skip15c:
; indirect jump
cx16.r3 = &lbl15d
if sources[1]>values[1]
goto cx16.r3
goto skip15d
lbl15d: success++
skip15d:
; no else
if sources[1]>values[1]
success++
; with else
if sources[1]>values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x>values[1]
goto lbl16a
goto skip16a
lbl16a: fail_uword(73)
skip16a:
; indirect jump
cx16.r3 = &lbl16b
if x>values[1]
goto cx16.r3
goto skip16b
lbl16b: fail_uword(74)
skip16b:
; no else
if x>values[1]
fail_uword(75)
; with else
if x>values[1]
fail_uword(76)
else
success++
; direct jump
if sources[1]>values[1]
goto lbl16c
goto skip16c
lbl16c: fail_uword(77)
skip16c:
; indirect jump
cx16.r3 = &lbl16d
if sources[1]>values[1]
goto cx16.r3
goto skip16d
lbl16d: fail_uword(78)
skip16d:
; no else
if sources[1]>values[1]
fail_uword(79)
; with else
if sources[1]>values[1]
fail_uword(80)
else
success++
verify_success(68)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,816 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
uword success = 0
str datatype = "uword"
uword @shared comparison
sub start() {
txt.print("\ngreater-equal split words array tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n>=array[]: ")
test_cmp_array()
test_stack.test()
}
sub verify_success(uword expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_uw(success)
txt.print(" success, expected ")
txt.print_uw(expected)
}
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_array() {
uword @shared x
uword[] @split values = [0, 0]
uword[] @split sources = [0, 0]
success = 0
x=0
sources[1]=0
values[1]=0
; direct jump
if x>=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x>=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl1c
goto skip1c
lbl1c: success++
skip1c:
; indirect jump
cx16.r3 = &lbl1d
if sources[1]>=values[1]
goto cx16.r3
goto skip1d
lbl1d: success++
skip1d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl2a
goto skip2a
lbl2a: fail_uword(1)
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x>=values[1]
goto cx16.r3
goto skip2b
lbl2b: fail_uword(2)
skip2b:
; no else
if x>=values[1]
fail_uword(3)
; with else
if x>=values[1]
fail_uword(4)
else
success++
; direct jump
if sources[1]>=values[1]
goto lbl2c
goto skip2c
lbl2c: fail_uword(5)
skip2c:
; indirect jump
cx16.r3 = &lbl2d
if sources[1]>=values[1]
goto cx16.r3
goto skip2d
lbl2d: fail_uword(6)
skip2d:
; no else
if sources[1]>=values[1]
fail_uword(7)
; with else
if sources[1]>=values[1]
fail_uword(8)
else
success++
values[1]=30464
; direct jump
if x>=values[1]
goto lbl3a
goto skip3a
lbl3a: fail_uword(9)
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x>=values[1]
goto cx16.r3
goto skip3b
lbl3b: fail_uword(10)
skip3b:
; no else
if x>=values[1]
fail_uword(11)
; with else
if x>=values[1]
fail_uword(12)
else
success++
; direct jump
if sources[1]>=values[1]
goto lbl3c
goto skip3c
lbl3c: fail_uword(13)
skip3c:
; indirect jump
cx16.r3 = &lbl3d
if sources[1]>=values[1]
goto cx16.r3
goto skip3d
lbl3d: fail_uword(14)
skip3d:
; no else
if sources[1]>=values[1]
fail_uword(15)
; with else
if sources[1]>=values[1]
fail_uword(16)
else
success++
values[1]=65535
; direct jump
if x>=values[1]
goto lbl4a
goto skip4a
lbl4a: fail_uword(17)
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x>=values[1]
goto cx16.r3
goto skip4b
lbl4b: fail_uword(18)
skip4b:
; no else
if x>=values[1]
fail_uword(19)
; with else
if x>=values[1]
fail_uword(20)
else
success++
; direct jump
if sources[1]>=values[1]
goto lbl4c
goto skip4c
lbl4c: fail_uword(21)
skip4c:
; indirect jump
cx16.r3 = &lbl4d
if sources[1]>=values[1]
goto cx16.r3
goto skip4d
lbl4d: fail_uword(22)
skip4d:
; no else
if sources[1]>=values[1]
fail_uword(23)
; with else
if sources[1]>=values[1]
fail_uword(24)
else
success++
x=1
sources[1]=1
values[1]=0
; direct jump
if x>=values[1]
goto lbl5a
goto skip5a
lbl5a: success++
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x>=values[1]
goto cx16.r3
goto skip5b
lbl5b: success++
skip5b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl5c
goto skip5c
lbl5c: success++
skip5c:
; indirect jump
cx16.r3 = &lbl5d
if sources[1]>=values[1]
goto cx16.r3
goto skip5d
lbl5d: success++
skip5d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x>=values[1]
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl6c
goto skip6c
lbl6c: success++
skip6c:
; indirect jump
cx16.r3 = &lbl6d
if sources[1]>=values[1]
goto cx16.r3
goto skip6d
lbl6d: success++
skip6d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x>=values[1]
goto lbl7a
goto skip7a
lbl7a: fail_uword(25)
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x>=values[1]
goto cx16.r3
goto skip7b
lbl7b: fail_uword(26)
skip7b:
; no else
if x>=values[1]
fail_uword(27)
; with else
if x>=values[1]
fail_uword(28)
else
success++
; direct jump
if sources[1]>=values[1]
goto lbl7c
goto skip7c
lbl7c: fail_uword(29)
skip7c:
; indirect jump
cx16.r3 = &lbl7d
if sources[1]>=values[1]
goto cx16.r3
goto skip7d
lbl7d: fail_uword(30)
skip7d:
; no else
if sources[1]>=values[1]
fail_uword(31)
; with else
if sources[1]>=values[1]
fail_uword(32)
else
success++
values[1]=65535
; direct jump
if x>=values[1]
goto lbl8a
goto skip8a
lbl8a: fail_uword(33)
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x>=values[1]
goto cx16.r3
goto skip8b
lbl8b: fail_uword(34)
skip8b:
; no else
if x>=values[1]
fail_uword(35)
; with else
if x>=values[1]
fail_uword(36)
else
success++
; direct jump
if sources[1]>=values[1]
goto lbl8c
goto skip8c
lbl8c: fail_uword(37)
skip8c:
; indirect jump
cx16.r3 = &lbl8d
if sources[1]>=values[1]
goto cx16.r3
goto skip8d
lbl8d: fail_uword(38)
skip8d:
; no else
if sources[1]>=values[1]
fail_uword(39)
; with else
if sources[1]>=values[1]
fail_uword(40)
else
success++
x=30464
sources[1]=30464
values[1]=0
; direct jump
if x>=values[1]
goto lbl9a
goto skip9a
lbl9a: success++
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x>=values[1]
goto cx16.r3
goto skip9b
lbl9b: success++
skip9b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl9c
goto skip9c
lbl9c: success++
skip9c:
; indirect jump
cx16.r3 = &lbl9d
if sources[1]>=values[1]
goto cx16.r3
goto skip9d
lbl9d: success++
skip9d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl10a
goto skip10a
lbl10a: success++
skip10a:
; indirect jump
cx16.r3 = &lbl10b
if x>=values[1]
goto cx16.r3
goto skip10b
lbl10b: success++
skip10b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl10c
goto skip10c
lbl10c: success++
skip10c:
; indirect jump
cx16.r3 = &lbl10d
if sources[1]>=values[1]
goto cx16.r3
goto skip10d
lbl10d: success++
skip10d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x>=values[1]
goto lbl11a
goto skip11a
lbl11a: success++
skip11a:
; indirect jump
cx16.r3 = &lbl11b
if x>=values[1]
goto cx16.r3
goto skip11b
lbl11b: success++
skip11b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl11c
goto skip11c
lbl11c: success++
skip11c:
; indirect jump
cx16.r3 = &lbl11d
if sources[1]>=values[1]
goto cx16.r3
goto skip11d
lbl11d: success++
skip11d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x>=values[1]
goto lbl12a
goto skip12a
lbl12a: fail_uword(41)
skip12a:
; indirect jump
cx16.r3 = &lbl12b
if x>=values[1]
goto cx16.r3
goto skip12b
lbl12b: fail_uword(42)
skip12b:
; no else
if x>=values[1]
fail_uword(43)
; with else
if x>=values[1]
fail_uword(44)
else
success++
; direct jump
if sources[1]>=values[1]
goto lbl12c
goto skip12c
lbl12c: fail_uword(45)
skip12c:
; indirect jump
cx16.r3 = &lbl12d
if sources[1]>=values[1]
goto cx16.r3
goto skip12d
lbl12d: fail_uword(46)
skip12d:
; no else
if sources[1]>=values[1]
fail_uword(47)
; with else
if sources[1]>=values[1]
fail_uword(48)
else
success++
x=65535
sources[1]=65535
values[1]=0
; direct jump
if x>=values[1]
goto lbl13a
goto skip13a
lbl13a: success++
skip13a:
; indirect jump
cx16.r3 = &lbl13b
if x>=values[1]
goto cx16.r3
goto skip13b
lbl13b: success++
skip13b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl13c
goto skip13c
lbl13c: success++
skip13c:
; indirect jump
cx16.r3 = &lbl13d
if sources[1]>=values[1]
goto cx16.r3
goto skip13d
lbl13d: success++
skip13d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x>=values[1]
goto lbl14a
goto skip14a
lbl14a: success++
skip14a:
; indirect jump
cx16.r3 = &lbl14b
if x>=values[1]
goto cx16.r3
goto skip14b
lbl14b: success++
skip14b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl14c
goto skip14c
lbl14c: success++
skip14c:
; indirect jump
cx16.r3 = &lbl14d
if sources[1]>=values[1]
goto cx16.r3
goto skip14d
lbl14d: success++
skip14d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x>=values[1]
goto lbl15a
goto skip15a
lbl15a: success++
skip15a:
; indirect jump
cx16.r3 = &lbl15b
if x>=values[1]
goto cx16.r3
goto skip15b
lbl15b: success++
skip15b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl15c
goto skip15c
lbl15c: success++
skip15c:
; indirect jump
cx16.r3 = &lbl15d
if sources[1]>=values[1]
goto cx16.r3
goto skip15d
lbl15d: success++
skip15d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x>=values[1]
goto lbl16a
goto skip16a
lbl16a: success++
skip16a:
; indirect jump
cx16.r3 = &lbl16b
if x>=values[1]
goto cx16.r3
goto skip16b
lbl16b: success++
skip16b:
; no else
if x>=values[1]
success++
; with else
if x>=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]>=values[1]
goto lbl16c
goto skip16c
lbl16c: success++
skip16c:
; indirect jump
cx16.r3 = &lbl16d
if sources[1]>=values[1]
goto cx16.r3
goto skip16d
lbl16d: success++
skip16d:
; no else
if sources[1]>=values[1]
success++
; with else
if sources[1]>=values[1]
success++
else
cx16.r0L++
verify_success(92)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,816 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
uword success = 0
str datatype = "uword"
uword @shared comparison
sub start() {
txt.print("\nless-than split words array tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<array[]: ")
test_cmp_array()
test_stack.test()
}
sub verify_success(uword expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_uw(success)
txt.print(" success, expected ")
txt.print_uw(expected)
}
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_array() {
uword @shared x
uword[] @split values = [0, 0]
uword[] @split sources = [0, 0]
success = 0
x=0
sources[1]=0
values[1]=0
; direct jump
if x<values[1]
goto lbl1a
goto skip1a
lbl1a: fail_uword(1)
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<values[1]
goto cx16.r3
goto skip1b
lbl1b: fail_uword(2)
skip1b:
; no else
if x<values[1]
fail_uword(3)
; with else
if x<values[1]
fail_uword(4)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl1c
goto skip1c
lbl1c: fail_uword(5)
skip1c:
; indirect jump
cx16.r3 = &lbl1d
if sources[1]<values[1]
goto cx16.r3
goto skip1d
lbl1d: fail_uword(6)
skip1d:
; no else
if sources[1]<values[1]
fail_uword(7)
; with else
if sources[1]<values[1]
fail_uword(8)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<values[1]
goto lbl2c
goto skip2c
lbl2c: success++
skip2c:
; indirect jump
cx16.r3 = &lbl2d
if sources[1]<values[1]
goto cx16.r3
goto skip2d
lbl2d: success++
skip2d:
; no else
if sources[1]<values[1]
success++
; with else
if sources[1]<values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x<values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<values[1]
goto lbl3c
goto skip3c
lbl3c: success++
skip3c:
; indirect jump
cx16.r3 = &lbl3d
if sources[1]<values[1]
goto cx16.r3
goto skip3d
lbl3d: success++
skip3d:
; no else
if sources[1]<values[1]
success++
; with else
if sources[1]<values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x<values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<values[1]
goto lbl4c
goto skip4c
lbl4c: success++
skip4c:
; indirect jump
cx16.r3 = &lbl4d
if sources[1]<values[1]
goto cx16.r3
goto skip4d
lbl4d: success++
skip4d:
; no else
if sources[1]<values[1]
success++
; with else
if sources[1]<values[1]
success++
else
cx16.r0L++
x=1
sources[1]=1
values[1]=0
; direct jump
if x<values[1]
goto lbl5a
goto skip5a
lbl5a: fail_uword(9)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<values[1]
goto cx16.r3
goto skip5b
lbl5b: fail_uword(10)
skip5b:
; no else
if x<values[1]
fail_uword(11)
; with else
if x<values[1]
fail_uword(12)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl5c
goto skip5c
lbl5c: fail_uword(13)
skip5c:
; indirect jump
cx16.r3 = &lbl5d
if sources[1]<values[1]
goto cx16.r3
goto skip5d
lbl5d: fail_uword(14)
skip5d:
; no else
if sources[1]<values[1]
fail_uword(15)
; with else
if sources[1]<values[1]
fail_uword(16)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl6a
goto skip6a
lbl6a: fail_uword(17)
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<values[1]
goto cx16.r3
goto skip6b
lbl6b: fail_uword(18)
skip6b:
; no else
if x<values[1]
fail_uword(19)
; with else
if x<values[1]
fail_uword(20)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl6c
goto skip6c
lbl6c: fail_uword(21)
skip6c:
; indirect jump
cx16.r3 = &lbl6d
if sources[1]<values[1]
goto cx16.r3
goto skip6d
lbl6d: fail_uword(22)
skip6d:
; no else
if sources[1]<values[1]
fail_uword(23)
; with else
if sources[1]<values[1]
fail_uword(24)
else
success++
values[1]=30464
; direct jump
if x<values[1]
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<values[1]
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<values[1]
goto lbl7c
goto skip7c
lbl7c: success++
skip7c:
; indirect jump
cx16.r3 = &lbl7d
if sources[1]<values[1]
goto cx16.r3
goto skip7d
lbl7d: success++
skip7d:
; no else
if sources[1]<values[1]
success++
; with else
if sources[1]<values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x<values[1]
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<values[1]
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<values[1]
goto lbl8c
goto skip8c
lbl8c: success++
skip8c:
; indirect jump
cx16.r3 = &lbl8d
if sources[1]<values[1]
goto cx16.r3
goto skip8d
lbl8d: success++
skip8d:
; no else
if sources[1]<values[1]
success++
; with else
if sources[1]<values[1]
success++
else
cx16.r0L++
x=30464
sources[1]=30464
values[1]=0
; direct jump
if x<values[1]
goto lbl9a
goto skip9a
lbl9a: fail_uword(25)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<values[1]
goto cx16.r3
goto skip9b
lbl9b: fail_uword(26)
skip9b:
; no else
if x<values[1]
fail_uword(27)
; with else
if x<values[1]
fail_uword(28)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl9c
goto skip9c
lbl9c: fail_uword(29)
skip9c:
; indirect jump
cx16.r3 = &lbl9d
if sources[1]<values[1]
goto cx16.r3
goto skip9d
lbl9d: fail_uword(30)
skip9d:
; no else
if sources[1]<values[1]
fail_uword(31)
; with else
if sources[1]<values[1]
fail_uword(32)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl10a
goto skip10a
lbl10a: fail_uword(33)
skip10a:
; indirect jump
cx16.r3 = &lbl10b
if x<values[1]
goto cx16.r3
goto skip10b
lbl10b: fail_uword(34)
skip10b:
; no else
if x<values[1]
fail_uword(35)
; with else
if x<values[1]
fail_uword(36)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl10c
goto skip10c
lbl10c: fail_uword(37)
skip10c:
; indirect jump
cx16.r3 = &lbl10d
if sources[1]<values[1]
goto cx16.r3
goto skip10d
lbl10d: fail_uword(38)
skip10d:
; no else
if sources[1]<values[1]
fail_uword(39)
; with else
if sources[1]<values[1]
fail_uword(40)
else
success++
values[1]=30464
; direct jump
if x<values[1]
goto lbl11a
goto skip11a
lbl11a: fail_uword(41)
skip11a:
; indirect jump
cx16.r3 = &lbl11b
if x<values[1]
goto cx16.r3
goto skip11b
lbl11b: fail_uword(42)
skip11b:
; no else
if x<values[1]
fail_uword(43)
; with else
if x<values[1]
fail_uword(44)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl11c
goto skip11c
lbl11c: fail_uword(45)
skip11c:
; indirect jump
cx16.r3 = &lbl11d
if sources[1]<values[1]
goto cx16.r3
goto skip11d
lbl11d: fail_uword(46)
skip11d:
; no else
if sources[1]<values[1]
fail_uword(47)
; with else
if sources[1]<values[1]
fail_uword(48)
else
success++
values[1]=65535
; direct jump
if x<values[1]
goto lbl12a
goto skip12a
lbl12a: success++
skip12a:
; indirect jump
cx16.r3 = &lbl12b
if x<values[1]
goto cx16.r3
goto skip12b
lbl12b: success++
skip12b:
; no else
if x<values[1]
success++
; with else
if x<values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<values[1]
goto lbl12c
goto skip12c
lbl12c: success++
skip12c:
; indirect jump
cx16.r3 = &lbl12d
if sources[1]<values[1]
goto cx16.r3
goto skip12d
lbl12d: success++
skip12d:
; no else
if sources[1]<values[1]
success++
; with else
if sources[1]<values[1]
success++
else
cx16.r0L++
x=65535
sources[1]=65535
values[1]=0
; direct jump
if x<values[1]
goto lbl13a
goto skip13a
lbl13a: fail_uword(49)
skip13a:
; indirect jump
cx16.r3 = &lbl13b
if x<values[1]
goto cx16.r3
goto skip13b
lbl13b: fail_uword(50)
skip13b:
; no else
if x<values[1]
fail_uword(51)
; with else
if x<values[1]
fail_uword(52)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl13c
goto skip13c
lbl13c: fail_uword(53)
skip13c:
; indirect jump
cx16.r3 = &lbl13d
if sources[1]<values[1]
goto cx16.r3
goto skip13d
lbl13d: fail_uword(54)
skip13d:
; no else
if sources[1]<values[1]
fail_uword(55)
; with else
if sources[1]<values[1]
fail_uword(56)
else
success++
values[1]=1
; direct jump
if x<values[1]
goto lbl14a
goto skip14a
lbl14a: fail_uword(57)
skip14a:
; indirect jump
cx16.r3 = &lbl14b
if x<values[1]
goto cx16.r3
goto skip14b
lbl14b: fail_uword(58)
skip14b:
; no else
if x<values[1]
fail_uword(59)
; with else
if x<values[1]
fail_uword(60)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl14c
goto skip14c
lbl14c: fail_uword(61)
skip14c:
; indirect jump
cx16.r3 = &lbl14d
if sources[1]<values[1]
goto cx16.r3
goto skip14d
lbl14d: fail_uword(62)
skip14d:
; no else
if sources[1]<values[1]
fail_uword(63)
; with else
if sources[1]<values[1]
fail_uword(64)
else
success++
values[1]=30464
; direct jump
if x<values[1]
goto lbl15a
goto skip15a
lbl15a: fail_uword(65)
skip15a:
; indirect jump
cx16.r3 = &lbl15b
if x<values[1]
goto cx16.r3
goto skip15b
lbl15b: fail_uword(66)
skip15b:
; no else
if x<values[1]
fail_uword(67)
; with else
if x<values[1]
fail_uword(68)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl15c
goto skip15c
lbl15c: fail_uword(69)
skip15c:
; indirect jump
cx16.r3 = &lbl15d
if sources[1]<values[1]
goto cx16.r3
goto skip15d
lbl15d: fail_uword(70)
skip15d:
; no else
if sources[1]<values[1]
fail_uword(71)
; with else
if sources[1]<values[1]
fail_uword(72)
else
success++
values[1]=65535
; direct jump
if x<values[1]
goto lbl16a
goto skip16a
lbl16a: fail_uword(73)
skip16a:
; indirect jump
cx16.r3 = &lbl16b
if x<values[1]
goto cx16.r3
goto skip16b
lbl16b: fail_uword(74)
skip16b:
; no else
if x<values[1]
fail_uword(75)
; with else
if x<values[1]
fail_uword(76)
else
success++
; direct jump
if sources[1]<values[1]
goto lbl16c
goto skip16c
lbl16c: fail_uword(77)
skip16c:
; indirect jump
cx16.r3 = &lbl16d
if sources[1]<values[1]
goto cx16.r3
goto skip16d
lbl16d: fail_uword(78)
skip16d:
; no else
if sources[1]<values[1]
fail_uword(79)
; with else
if sources[1]<values[1]
fail_uword(80)
else
success++
verify_success(68)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,816 +0,0 @@
%import textio
%import floats
%import test_stack
%zeropage dontuse
%option no_sysinit
main {
uword success = 0
str datatype = "uword"
uword @shared comparison
sub start() {
txt.print("\nless-equal split words array tests for: ")
txt.print(datatype)
txt.nl()
test_stack.test()
txt.print("\n<=array[]: ")
test_cmp_array()
test_stack.test()
}
sub verify_success(uword expected) {
if success==expected {
txt.print("ok")
} else {
txt.print(" **failed** ")
txt.print_uw(success)
txt.print(" success, expected ")
txt.print_uw(expected)
}
}
sub fail_word(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub fail_uword(uword idx) {
txt.print(" **fail#")
txt.print_uw(idx)
txt.print(" **")
}
sub test_cmp_array() {
uword @shared x
uword[] @split values = [0, 0]
uword[] @split sources = [0, 0]
success = 0
x=0
sources[1]=0
values[1]=0
; direct jump
if x<=values[1]
goto lbl1a
goto skip1a
lbl1a: success++
skip1a:
; indirect jump
cx16.r3 = &lbl1b
if x<=values[1]
goto cx16.r3
goto skip1b
lbl1b: success++
skip1b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl1c
goto skip1c
lbl1c: success++
skip1c:
; indirect jump
cx16.r3 = &lbl1d
if sources[1]<=values[1]
goto cx16.r3
goto skip1d
lbl1d: success++
skip1d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
values[1]=1
; direct jump
if x<=values[1]
goto lbl2a
goto skip2a
lbl2a: success++
skip2a:
; indirect jump
cx16.r3 = &lbl2b
if x<=values[1]
goto cx16.r3
goto skip2b
lbl2b: success++
skip2b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl2c
goto skip2c
lbl2c: success++
skip2c:
; indirect jump
cx16.r3 = &lbl2d
if sources[1]<=values[1]
goto cx16.r3
goto skip2d
lbl2d: success++
skip2d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x<=values[1]
goto lbl3a
goto skip3a
lbl3a: success++
skip3a:
; indirect jump
cx16.r3 = &lbl3b
if x<=values[1]
goto cx16.r3
goto skip3b
lbl3b: success++
skip3b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl3c
goto skip3c
lbl3c: success++
skip3c:
; indirect jump
cx16.r3 = &lbl3d
if sources[1]<=values[1]
goto cx16.r3
goto skip3d
lbl3d: success++
skip3d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x<=values[1]
goto lbl4a
goto skip4a
lbl4a: success++
skip4a:
; indirect jump
cx16.r3 = &lbl4b
if x<=values[1]
goto cx16.r3
goto skip4b
lbl4b: success++
skip4b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl4c
goto skip4c
lbl4c: success++
skip4c:
; indirect jump
cx16.r3 = &lbl4d
if sources[1]<=values[1]
goto cx16.r3
goto skip4d
lbl4d: success++
skip4d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
x=1
sources[1]=1
values[1]=0
; direct jump
if x<=values[1]
goto lbl5a
goto skip5a
lbl5a: fail_uword(1)
skip5a:
; indirect jump
cx16.r3 = &lbl5b
if x<=values[1]
goto cx16.r3
goto skip5b
lbl5b: fail_uword(2)
skip5b:
; no else
if x<=values[1]
fail_uword(3)
; with else
if x<=values[1]
fail_uword(4)
else
success++
; direct jump
if sources[1]<=values[1]
goto lbl5c
goto skip5c
lbl5c: fail_uword(5)
skip5c:
; indirect jump
cx16.r3 = &lbl5d
if sources[1]<=values[1]
goto cx16.r3
goto skip5d
lbl5d: fail_uword(6)
skip5d:
; no else
if sources[1]<=values[1]
fail_uword(7)
; with else
if sources[1]<=values[1]
fail_uword(8)
else
success++
values[1]=1
; direct jump
if x<=values[1]
goto lbl6a
goto skip6a
lbl6a: success++
skip6a:
; indirect jump
cx16.r3 = &lbl6b
if x<=values[1]
goto cx16.r3
goto skip6b
lbl6b: success++
skip6b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl6c
goto skip6c
lbl6c: success++
skip6c:
; indirect jump
cx16.r3 = &lbl6d
if sources[1]<=values[1]
goto cx16.r3
goto skip6d
lbl6d: success++
skip6d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
values[1]=30464
; direct jump
if x<=values[1]
goto lbl7a
goto skip7a
lbl7a: success++
skip7a:
; indirect jump
cx16.r3 = &lbl7b
if x<=values[1]
goto cx16.r3
goto skip7b
lbl7b: success++
skip7b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl7c
goto skip7c
lbl7c: success++
skip7c:
; indirect jump
cx16.r3 = &lbl7d
if sources[1]<=values[1]
goto cx16.r3
goto skip7d
lbl7d: success++
skip7d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x<=values[1]
goto lbl8a
goto skip8a
lbl8a: success++
skip8a:
; indirect jump
cx16.r3 = &lbl8b
if x<=values[1]
goto cx16.r3
goto skip8b
lbl8b: success++
skip8b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl8c
goto skip8c
lbl8c: success++
skip8c:
; indirect jump
cx16.r3 = &lbl8d
if sources[1]<=values[1]
goto cx16.r3
goto skip8d
lbl8d: success++
skip8d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
x=30464
sources[1]=30464
values[1]=0
; direct jump
if x<=values[1]
goto lbl9a
goto skip9a
lbl9a: fail_uword(9)
skip9a:
; indirect jump
cx16.r3 = &lbl9b
if x<=values[1]
goto cx16.r3
goto skip9b
lbl9b: fail_uword(10)
skip9b:
; no else
if x<=values[1]
fail_uword(11)
; with else
if x<=values[1]
fail_uword(12)
else
success++
; direct jump
if sources[1]<=values[1]
goto lbl9c
goto skip9c
lbl9c: fail_uword(13)
skip9c:
; indirect jump
cx16.r3 = &lbl9d
if sources[1]<=values[1]
goto cx16.r3
goto skip9d
lbl9d: fail_uword(14)
skip9d:
; no else
if sources[1]<=values[1]
fail_uword(15)
; with else
if sources[1]<=values[1]
fail_uword(16)
else
success++
values[1]=1
; direct jump
if x<=values[1]
goto lbl10a
goto skip10a
lbl10a: fail_uword(17)
skip10a:
; indirect jump
cx16.r3 = &lbl10b
if x<=values[1]
goto cx16.r3
goto skip10b
lbl10b: fail_uword(18)
skip10b:
; no else
if x<=values[1]
fail_uword(19)
; with else
if x<=values[1]
fail_uword(20)
else
success++
; direct jump
if sources[1]<=values[1]
goto lbl10c
goto skip10c
lbl10c: fail_uword(21)
skip10c:
; indirect jump
cx16.r3 = &lbl10d
if sources[1]<=values[1]
goto cx16.r3
goto skip10d
lbl10d: fail_uword(22)
skip10d:
; no else
if sources[1]<=values[1]
fail_uword(23)
; with else
if sources[1]<=values[1]
fail_uword(24)
else
success++
values[1]=30464
; direct jump
if x<=values[1]
goto lbl11a
goto skip11a
lbl11a: success++
skip11a:
; indirect jump
cx16.r3 = &lbl11b
if x<=values[1]
goto cx16.r3
goto skip11b
lbl11b: success++
skip11b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl11c
goto skip11c
lbl11c: success++
skip11c:
; indirect jump
cx16.r3 = &lbl11d
if sources[1]<=values[1]
goto cx16.r3
goto skip11d
lbl11d: success++
skip11d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
values[1]=65535
; direct jump
if x<=values[1]
goto lbl12a
goto skip12a
lbl12a: success++
skip12a:
; indirect jump
cx16.r3 = &lbl12b
if x<=values[1]
goto cx16.r3
goto skip12b
lbl12b: success++
skip12b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl12c
goto skip12c
lbl12c: success++
skip12c:
; indirect jump
cx16.r3 = &lbl12d
if sources[1]<=values[1]
goto cx16.r3
goto skip12d
lbl12d: success++
skip12d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
x=65535
sources[1]=65535
values[1]=0
; direct jump
if x<=values[1]
goto lbl13a
goto skip13a
lbl13a: fail_uword(25)
skip13a:
; indirect jump
cx16.r3 = &lbl13b
if x<=values[1]
goto cx16.r3
goto skip13b
lbl13b: fail_uword(26)
skip13b:
; no else
if x<=values[1]
fail_uword(27)
; with else
if x<=values[1]
fail_uword(28)
else
success++
; direct jump
if sources[1]<=values[1]
goto lbl13c
goto skip13c
lbl13c: fail_uword(29)
skip13c:
; indirect jump
cx16.r3 = &lbl13d
if sources[1]<=values[1]
goto cx16.r3
goto skip13d
lbl13d: fail_uword(30)
skip13d:
; no else
if sources[1]<=values[1]
fail_uword(31)
; with else
if sources[1]<=values[1]
fail_uword(32)
else
success++
values[1]=1
; direct jump
if x<=values[1]
goto lbl14a
goto skip14a
lbl14a: fail_uword(33)
skip14a:
; indirect jump
cx16.r3 = &lbl14b
if x<=values[1]
goto cx16.r3
goto skip14b
lbl14b: fail_uword(34)
skip14b:
; no else
if x<=values[1]
fail_uword(35)
; with else
if x<=values[1]
fail_uword(36)
else
success++
; direct jump
if sources[1]<=values[1]
goto lbl14c
goto skip14c
lbl14c: fail_uword(37)
skip14c:
; indirect jump
cx16.r3 = &lbl14d
if sources[1]<=values[1]
goto cx16.r3
goto skip14d
lbl14d: fail_uword(38)
skip14d:
; no else
if sources[1]<=values[1]
fail_uword(39)
; with else
if sources[1]<=values[1]
fail_uword(40)
else
success++
values[1]=30464
; direct jump
if x<=values[1]
goto lbl15a
goto skip15a
lbl15a: fail_uword(41)
skip15a:
; indirect jump
cx16.r3 = &lbl15b
if x<=values[1]
goto cx16.r3
goto skip15b
lbl15b: fail_uword(42)
skip15b:
; no else
if x<=values[1]
fail_uword(43)
; with else
if x<=values[1]
fail_uword(44)
else
success++
; direct jump
if sources[1]<=values[1]
goto lbl15c
goto skip15c
lbl15c: fail_uword(45)
skip15c:
; indirect jump
cx16.r3 = &lbl15d
if sources[1]<=values[1]
goto cx16.r3
goto skip15d
lbl15d: fail_uword(46)
skip15d:
; no else
if sources[1]<=values[1]
fail_uword(47)
; with else
if sources[1]<=values[1]
fail_uword(48)
else
success++
values[1]=65535
; direct jump
if x<=values[1]
goto lbl16a
goto skip16a
lbl16a: success++
skip16a:
; indirect jump
cx16.r3 = &lbl16b
if x<=values[1]
goto cx16.r3
goto skip16b
lbl16b: success++
skip16b:
; no else
if x<=values[1]
success++
; with else
if x<=values[1]
success++
else
cx16.r0L++
; direct jump
if sources[1]<=values[1]
goto lbl16c
goto skip16c
lbl16c: success++
skip16c:
; indirect jump
cx16.r3 = &lbl16d
if sources[1]<=values[1]
goto cx16.r3
goto skip16d
lbl16d: success++
skip16d:
; no else
if sources[1]<=values[1]
success++
; with else
if sources[1]<=values[1]
success++
else
cx16.r0L++
verify_success(92)
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -501,32 +501,40 @@ but perhaps the provided ones can be of service too.
Do not use zeros for the seed!
``sin8u (x)``
Fast 8-bit ubyte sine of angle 0..255, result is in range 0..255
Fast 8-bit ubyte sine.
x = angle 0...2π scaled as 0...255. Result is unigned, scaled as 0...255
``sin8 (x)``
Fast 8-bit byte sine of angle 0..255, result is in range -127..127
Fast 8-bit byte sine.
x = angle 0...2π scaled as 0...255. Result is signed, scaled as -127...127
``sinr8u (x)``
Fast 8-bit ubyte sine of angle 0..179 (each is a 2 degree step), result is in range 0..255
Angles 180..255 will yield a garbage result!
Fast 8-bit ubyte sine.
x = angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is unsigned, scaled as 0...255.
Input values 180...255 lie outside of the valid input interval and will yield a garbage result!
``sinr8 (x)``
Fast 8-bit byte sine of angle 0..179 (each is a 2 degree step), result is in range -127..127
Angles 180..255 will yield a garbage result!
Fast 8-bit byte sine.
x = angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is signed, scaled as -127...127.
Input values 180...255 lie outside of the valid input interval and will yield a garbage result!
``cos8u (x)``
Fast 8-bit ubyte cosine of angle 0..255, result is in range 0..255
Fast 8-bit ubyte cosine.
x = angle 0...2π scaled as 0...255. Result is unsigned, scaled as 0...255
``cos8 (x)``
Fast 8-bit byte cosine of angle 0..255, result is in range -127..127
Fast 8-bit byte cosine.
x = angle 0...2π scaled as 0...255. Result is signed, scaled as -127...127
``cosr8u (x)``
Fast 8-bit ubyte cosine of angle 0..179 (each is a 2 degree step), result is in range 0..255
Angles 180..255 will yield a garbage result!
Fast 8-bit ubyte cosine.
x = angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is unsigned, scaled as 0...255.
Input values 180...255 lie outside of the valid input interval and will yield a garbage result!
``cosr8 (x)``
Fast 8-bit byte cosine of angle 0..179 (each is a 2 degree step), result is in range -127..127
Angles 180..255 will yield a garbage result!
Fast 8-bit byte cosine.
x = of angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is signed, scaled as -127...127.
Input values 180...255 lie outside of the valid input interval and will yield a garbage result!
``atan2 (ubyte x1, ubyte y1, ubyte x2, ubyte y2)``
Fast arctan routine that uses more memory because of large lookup tables.