Files
mercury/tests/hard_coded/version_array_test.exp
Julien Fischer 64861b2d13 Add version_array.from_reverse_list/1.
library/version_array.m:
     Add the above function.

     Minor fixes to some comments.

tests/hard_coded/version_array_test.{m,exp}:
     Extend this test to cover from_reverse_list/1 and
     from_list/1.

NEWS:
     Announce the addition.
2016-07-22 13:51:53 +10:00

34 lines
1.6 KiB
Plaintext

ordering(A1, A0) = '>'
ordering(A0, A1) = '<'
ordering(A1, A2) = '<'
ordering(A2, A1) = '>'
A0: [] (size 0)
A1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] (size 21)
A2: [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] (size 21)
A22: [20, 19, 18, 17, 16, 555, 666, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] (size 21)
A21: [0, 1, 6, 3, 12, 5, 18, 7, 24, 9, 30, 11, 36, 13, 42, 15, 48, 17, 54, 19, 60] (size 21)
A3: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] (size 21)
A4: [7, 7, 7, 7, 7, 7, 7] (size 7)
(sum 49)
A5: [7, 7, 7, 7] (size 4)
A6: [7, 7, 7, 7, 9, 9, 9, 9, 9] (size 9)
(sum 73)
A7: [7, 7, 7, 7] (size 4)
Found exception as expected: index_out_of_bounds("version_array.lookup: index -1 not in range [0, 3]")
Found exception as expected: index_out_of_bounds("version_array.set: index -1 not in range [0, 3]")
Found exception as expected: index_out_of_bounds("version_array.set: index -1 not in range [0, 3]")
Found exception as expected: index_out_of_bounds("version_array.lookup: index -1 not in range [0, 3]")
Found exception as expected: index_out_of_bounds("version_array.lookup: index 4 not in range [0, 3]")
all_true(int.even A8): passed
all_false(int.odd, A8): passed
all_true(int.even, A0): passed
all_false(int.even, A0): passed
not all_true(int.odd, A8): passed
not all_false(int.even, A8): passed
from_list([]): [] (size 0)
from_list([1]): [1] (size 1)
from_list([1, 2]): [1, 2] (size 2)
from_reverse_list([]): [] (size 0)
from_reverse_list([1]): [1] (size 1)
from_reverse_list([2, 1]): [1, 2] (size 2)