blob: 960a75f2194820cff2bf38ea17729f64fc672a92 (
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
71
|
(.module:
[lux #*
["_" test (#+ Test)]
[abstract
[monad (#+ do)]]
[control
["." try]
[concurrency
[promise (#+ Promise)]]]
[data
["." text]
[collection
["." set (#+ Set)]]]
[math
["." random (#+ Random)]
[number
["n" nat]]]
[world
["." file]]]
[//
["@." profile]
[//
[lux
[data
["_." binary]]]]]
{#program
["." /
["/#" // #_
["#" profile]
["#." dependency (#+ Dependency)]
["#." pom]
["#." hash]]]})
(def: #export random
(Random [//.Profile /.Package])
(do {! random.monad}
[content_size (\ ! map (n.% 100) random.nat)
content (_binary.random content_size)
[profile pom] (random.one (function (_ profile)
(try.to_maybe
(do try.monad
[pom (//pom.write profile)]
(wrap [profile pom]))))
@profile.random)]
(wrap [profile (/.local pom content)])))
(def: #export test
Test
(<| (_.covering /._)
(_.for [/.Package])
(do {! random.monad}
[[profile package] ..random]
($_ _.and
(_.cover [/.local]
false
## (and (\ //hash.equivalence =
## (//hash.sha-1 (get@ #/.library package))
## (get@ #/.sha-1 package))
## (\ //hash.equivalence =
## (//hash.md5 (get@ #/.library package))
## (get@ #/.md5 package)))
)
(_.cover [/.dependencies]
(let [expected (get@ #//.dependencies profile)]
(case (/.dependencies package)
(#try.Success actual)
(\ set.equivalence = expected actual)
(#try.Failure error)
false)))
))))
|