aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/artifact.lux
blob: a9e305d2e61d445b2436bb6157b86331f21c0bd5 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
... 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)]
    [hash (.only Hash)]
    ["[0]" hash
     ["[1]T" \\test]]
    ["[0]" equivalence
     ["[1]T" \\test]]
    ["[0]" order
     ["[1]T" \\test]]]
   [data
    ["[0]" text (.use "[1]#[0]" equivalence)]]
   [math
    ["[0]" random (.only Random)]]
   [world
    ["[0]" file]
    [net
     ["[0]" uri]]]
   [test
    ["_" property (.only Test)]]]]
 ["[0]" /
  ["[1][0]" extension]
  ["[1][0]" snapshot]
  ["[1][0]" time]
  ["[1][0]" type]
  ["[1][0]" versioning]]
 [\\program
  ["[0]" /]])

(def .public random
  (Random /.Artifact)
  (let [size 4]
    (all random.and
         (random.lower_cased size)
         (random.lower_cased size)
         (random.lower_cased size)
         )))

(def .public test
  Test
  (<| (_.covering /._)
      (do random.monad
        [sample ..random])
      (_.for [/.Group /.Name /.Version
              
              /.Artifact
              /.#group /.#name /.#version]
             (all _.and
                  (_.for [/.equivalence]
                         (equivalenceT.spec /.equivalence ..random))
                  (_.for [/.order]
                         (orderT.spec /.order ..random))
                  (_.for [/.hash]
                         (hashT.spec /.hash ..random))

                  (_.coverage [/.format /.identity]
                    (and (text.ends_with? (/.identity sample) (/.format sample))
                         (not (text#= (/.identity sample) (/.format sample)))))
                  
                  /extension.test
                  /snapshot.test
                  /time.test
                  /type.test
                  /versioning.test
                  ))))