Files
mercury/tests/hard_coded/int_range_ops.exp
Julien Fischer c6da21fda2 Add the predicate int.all_true_in_range/3.
Add the predicate all_true_in_range/3 where

   all_true_in_range(P, Low, High) <=>
       list.all_true(P, Low .. High)

except that it avoids construction of the list 'Low..High'.

library/int.m:
    Add the above predicate.

    s/Lo to Hi/Low to High/ in the description of the predicate
    nondet_int_in_range/3.  We use the latter form when describing
    the fold predicates above.

NEWS:
    Announce the new predicate.

    Adjust an existing entry.

tests/hard_coded/Mmakefile:
tests/hard_coded/int_range_ops.{m,exp}:
    Test the new predicate and also test the predicate nondet_in_range/3
    since none of the existing tests covered that.
2015-01-24 01:58:03 +11:00

9 lines
366 B
Plaintext

solutions(nondet_int_in_range(1, 0)) = []
solutions(nondet_int_in_range(1, 1)) = [0, 1]
solutions(nondet_int_in_range(1, 10)) = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
all_true_in_range(int.even, 1, 0): true
all_true_in_range(int.even, 1, 1): false
all_true_in_range(int.odd, 1, 1): true
all_true_in_range(LessThan10, 1, 5): true
all_true_in_range(LessThan10, 8, 11): false