aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/lux/abstract/interval.lux
blob: d146570fa0d9bda4de3b70ccd26e7eb40b1b5805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(.using
 [library
  [lux "*"
   ["_" test (.only Test)]
   [abstract
    [monad (.only do)]
    ["[0]" order]]
   [math
    ["[0]" random (.only Random)]]]]
 [\\library
  ["[0]" /]])

(def: .public (spec (open "@//[0]") gen_sample)
  (All (_ a) (-> (/.Interval a) (Random a) Test))
  (<| (_.for [/.Interval])
      (do random.monad
        [sample gen_sample]
        (all _.and
             (_.property "No value is bigger than the top."
               (@//< @//top sample))
             (_.property "No value is smaller than the bottom."
               (order.> @//order @//bottom sample))
             ))))