aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2020-10-12 01:04:47 -0400
committerEduardo Julian2020-10-12 01:04:47 -0400
commit5b222d040ee361dd4022e88488a6bcef3ca40a71 (patch)
tree5506748e0aeaeead13ef40e0be2932f5c5c6a3ab /stdlib/source/test/aedifex
parentbefa21cea76282f8cd3509e0a7da1bdffd353101 (diff)
Tweaked how I64 masks are made.
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/parser.lux8
-rw-r--r--stdlib/source/test/aedifex/project.lux96
2 files changed, 99 insertions, 5 deletions
diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux
index 988883779..a171e694d 100644
--- a/stdlib/source/test/aedifex/parser.lux
+++ b/stdlib/source/test/aedifex/parser.lux
@@ -73,9 +73,7 @@
(case> (#try.Success actual)
(|> expected
..with-default-sources
- [//.default]
- list
- (dictionary.from-list text.hash)
+ (//project.project //.default)
(:: //project.equivalence = actual))
(#try.Failure error)
@@ -84,7 +82,7 @@
(def: (with-empty-profile project)
(-> Project Project)
(if (dictionary.empty? project)
- //project.empty
+ (//project.project //.default (:: //.monoid identity))
project))
(def: multiple-profiles
@@ -102,7 +100,7 @@
dictionary.entries
(list@map (function (_ [name profile])
[name (..with-default-sources profile)]))
- (dictionary.from-list text.hash)
+ (dictionary.from-list text.hash)
(:: //project.equivalence = actual))
(#try.Failure error)
diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux
new file mode 100644
index 000000000..f2c2917a2
--- /dev/null
+++ b/stdlib/source/test/aedifex/project.lux
@@ -0,0 +1,96 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]
+ ["$." monoid]]}]
+ [control
+ ["." try ("#@." functor)]
+ ["." exception]]
+ [data
+ ["." product]
+ ["." text ("#@." equivalence)]
+ [number
+ ["n" nat]]]
+ [math
+ ["." random (#+ Random) ("#@." monad)]]]
+ [//
+ ["@." profile]]
+ {#program
+ ["." /
+ ["/#" // #_
+ ["#" profile]]]})
+
+(def: profile
+ (Random [//.Name //.Profile])
+ (|> @profile.random
+ (random@map (set@ #//.parents (list)))
+ (random.and (random.ascii/alpha 1))))
+
+(def: #export random
+ (Random /.Project)
+ (do random.monad
+ [[name profile] ..profile]
+ (wrap (/.project name profile))))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.with-cover [/.Project /.project]
+ ($_ _.and
+ (_.with-cover [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+ (_.with-cover [/.monoid]
+ ($monoid.spec /.equivalence /.monoid ..random))
+
+ (do random.monad
+ [[super-name super-profile] ..profile
+ [dummy-name dummy-profile] (random.filter (|>> product.left (text@= super-name) not)
+ ..profile)
+ [sub-name sub-profile] (random.filter (function (_ [name profile])
+ (and (not (text@= super-name name))
+ (not (text@= dummy-name name))))
+ ..profile)
+ fake-name (random.filter (function (_ name)
+ (and (not (text@= super-name name))
+ (not (text@= dummy-name name))
+ (not (text@= sub-name name))))
+ (random.ascii/alpha 1))
+ #let [project ($_ (:: /.monoid compose)
+ (/.project super-name super-profile)
+ (/.project dummy-name dummy-profile)
+ (/.project sub-name (set@ #//.parents (list super-name) sub-profile)))
+ circular ($_ (:: /.monoid compose)
+ (/.project super-name (set@ #//.parents (list sub-name) super-profile))
+ (/.project dummy-name dummy-profile)
+ (/.project sub-name (set@ #//.parents (list super-name) sub-profile)))]]
+ ($_ _.and
+ (_.cover [/.profile]
+ (and (|> (/.profile super-name project)
+ (try@map (:: //.equivalence = super-profile))
+ (try.default false))
+ (|> (/.profile dummy-name project)
+ (try@map (:: //.equivalence = dummy-profile))
+ (try.default false))
+ (|> (/.profile sub-name project)
+ (try@map (:: //.equivalence = (:: //.monoid compose sub-profile super-profile)))
+ (try.default false))))
+ (_.cover [/.unknown-profile]
+ (case (/.profile fake-name project)
+ (#try.Success _)
+ false
+
+ (#try.Failure error)
+ (exception.match? /.unknown-profile error)))
+ (_.cover [/.circular-dependency]
+ (case (/.profile sub-name circular)
+ (#try.Success _)
+ false
+
+ (#try.Failure error)
+ (exception.match? /.circular-dependency error)))
+ ))
+ ))))