diff options
| author | Eduardo Julian | 2019-03-22 21:38:04 -0400 | 
|---|---|---|
| committer | Eduardo Julian | 2019-03-22 21:38:04 -0400 | 
| commit | a14cef9af5ddd60034152f94adad28352135350d (patch) | |
| tree | cd0fc5bbd9b99ee308c6d04b9a559167ffc47454 /stdlib/source/test/lux/control/interval.lux | |
| parent | 36c09baf6d977d6bcb712459325b9c5c3e7589ae (diff) | |
Ported tests for number-related modules.
Diffstat (limited to '')
| -rw-r--r-- | stdlib/source/test/lux/control/interval.lux | 27 | 
1 files changed, 20 insertions, 7 deletions
diff --git a/stdlib/source/test/lux/control/interval.lux b/stdlib/source/test/lux/control/interval.lux index dbac4cc8e..a32333ba1 100644 --- a/stdlib/source/test/lux/control/interval.lux +++ b/stdlib/source/test/lux/control/interval.lux @@ -15,12 +15,12 @@     [math      ["r" random (#+ Random)]]]    {1 -   ["." / (#+ Interval) ("_;." equivalence)]} +   ["." / (#+ Interval) ("_@." equivalence)]}    {0     [test      [lux       [control -      [".T" equivalence]]]]}) +      ["$." equivalence]]]]})  (do-template [<name> <cmp>]    [(def: #export <name> @@ -80,7 +80,7 @@       right-outer ..outer]      ($_ _.and          (_.test "The union of an interval to itself yields the same interval." -                (_;= some-interval (/.union some-interval some-interval))) +                (_@= some-interval (/.union some-interval some-interval)))          (_.test "The union of 2 inner intervals is another inner interval."                  (/.inner? (/.union left-inner right-inner)))          (_.test "The union of 2 outer intervals yields an inner interval when their complements don't overlap, and an outer when they do." @@ -101,7 +101,7 @@       right-outer ..outer]      ($_ _.and          (_.test "The intersection of an interval to itself yields the same interval." -                (_;= some-interval (/.intersection some-interval some-interval))) +                (_@= some-interval (/.intersection some-interval some-interval)))          (_.test "The intersection of 2 inner intervals yields an inner interval when they overlap, and an outer when they don't."                  (if (/.overlaps? left-inner right-inner)                    (/.inner? (/.intersection left-inner right-inner)) @@ -116,7 +116,7 @@      [some-interval ..interval]      ($_ _.and          (_.test "The complement of a complement is the same as the original." -                (_;= some-interval (|> some-interval /.complement /.complement))) +                (_@= some-interval (|> some-interval /.complement /.complement)))          (_.test "The complement of an interval does not overlap it."                  (not (/.overlaps? some-interval (/.complement some-interval))))          ))) @@ -219,7 +219,7 @@    Test    (<| (_.context (%name (name-of /.Interval)))        ($_ _.and -          (equivalenceT.test /.equivalence ..interval) +          ($equivalence.spec /.equivalence ..interval)            (<| (_.context "Boundaries.")                ..boundaries)            (<| (_.context "Union.") @@ -233,4 +233,17 @@            (<| (_.context "Touching intervals.")                ..touch)            (<| (_.context "Nesting & overlap.") -              ..overlap)))) +              ..overlap) +          ))) + +(def: #export (spec (^open "_@.") gen-sample) +  (All [a] (-> (Interval a) (Random a) Test)) +  (<| (_.context (%name (name-of /.Interval))) +      (do r.monad +        [sample gen-sample] +        ($_ _.and +            (_.test "No value is bigger than the top." +                    (_@< _@top sample)) +            (_.test "No value is smaller than the bottom." +                    (_@> _@bottom sample)) +            ))))  | 
