// 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"
    }
}