refs #35 serialize any: null, int, real, boolean, Instant. Added unary minus as general operator, not only to numbers. Instant truncation (nice for serialization)

This commit is contained in:
sergeych committed 2025-07-17 23:23:03 +03:00
1 parent cffe4eaffc
commit 6ab438b1f6
14 files changed
+208 -51

No files matched your search

+22 -3
View File
@@ -303,10 +303,29 @@ class LynonTests {
@Test
fun testIntsNulls() = runTest{
fun testUnaryMinus() = runTest{
eval("""
import lyng.serialization
assertEquals( null, Lynon.decode(Lynon.encode(null)) )
assertEquals( -1 * π, 0 - π )
assertEquals( -1 * π, -π )
""".trimIndent())
}
@Test
fun testIntsNulls() = runTest{
testScope().eval("""
testEncode(null)
testEncode(0)
testEncode(47)
testEncode(-21)
testEncode(true)
testEncode(false)
testEncode(1.22345)
testEncode(-π)
import lyng.time
testEncode(Instant.now().truncateToSecond())
testEncode(Instant.now().truncateToMillisecond())
testEncode(Instant.now().truncateToMicrosecond())
""".trimIndent())
}