aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/macro/syntax.lux
blob: 05bd11cc39da8bd5442e30cb9af53ed4f87b560b (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
49
50
51
52
53
... 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)
   [abstract
    [monad (.only do)]]
   [math
    ["[0]" random]
    [number
     ["n" nat]]]
   [meta
    ["[0]" code
     ["<[1]>" \\parser]]]
   [test
    ["_" property (.only Test)]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" check]
  ["[1][0]" declaration]
  ["[1][0]" definition]
  ["[1][0]" export]
  ["[1][0]" input]
  ["[1][0]" type
   ["[1]/[0]" variable]]])

(def +/3
  (/.syntax (_ [a <code>.any
                b <code>.any
                c <code>.any])
    (in (list (` (all n.+ (, a) (, b) (, c)))))))

(def .public test
  Test
  (<| (_.covering /._)
      (all _.and
           (do random.monad
             [x random.nat
              y random.nat
              z random.nat]
             (_.coverage [/.syntax]
               (n.= (all n.+ x y z)
                    (+/3 x y z)))) 

           /check.test
           /declaration.test
           /definition.test
           /export.test
           /input.test
           /type/variable.test
           )))