Files
hakorune/local_tests/test_array_length_fix.nyash
Moe Charm ef7a0de3b0 feat: Prepare for code modularization and cleanup
- Archive old documentation and test files to `docs/archive/` and `local_tests/`.
- Remove various temporary and old files from the project root.
- Add `nekocode-rust` analysis tool and its output files (`nekocode/`, `.nekocode_sessions/`, `analysis.json`).
- Minor updates to `apps/chip8_nyash/chip8_emulator.nyash` and `local_tests` files.

This commit cleans up the repository and sets the stage for further code modularization efforts, particularly in the `src/interpreter` and `src/parser` modules, based on recent analysis.
2025-08-16 01:30:39 +09:00

43 lines
1.6 KiB
Plaintext

// Test for ArrayBox.length() functionality
static box ArrayLengthTest {
init { console }
main() {
me.console = new ConsoleBox()
me.console.log("🧪 Testing ArrayBox.length() functionality")
// Test 1: Empty array
local empty_array = new ArrayBox()
local empty_length = empty_array.length()
me.console.log("Empty array length: " + empty_length) // Expected: 0
// Test 2: Array with elements
local test_array = new ArrayBox()
test_array.push("first")
test_array.push("second")
test_array.push("third")
local length_after_push = test_array.length()
me.console.log("Array length after 3 pushes: " + length_after_push) // Expected: 3
// Test 3: Array after pop
local popped = test_array.pop()
me.console.log("Popped element: " + popped)
local length_after_pop = test_array.length()
me.console.log("Array length after pop: " + length_after_pop) // Expected: 2
// Test 4: Verify elements are still accessible
local first_element = test_array.get(0)
local second_element = test_array.get(1)
me.console.log("Element at index 0: " + first_element)
me.console.log("Element at index 1: " + second_element)
// Test 5: Edge case - accessing beyond length
local beyond_length = test_array.get(5)
me.console.log("Element beyond length: " + beyond_length) // Expected: null
me.console.log("✅ ArrayBox.length() tests completed")
return "ArrayBox functionality verified"
}
}