2024-08-05 21:44:49 -05:00
|
|
|
// This tests indexing an array.
|
|
|
|
|
2024-11-04 20:34:22 -06:00
|
|
|
|
2024-11-18 19:54:25 -05:00
|
|
|
arr = [90, 91, 92]
|
2024-08-05 21:44:49 -05:00
|
|
|
|
|
|
|
// Test: literal index.
|
|
|
|
|
2024-11-04 20:34:22 -06:00
|
|
|
|
2024-11-18 19:54:25 -05:00
|
|
|
result0 = arr[1]
|
2024-08-05 21:44:49 -05:00
|
|
|
|
|
|
|
assertLessThanOrEq(result0, 91, "Literal property lookup")
|
|
|
|
assertGreaterThanOrEq(result0, 91, "Literal property lookup")
|
|
|
|
|
|
|
|
// Test: computed index.
|
|
|
|
|
2024-11-04 20:34:22 -06:00
|
|
|
|
|
|
|
i = int(1 + 0)
|
2024-11-18 19:54:25 -05:00
|
|
|
result1 = arr[i]
|
2024-08-05 21:44:49 -05:00
|
|
|
|
|
|
|
assertLessThanOrEq(result1, 91, "Computed property lookup")
|
|
|
|
assertGreaterThanOrEq(result1, 91, "Computed property lookup")
|