blob: 1aaa9bfae3364176309f85b2839f6e3d9a4385cd (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
|
(.using
[library
[lux (.except)
["_" test (.only Test)]
[abstract
[monad (.only do)]]
[control
["[0]" try ("[1]#[0]" functor)]
[concurrency
["[0]" async]]]
[data
["[0]" binary ("[1]#[0]" equivalence)]
[collection
["[0]" sequence]]]
[math
["[0]" random]
[number
["n" nat]]]
[world
["[0]" file]]]]
[\\library
["[0]" / (.only)
["/[1]" // (.only)
["/[1]" // (.only)
["[0]" archive (.only)
["[0]" signature]
["[0]" key]
["[0]" registry]
["[0]" module (.only)
["[0]" document]]]]]]]
["$" //
[//
["[1][0]" context]
["[1][0]" archive (.only)
["[2][0]" signature]]]])
(def: .public test
Test
(<| (_.covering /._)
(do [! random.monad]
[.let [/ "/"
fs (file.mock /)]
context $context.random
module/0 (random.lower_case 1)
module/1 (random.lower_case 2)
content/0 random.nat
content/1 (random.only (|>> (n.= content/0) not) random.nat)
hash random.nat
signature $signature.random
.let [key (key.key signature content/0)
[archive expected] (|> (do try.monad
[[@module/0 archive] (archive.reserve module/0 archive.empty)
[@module/1 archive] (archive.reserve module/1 archive)
.let [entry/0 [archive.#module [module.#id @module/0
module.#descriptor ($archive.descriptor module/0 hash)
module.#document (document.document key content/0)]
archive.#output sequence.empty
archive.#registry registry.empty]
entry/1 [archive.#module [module.#id @module/1
module.#descriptor ($archive.descriptor module/1 hash)
module.#document (document.document key content/1)]
archive.#output sequence.empty
archive.#registry registry.empty]]
archive (archive.has module/0 entry/0 archive)
archive (archive.has module/1 entry/1 archive)]
(in [archive (archive.export ///.version archive)]))
try.trusted)]]
(all _.and
(in (do [! async.monad]
[pre/0 (# fs file? (/.descriptor fs context))
enabled? (//.enable! ! fs context)
cached? (/.cache! fs context archive)
actual (# fs read (/.descriptor fs context))
post/0 (# fs file? (/.descriptor fs context))]
(_.coverage' [/.descriptor /.cache!]
(and (not pre/0)
(|> (do try.monad
[_ enabled?
_ cached?]
actual)
(try#each (binary#= expected))
(try.else false))
post/0))))
))))
|