add unittest for aa%bb (without space) to be parsed correctly as modulo, not directive

This commit is contained in:
Irmen de Jong 2023-12-29 05:11:50 +01:00
parent ccc11e49d2
commit 779a5606a7
2 changed files with 20 additions and 9 deletions

View File

@ -14,6 +14,7 @@ import prog8.ast.statements.VarDecl
import prog8.code.core.DataType
import prog8.code.core.Position
import prog8.code.target.C64Target
import prog8.code.target.Cx16Target
import prog8.code.target.VMTarget
import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.compileText
@ -493,5 +494,22 @@ main {
(right2.left as? IdentifierReference)?.nameInSource shouldBe listOf("x")
(right2.right as? NumericLiteral)?.number shouldBe 10.0
}
test("modulo is not directive") {
val src="""
main {
sub start() {
ubyte bb1 = 199
ubyte bb2 = 12
ubyte @shared bb3 = bb1%bb2
}
}"""
val result=compileText(Cx16Target(), optimize=false, src, writeAssembly=false)!!
val st = result.compilerAst.entrypoint.statements
st.size shouldBe 6
val value = (st[5] as Assignment).value as BinaryExpression
value.operator shouldBe "%"
}
})

View File

@ -2,17 +2,10 @@
TODO
====
- add unittest for aa%bb (without space) to be parsed correctly as modulo
ubyte bb1 = 199
ubyte bb2 = 12
ubyte bb3 = bb1%bb2
txt.print_ub(bb3)
- fix bitshift.p8
- make internalCast() not complain anymore about signed <-> unsigned conversions
- add crc8 and crc16 and crc32 to math
- fix crc* bench routines to no longer depend on the kernal rom version (use a bin file)
- make internalCast() not complain anymore about signed <-> unsigned conversions
- fix bitshift.p8
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....