fix some deprecated code in tests

silence redundant error about unused txt block
This commit is contained in:
Irmen de Jong 2024-11-23 13:22:19 +01:00
parent cc13a51493
commit 42e2c5f605
7 changed files with 49 additions and 60 deletions

View File

@ -1,13 +1,13 @@
sys {
%option merge ; add some constants to sys
%option merge, ignore_unused ; add some constants to sys
const float MAX_FLOAT = 1.7014118345e+38 ; bytes: 255,127,255,255,255
const float MIN_FLOAT = -1.7014118345e+38 ; bytes: 255,255,255,255,255
}
txt {
%option merge ; add function to txt
%option merge, ignore_unused ; add function to txt
alias print_f = floats.print
}

View File

@ -1,6 +1,7 @@
%import floats
%import textio
%import string
%import anyall
%zeropage basicsafe
main {
@ -30,44 +31,38 @@ main {
if length!=3 txt.print("error strlen2\n")
; ANY
ub = any(ubarr) as ubyte
ub = anyall.any(ubarr, len(ubarr)) as ubyte
if ub==0 txt.print("error any1\n")
ub = any(barr) as ubyte
ub = anyall.any(barr, len(barr)) as ubyte
if ub==0 txt.print("error any2\n")
ub = any(uwarr) as ubyte
ub = anyall.anyw(uwarr, len(uwarr)) as ubyte
if ub==0 txt.print("error any3\n")
ub = any(warr) as ubyte
ub = anyall.anyw(warr, len(warr)) as ubyte
if ub==0 txt.print("error any4\n")
ub = any(farr) as ubyte
if ub==0 txt.print("error any5\n")
; ALL
ub = all(ubarr) as ubyte
ub = anyall.all(ubarr, len(ubarr)) as ubyte
if ub==1 txt.print("error all1\n")
ub = all(barr) as ubyte
ub = anyall.all(barr, len(barr)) as ubyte
if ub==1 txt.print("error all2\n")
ub = all(uwarr) as ubyte
ub = anyall.allw(uwarr, len(uwarr)) as ubyte
if ub==1 txt.print("error all3\n")
ub = all(warr) as ubyte
ub = anyall.allw(warr, len(warr)) as ubyte
if ub==1 txt.print("error all4\n")
ub = all(farr) as ubyte
if ub==1 txt.print("error all5\n")
ubarr[1]=$40
barr[1]=$40
uwarr[1]=$4000
warr[1]=$4000
farr[1]=1.1
ub = all(ubarr) as ubyte
ub = anyall.all(ubarr, len(ubarr)) as ubyte
if ub==0 txt.print("error all6\n")
ub = all(barr) as ubyte
ub = anyall.all(barr, len(barr)) as ubyte
if ub==0 txt.print("error all7\n")
ub = all(uwarr) as ubyte
ub = anyall.allw(uwarr, len(uwarr)) as ubyte
if ub==0 txt.print("error all8\n")
ub = all(warr) as ubyte
ub = anyall.allw(warr, len(warr)) as ubyte
if ub==0 txt.print("error all9\n")
ub = all(farr) as ubyte
if ub==0 txt.print("error all10\n")
txt.print("\nyou should see no errors printed above (only at first run).")
txt.print("\nyou should see no errors printed above (first run only).")
}
}

View File

@ -3,6 +3,7 @@
%import string
%import syslib
%import math
%import anyall
%zeropage basicsafe
main {
@ -351,59 +352,59 @@ main {
txt.print_w(ww)
txt.nl()
ub = any(ubarr) as ubyte
ub = anyall.any(ubarr, len(ubarr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(any(ubarr) as ubyte)*1+zero
ub = zero+(anyall.any(ubarr, len(ubarr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = any(barr) as ubyte
ub = anyall.any(barr, len(barr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(any(barr) as ubyte)*1+zero
ub = zero+(anyall.any(barr, len(barr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = any(uwarr) as ubyte
ub = anyall.any(uwarr, len(uwarr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(any(uwarr) as ubyte)*1+zero
ub = zero+(anyall.any(uwarr, len(uwarr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = any(warr) as ubyte
ub = anyall.any(warr, len(warr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(any(warr) as ubyte)*1+zero
ub = zero+(anyall.any(warr, len(warr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = all(ubarr) as ubyte
ub = anyall.all(ubarr, len(ubarr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(all(ubarr) as ubyte)*1+zero
ub = zero+(anyall.all(ubarr, len(ubarr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = all(barr) as ubyte
ub = anyall.all(barr, len(barr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(all(barr) as ubyte)*1+zero
ub = zero+(anyall.all(barr, len(barr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = all(uwarr) as ubyte
ub = anyall.all(uwarr, len(uwarr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(all(uwarr) as ubyte)*1+zero
ub = zero+(anyall.all(uwarr, len(uwarr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = all(warr) as ubyte
ub = anyall.all(warr, len(warr)) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(all(warr) as ubyte)*1+zero
ub = zero+(anyall.all(warr, len(warr)) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
}
@ -427,19 +428,6 @@ main {
txt.print_b(bb)
txt.nl()
ub = any(flarr) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(any(flarr) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
ub = all(flarr) as ubyte
txt.print_ub(ub)
txt.nl()
ub = zero+(all(flarr) as ubyte)*1+zero
txt.print_ub(ub)
txt.nl()
for ub in 0 to len(flarr)-1 {
floats.print(flarr[ub])
txt.chrout(',')

View File

@ -14,11 +14,11 @@ main {
uword uw = 2000
word ww = -1000
float fl = 999.99
ubyte[3] ubarr = 200
byte[3] barr = -100
uword[3] uwarr = 2000
word[3] warr = -1000
float[3] flarr = 999.99
ubyte[3] ubarr = [200]*3
byte[3] barr = [-100]*3
uword[3] uwarr = [2000]*3
word[3] warr = [-1000]*3
float[3] flarr = [999.99]*3
txt.print("++\n")
ub++

View File

@ -13,8 +13,9 @@ main {
uword two57 = 257
uword thousand = 1000
uword maximum = 65535
const long maxxx = 65536
txt.print("expected:\n 0, 1, 100, 255, 256, 257, 1000, 65535\n\n")
txt.print("expected:\n 0, 1, 100, 255, 256, 257, 1000, 65535, 999\n\n")
repeat zero {
amount++
@ -71,5 +72,12 @@ main {
txt.print_uw(amount)
txt.nl()
amount=999
repeat maxxx {
amount++
}
txt.print_uw(amount)
txt.nl()
}
}

View File

@ -1,10 +1,6 @@
TODO
====
- fix the aggregate any all errors
- remove this warning INFO library:/prog8lib/shared_floats_functions.p8:9:1: removing unused block 'txt'
- compiler is particularly slow (>2 sec) for compiler/test/comparisons/test_word_splitw_lte.p8
...

View File

@ -1,3 +1,5 @@
%import floats
main {
sub start() {
}