aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/ffi/export.rb.lux
blob: 097fa15cd16a1473205ea321bc33c0430c7a4b96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   [math
    [number
     ["n" nat]]]
   [meta
    ["[0]" static]]
   [test
    ["_" property (.only Test)]]]]
 [\\library
  ["[0]" / (.only)
   ["/[1]" //]]])

(with_expansions [<nat> (static.random_nat)]
  (/.export
    (def nullary
      Nat
      <nat>)
    (def unary
      (-> Nat Nat)
      (|>> (n.+ <nat>)))
    (def CONSTANT
      Nat
      <nat>)
    (def $global
      (-> Nat Nat)
      (|>> (n.+ <nat>))))

  (//.import (nullary [] Nat))
  (//.import (unary [Nat] Nat))
  (//.import (CONSTANT Nat))
  (//.import ($global (-> Nat Nat)))

  (def .public test
    Test
    (<| (_.covering /._)
        (all _.and
             (_.coverage [/.export]
               (and (n.= <nat> (..nullary []))
                    (n.= (n.+ <nat> <nat>) (..unary <nat>))
                    (n.= <nat> (..CONSTANT))
                    (n.= (n.+ <nat> <nat>) ((..$global) <nat>))))
             )))
  )