Filter Function Test - AxonVM

Test 1: Basic Filter

Input: Array("Hello World", "Goodbye", "Hello Friend")
Filter(arr1, "Hello")
Result type: Variant()
UBound: 1
result1(0): Hello World
result1(1): Hello Friend
✓ PASS

Test 2: Filter with Include=False (Exclude mode)

Input: Array("Apple", "Banana", "Apricot", "Cherry")
Filter(arr2, "Ap", False)
UBound: 1
result2(0): Banana
result2(1): Cherry
✓ PASS

Test 3: Filter with Case-Insensitive Compare

Input: Array("HELLO", "hello", "HeLLo", "goodbye")
Filter(arr3, "hello", True, 1) ' compare=1 = case-insensitive
UBound: 2
Count: 3
✓ PASS: Found 3 matches

Test 4: Direct Indexed Access

Filter(arr4, "Second")(0) = Second
✓ PASS: Direct indexed access works

Test 5: Empty Result

Filter(arr5, "NonExistent")
IsArray: True
UBound: -1
✓ PASS: Empty array returned