Files
mercury/tests/hard_coded/array_fetch_items.exp
Julien Fischer e876db7873 Adjust bounds checking behaviour of array.fetch_items/4.
Change array.fetch_items/4 to return an empty list for an empty range in the
case where the endpoints of that range are not within the array bounds.

library/array.m:
   As above.

deep_profiler/autopar_types.m:
   Undo Zoltan's recent workaround for the above behaviour.

tests/hard_coded/array_fetch_items.{m,ex}:
   Add tests for this behaviour.
2019-08-16 12:40:36 +10:00

41 lines
796 B
Plaintext

================
Array = array([1, 2, 3, 4, 5])
Lo = 0
Hi = 4
List = [1, 2, 3, 4, 5]
================
Array = array([1, 2, 3, 4, 5])
Lo = 1
Hi = 3
List = [2, 3, 4]
================
Array = array([1, 2, 3, 4, 5])
Lo = 0
Hi = 0
List = [1]
================
Array = array([1, 2, 3, 4, 5])
Lo = -1
Hi = 0
EXCEPTION: "second argument of fetch_items: index -1 not in range [0, 4]"
================
Array = array([1, 2, 3, 4, 5])
Lo = 0
Hi = 6
EXCEPTION: "third argument of fetch_items: index 6 not in range [0, 4]"
================
Array = array([1, 2, 3, 4, 5])
Lo = 4
Hi = 2
List = []
================
Array = array([1, 2, 3, 4, 5])
Lo = 561
Hi = -1
List = []
================
Array = array([1, 2, 3, 4, 5])
Lo = 561
Hi = 561
EXCEPTION: "second argument of fetch_items: index 561 not in range [0, 4]"