Files
hakorune/local_tests/test_modulo_operator_fix.nyash

31 lines
1.0 KiB
Plaintext
Raw Normal View History

// Test % operator functionality after ModuloBox fix
static box ModuloTest {
init { console }
main() {
me.console = new ConsoleBox()
me.console.log("🧪 Testing % operator after ModuloBox fix")
// Test 1: Basic modulo operation
local result1 = 10 % 3
me.console.log("10 % 3 = " + result1) // Expected: 1
// Test 2: Chip-8 style operations
local result2 = 4096 % 4096
me.console.log("4096 % 4096 = " + result2) // Expected: 0
local result3 = 256 % 16
me.console.log("256 % 16 = " + result3) // Expected: 0
// Test 3: Common modulo patterns
local result4 = 17 % 5
me.console.log("17 % 5 = " + result4) // Expected: 2
// Test 4: Zero check (should not crash)
local result5 = 42 % 1
me.console.log("42 % 1 = " + result5) // Expected: 0
me.console.log("✅ Modulo operator tests completed")
return "ModuloBox fix verified"
}
}