aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/aedifex/artifact.lux5
-rw-r--r--stdlib/source/test/aedifex/artifact/time_stamp/date.lux44
-rw-r--r--stdlib/source/test/lux.lux14
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux7
-rw-r--r--stdlib/source/test/lux/host.jvm.lux43
-rw-r--r--stdlib/source/test/lux/macro/code.lux1
-rw-r--r--stdlib/source/test/lux/macro/poly/equivalence.lux16
-rw-r--r--stdlib/source/test/lux/macro/poly/functor.lux6
-rw-r--r--stdlib/source/test/lux/macro/syntax/common.lux17
-rw-r--r--stdlib/source/test/lux/macro/syntax/common/annotations.lux3
-rw-r--r--stdlib/source/test/lux/macro/syntax/common/type/variable.lux37
-rw-r--r--stdlib/source/test/lux/math.lux9
-rw-r--r--stdlib/source/test/lux/math/number/complex.lux62
-rw-r--r--stdlib/source/test/lux/math/number/frac.lux6
-rw-r--r--stdlib/source/test/lux/meta.lux4
-rw-r--r--stdlib/source/test/lux/meta/location.lux50
-rw-r--r--stdlib/source/test/lux/target/jvm.lux8
17 files changed, 228 insertions, 104 deletions
diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux
index 5c694ae74..959b857dd 100644
--- a/stdlib/source/test/aedifex/artifact.lux
+++ b/stdlib/source/test/aedifex/artifact.lux
@@ -20,7 +20,9 @@
["." uri]]]]
["." / #_
["#." type]
- ["#." extension]]
+ ["#." extension]
+ ["#." time_stamp #_
+ ["#/." date]]]
{#program
["." /]})
@@ -42,4 +44,5 @@
/type.test
/extension.test
+ /time_stamp/date.test
))))
diff --git a/stdlib/source/test/aedifex/artifact/time_stamp/date.lux b/stdlib/source/test/aedifex/artifact/time_stamp/date.lux
new file mode 100644
index 000000000..0f4b5b7d3
--- /dev/null
+++ b/stdlib/source/test/aedifex/artifact/time_stamp/date.lux
@@ -0,0 +1,44 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try ("#\." functor)]
+ [parser
+ ["<.>" text]]]
+ [math
+ ["." random (#+ Random)]
+ [number
+ ["n" nat]
+ ["i" int]]]
+ [time
+ ["." date (#+ Date)]
+ ["." year]]]
+ {#program
+ ["." /]})
+
+(def: #export random
+ (Random Date)
+ (random.one (function (_ raw)
+ (try.to_maybe
+ (do try.monad
+ [year (|> raw date.year year.value i.abs (i.% +10,000) year.year)]
+ (date.date year
+ (date.month raw)
+ (date.day_of_month raw)))))
+ random.date))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ ($_ _.and
+ (do random.monad
+ [expected ..random]
+ (_.cover [/.format /.parser]
+ (|> expected
+ /.format
+ (<text>.run /.parser)
+ (try\map (\ date.equivalence = expected))
+ (try.default false))))
+ )))
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index d490620ff..2fb01ad72 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -1,27 +1,25 @@
(.module:
["/" lux #*
+ [program (#+ program:)]
+ ["_" test (#+ Test)]
["@" target]
[abstract
[monad (#+ do)]
[predicate (#+ Predicate)]]
[control
- ["." io (#+ io)]
- [parser
- [cli (#+ program:)]]]
+ ["." io (#+ io)]]
[data
["." name]
[text
["%" format (#+ format)]]]
- ["." math]
- ["_" test (#+ Test)]
- [math
+ ["." math
["." random (#+ Random) ("#\." functor)]
[number
- ["." i64]
["n" nat]
["i" int]
["r" rev]
- ["f" frac]]]]
+ ["f" frac]
+ ["." i64]]]]
## TODO: Must have 100% coverage on tests.
["." / #_
["#." abstract]
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index 78c933714..b2757b863 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -12,7 +12,6 @@
[data
["." bit]
["." maybe]
- ["." text ("#\." equivalence)]
[collection
["." list]
["." set]]]
@@ -108,9 +107,9 @@
(n.= size (/.size (: (Array Nat)
(/.new size)))))
(_.cover [/.type_name]
- (case (:of (/.new size))
- (^ (#.UnivQ _ (#.Apply _ (#.Named _ (#.UnivQ _ (#.Primitive nominal_type (list (#.Parameter 1))))))))
- (text\= /.type_name nominal_type)
+ (case /.Array
+ (^ (#.Named _ (#.UnivQ _ (#.Primitive nominal_type (list (#.Parameter 1))))))
+ (is? /.type_name nominal_type)
_
false))
diff --git a/stdlib/source/test/lux/host.jvm.lux b/stdlib/source/test/lux/host.jvm.lux
index 2532b3075..9edaecd0c 100644
--- a/stdlib/source/test/lux/host.jvm.lux
+++ b/stdlib/source/test/lux/host.jvm.lux
@@ -21,19 +21,22 @@
(import: java/lang/String)
(import: java/lang/Exception
- (new [java/lang/String]))
+ ["#::."
+ (new [java/lang/String])])
(import: java/lang/Object)
(import: (java/lang/Class a)
- (getName [] java/lang/String))
+ ["#::."
+ (getName [] java/lang/String)])
(import: java/lang/Runnable)
(import: java/lang/System
- (#static out java/io/PrintStream)
- (#static currentTimeMillis [] #io long)
- (#static getenv [java/lang/String] #io #? java/lang/String))
+ ["#::."
+ (#static out java/io/PrintStream)
+ (#static currentTimeMillis [] #io long)
+ (#static getenv [java/lang/String] #io #? java/lang/String)])
## TODO: Handle "class:" ASAP.
## (class: #final (TestClass A) [java/lang/Runnable]
@@ -54,14 +57,14 @@
## (java/lang/Runnable [] (run self) void
## []))
-(def: test-runnable
+(def: test_runnable
(object [] [java/lang/Runnable]
[]
(java/lang/Runnable
[] (run self) void
[])))
-(def: test-callable
+(def: test_callable
(object [a] [(java/util/concurrent/Callable a)]
[]
((java/util/concurrent/Callable a)
@@ -79,15 +82,15 @@
(~~ (template [<to> <from> <message>]
[(_.test <message>
(or (|> sample (:coerce java/lang/Long) <to> <from> (:coerce Int) (i.= sample))
- (let [capped-sample (|> sample (:coerce java/lang/Long) <to> <from>)]
- (|> capped-sample <to> <from> (:coerce Int) (i.= (:coerce Int capped-sample))))))]
-
- [/.long-to-byte /.byte-to-long "Can succesfully convert to/from byte."]
- [/.long-to-short /.short-to-long "Can succesfully convert to/from short."]
- [/.long-to-int /.int-to-long "Can succesfully convert to/from int."]
- [/.long-to-float /.float-to-long "Can succesfully convert to/from float."]
- [/.long-to-double /.double-to-long "Can succesfully convert to/from double."]
- [(<| /.int-to-char /.long-to-int) (<| /.int-to-long /.char-to-int) "Can succesfully convert to/from char."]
+ (let [capped_sample (|> sample (:coerce java/lang/Long) <to> <from>)]
+ (|> capped_sample <to> <from> (:coerce Int) (i.= (:coerce Int capped_sample))))))]
+
+ [/.long_to_byte /.byte_to_long "Can succesfully convert to/from byte."]
+ [/.long_to_short /.short_to_long "Can succesfully convert to/from short."]
+ [/.long_to_int /.int_to_long "Can succesfully convert to/from int."]
+ [/.long_to_float /.float_to_long "Can succesfully convert to/from float."]
+ [/.long_to_double /.double_to_long "Can succesfully convert to/from double."]
+ [(<| /.int_to_char /.long_to_int) (<| /.int_to_long /.char_to_int) "Can succesfully convert to/from char."]
))
))))
@@ -107,7 +110,7 @@
(/.synchronized sample #1))
(_.test "Can access Class instances."
- (text\= "java.lang.Class" (java/lang/Class::getName (/.class-for java/lang/Class))))
+ (text\= "java.lang.Class" (java/lang/Class::getName (/.class_for java/lang/Class))))
(_.test "Can check if a value is null."
(and (/.null? (/.null))
@@ -130,13 +133,13 @@
value (\ ! map (|>> (:coerce java/lang/Long)) r.int)]
($_ _.and
(_.test "Can create arrays of some length."
- (n.= size (/.array-length (/.array java/lang/Long size))))
+ (n.= size (/.array_length (/.array java/lang/Long size))))
(_.test "Can set and get array values."
(let [arr (/.array java/lang/Long size)]
- (exec (/.array-write idx value arr)
+ (exec (/.array_write idx value arr)
(i.= (:coerce Int value)
- (:coerce Int (/.array-read idx arr)))))))))
+ (:coerce Int (/.array_read idx arr)))))))))
(def: #export test
($_ _.and
diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux
index 1244b84e4..0f217e335 100644
--- a/stdlib/source/test/lux/macro/code.lux
+++ b/stdlib/source/test/lux/macro/code.lux
@@ -119,6 +119,7 @@
($_ _.and
(_.for [/.equivalence]
($equivalence.spec /.equivalence ..random))
+
(_.for [/.format]
(`` ($_ _.and
(~~ (template [<coverage> <random> <tag>]
diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux
index c1edf6022..593dba8e1 100644
--- a/stdlib/source/test/lux/macro/poly/equivalence.lux
+++ b/stdlib/source/test/lux/macro/poly/equivalence.lux
@@ -6,7 +6,10 @@
[monad (#+ do)]
[equivalence (#+ Equivalence)
{[0 #poly]
- ["." /]}]]
+ ["." /]}]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
[data
["." bit]
["." maybe]
@@ -48,7 +51,7 @@
(random.and random.safe_frac
gen_recursive)))))
-(def: gen_record
+(def: random
(Random Record)
(do {! random.monad}
[size (\ ! map (n.% 2) random.nat)
@@ -75,9 +78,6 @@
(def: #export test
Test
- (<| (_.context (%.name (name_of /._)))
- (do random.monad
- [sample gen_record
- #let [(^open "/\.") ..equivalence]]
- (_.test "Every instance equals itself."
- (/\= sample sample)))))
+ (<| (_.covering /._)
+ (_.for [/.equivalence]
+ ($equivalence.spec ..equivalence ..random))))
diff --git a/stdlib/source/test/lux/macro/poly/functor.lux b/stdlib/source/test/lux/macro/poly/functor.lux
index 3f2b4db50..9463d7f11 100644
--- a/stdlib/source/test/lux/macro/poly/functor.lux
+++ b/stdlib/source/test/lux/macro/poly/functor.lux
@@ -22,6 +22,6 @@
(def: #export test
Test
- (<| (_.context (%.name (name_of /._)))
- (_.test "Can derive functors automatically."
- true)))
+ (<| (_.covering /._)
+ (_.cover [/.functor]
+ true)))
diff --git a/stdlib/source/test/lux/macro/syntax/common.lux b/stdlib/source/test/lux/macro/syntax/common.lux
index 429b7fc6e..2929417e3 100644
--- a/stdlib/source/test/lux/macro/syntax/common.lux
+++ b/stdlib/source/test/lux/macro/syntax/common.lux
@@ -33,7 +33,9 @@
["#." check]
["#." declaration]
["#." definition]
- ["#." export]])
+ ["#." export]
+ ["#." type #_
+ ["#/." variable]]])
(def: random_text
(Random Text)
@@ -46,18 +48,6 @@
(_.covering /writer._)
($_ _.and
(do {! random.monad}
- [size (\ ! map (|>> (n.% 3)) random.nat)
- expected (random.list size ..random_text)]
- (_.cover [/.Type_Var /reader.type_variables /writer.type_variables]
- (|> expected
- /writer.type_variables
- (<c>.run /reader.type_variables)
- (case> (#try.Success actual)
- (\ (list.equivalence text.equivalence) = expected actual)
-
- (#try.Failure error)
- false))))
- (do {! random.monad}
[expected (: (Random /.Typed_Input)
(random.and ///code.random
///code.random))]
@@ -77,4 +67,5 @@
/declaration.test
/definition.test
/export.test
+ /type/variable.test
)))
diff --git a/stdlib/source/test/lux/macro/syntax/common/annotations.lux b/stdlib/source/test/lux/macro/syntax/common/annotations.lux
index bc29a00f6..b1369ef48 100644
--- a/stdlib/source/test/lux/macro/syntax/common/annotations.lux
+++ b/stdlib/source/test/lux/macro/syntax/common/annotations.lux
@@ -49,4 +49,5 @@
false
(#try.Success actual)
- (\ /.equivalence = expected actual)))))))
+ (\ /.equivalence = expected actual))))
+ )))
diff --git a/stdlib/source/test/lux/macro/syntax/common/type/variable.lux b/stdlib/source/test/lux/macro/syntax/common/type/variable.lux
new file mode 100644
index 000000000..4701f5aef
--- /dev/null
+++ b/stdlib/source/test/lux/macro/syntax/common/type/variable.lux
@@ -0,0 +1,37 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
+ [control
+ ["." try ("#\." functor)]
+ [parser
+ ["<.>" code]]]
+ [math
+ ["." random (#+ Random)]]]
+ {1
+ ["." /]})
+
+(def: #export random
+ (Random /.Variable)
+ (random.ascii/alpha 10))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Variable])
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
+ (do random.monad
+ [expected ..random]
+ (_.cover [/.format /.parser]
+ (|> (list (/.format expected))
+ (<code>.run /.parser)
+ (try\map (\ /.equivalence = expected))
+ (try.default false))))
+ )))
diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux
index a8c7c121e..a140a736d 100644
--- a/stdlib/source/test/lux/math.lux
+++ b/stdlib/source/test/lux/math.lux
@@ -21,17 +21,12 @@
["#/." continuous]
["#/." fuzzy]]])
-(def: (within? margin_of_error standard value)
- (-> Frac Frac Frac Bit)
- (f.< margin_of_error
- (f.abs (f.- standard value))))
-
(def: margin Frac +0.0000001)
(def: (trigonometric_symmetry forward backward angle)
(-> (-> Frac Frac) (-> Frac Frac) Frac Bit)
(let [normal (|> angle forward backward)]
- (|> normal forward backward (within? margin normal))))
+ (|> normal forward backward (f.approximately? margin normal))))
(def: #export test
Test
@@ -71,7 +66,7 @@
(do {! random.monad}
[sample (|> random.safe_frac (\ ! map (f.* +10.0)))]
(_.test "Logarithm is the inverse of exponential."
- (|> sample /.exp /.log (within? +0.000000000000001 sample)))))
+ (|> sample /.exp /.log (f.approximately? +0.000000000000001 sample)))))
(<| (_.context "Greatest-Common-Divisor and Least-Common-Multiple")
(do {! random.monad}
[#let [gen_nat (|> random.nat (\ ! map (|>> (n.% 1000) (n.max 1))))]
diff --git a/stdlib/source/test/lux/math/number/complex.lux b/stdlib/source/test/lux/math/number/complex.lux
index 751ec9022..11f729aac 100644
--- a/stdlib/source/test/lux/math/number/complex.lux
+++ b/stdlib/source/test/lux/math/number/complex.lux
@@ -60,10 +60,10 @@
(let [r+i (/.complex real)]
(and (f.= real (get@ #/.real r+i))
(f.= +0.0 (get@ #/.imaginary r+i))))))
- (_.cover [/.within?]
- (/.within? ..margin_of_error
- (/.complex real imaginary)
- (/.complex real imaginary)))
+ (_.cover [/.approximately?]
+ (/.approximately? ..margin_of_error
+ (/.complex real imaginary)
+ (/.complex real imaginary)))
(_.cover [/.not_a_number?]
(and (/.not_a_number? (/.complex f.not_a_number imaginary))
(/.not_a_number? (/.complex real f.not_a_number))))
@@ -119,10 +119,10 @@
(_.cover [/.argument]
(let [sample (/.complex real imaginary)]
(or (/.= /.zero sample)
- (/.within? ..margin_of_error
- sample
- (/.*' (/.abs sample)
- (/.exp (/.* /.i (/.complex (/.argument sample)))))))))
+ (/.approximately? ..margin_of_error
+ sample
+ (/.*' (/.abs sample)
+ (/.exp (/.* /.i (/.complex (/.argument sample)))))))))
)))
(def: number
@@ -149,23 +149,23 @@
(get@ #/.imaginary x))))))
inverse!
- (and (|> x (/.+ y) (/.- y) (/.within? ..margin_of_error x))
- (|> x (/.- y) (/.+ y) (/.within? ..margin_of_error x)))]
+ (and (|> x (/.+ y) (/.- y) (/.approximately? ..margin_of_error x))
+ (|> x (/.- y) (/.+ y) (/.approximately? ..margin_of_error x)))]
(and normal!
inverse!)))
(_.cover [/.* /./]
- (|> x (/.* y) (/./ y) (/.within? ..margin_of_error x)))
+ (|> x (/.* y) (/./ y) (/.approximately? ..margin_of_error x)))
(_.cover [/.*' /./']
- (|> x (/.*' factor) (/./' factor) (/.within? ..margin_of_error x)))
+ (|> x (/.*' factor) (/./' factor) (/.approximately? ..margin_of_error x)))
(_.cover [/.%]
(let [rem (/.% y x)
quotient (|> x (/.- rem) (/./ y))
floored (|> quotient
(update@ #/.real math.floor)
(update@ #/.imaginary math.floor))]
- (/.within? +0.000000000001
- x
- (|> quotient (/.* y) (/.+ rem)))))
+ (/.approximately? +0.000000000001
+ x
+ (|> quotient (/.* y) (/.+ rem)))))
)))
(def: conjugate&reciprocal&signum&negation
@@ -181,10 +181,10 @@
(get@ #/.imaginary cx)))))
(_.cover [/.reciprocal]
(let [reciprocal!
- (|> x (/.* (/.reciprocal x)) (/.within? ..margin_of_error /.+one))
+ (|> x (/.* (/.reciprocal x)) (/.approximately? ..margin_of_error /.+one))
own_inverse!
- (|> x /.reciprocal /.reciprocal (/.within? ..margin_of_error x))]
+ (|> x /.reciprocal /.reciprocal (/.approximately? ..margin_of_error x))]
(and reciprocal!
own_inverse!)))
(_.cover [/.signum]
@@ -210,7 +210,7 @@
(def: (trigonometric_symmetry forward backward angle)
(-> (-> /.Complex /.Complex) (-> /.Complex /.Complex) /.Complex Bit)
(let [normal (|> angle forward backward)]
- (|> normal forward backward (/.within? ..margin_of_error normal))))
+ (|> normal forward backward (/.approximately? ..margin_of_error normal))))
(def: trigonometry
Test
@@ -230,17 +230,17 @@
[angle ..angle]
($_ _.and
(_.cover [/.sinh]
- (/.within? ..margin_of_error
- (|> angle (/.* /.i) /.sin (/.* /.i) (/.* /.-one))
- (/.sinh angle)))
+ (/.approximately? ..margin_of_error
+ (|> angle (/.* /.i) /.sin (/.* /.i) (/.* /.-one))
+ (/.sinh angle)))
(_.cover [/.cosh]
- (/.within? ..margin_of_error
- (|> angle (/.* /.i) /.cos)
- (/.cosh angle)))
+ (/.approximately? ..margin_of_error
+ (|> angle (/.* /.i) /.cos)
+ (/.cosh angle)))
(_.cover [/.tanh]
- (/.within? ..margin_of_error
- (|> angle (/.* /.i) /.tan (/.* /.i) (/.* /.-one))
- (/.tanh angle)))
+ (/.approximately? ..margin_of_error
+ (|> angle (/.* /.i) /.tan (/.* /.i) (/.* /.-one))
+ (/.tanh angle)))
)))
(def: exponentiation&logarithm
@@ -249,11 +249,11 @@
[x ..random]
($_ _.and
(_.cover [/.pow /.root/2]
- (|> x (/.pow (/.complex +2.0)) /.root/2 (/.within? ..margin_of_error x)))
+ (|> x (/.pow (/.complex +2.0)) /.root/2 (/.approximately? ..margin_of_error x)))
(_.cover [/.pow']
- (|> x (/.pow' +2.0) (/.pow' +0.5) (/.within? ..margin_of_error x)))
+ (|> x (/.pow' +2.0) (/.pow' +0.5) (/.approximately? ..margin_of_error x)))
(_.cover [/.log /.exp]
- (|> x /.log /.exp (/.within? ..margin_of_error x)))
+ (|> x /.log /.exp (/.approximately? ..margin_of_error x)))
)))
(def: root
@@ -265,7 +265,7 @@
(|> sample
(/.roots degree)
(list\map (/.pow' (|> degree .int int.frac)))
- (list.every? (/.within? ..margin_of_error sample))))))
+ (list.every? (/.approximately? ..margin_of_error sample))))))
(def: #export test
Test
diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux
index 2bd56a513..0bbe19697 100644
--- a/stdlib/source/test/lux/math/number/frac.lux
+++ b/stdlib/source/test/lux/math/number/frac.lux
@@ -63,9 +63,9 @@
(_.cover [/.zero?]
(bit\= (/.zero? sample)
(/.= +0.0 sample)))
- (_.cover [/.within?]
- (and (/.within? /.smallest sample sample)
- (/.within? (/.+ +1.0 shift) sample (/.+ shift sample))))
+ (_.cover [/.approximately?]
+ (and (/.approximately? /.smallest sample sample)
+ (/.approximately? (/.+ +1.0 shift) sample (/.+ shift sample))))
(_.cover [/.number?]
(and (not (/.number? /.not_a_number))
(not (/.number? /.positive_infinity))
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 3f92e9d13..2315165ef 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -22,7 +22,8 @@
{1
["." /]}
["." / #_
- ["#." annotation]])
+ ["#." annotation]
+ ["#." location]])
(template: (!expect <pattern> <value>)
(case <value>
@@ -303,4 +304,5 @@
))
/annotation.test
+ /location.test
)))
diff --git a/stdlib/source/test/lux/meta/location.lux b/stdlib/source/test/lux/meta/location.lux
new file mode 100644
index 000000000..5c9d43d50
--- /dev/null
+++ b/stdlib/source/test/lux/meta/location.lux
@@ -0,0 +1,50 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
+ [data
+ ["." text]]
+ [math
+ ["." random (#+ Random)]]]
+ {1
+ ["." /]}
+ ["$." /// #_
+ [macro
+ ["#." code]]])
+
+(def: #export random
+ (Random Location)
+ ($_ random.and
+ (random.ascii/alpha 10)
+ random.nat
+ random.nat
+ ))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.for [.Location])
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
+ (_.cover [/.here]
+ (not (\ /.equivalence = (/.here) (/.here))))
+ (do random.monad
+ [location ..random
+ error (random.ascii/alpha 10)]
+ (_.cover [/.format /.with]
+ (let [located_error (/.with location error)]
+ (and (text.contains? (/.format location)
+ located_error)
+ (text.contains? error
+ located_error)))))
+ (do random.monad
+ [[location _] $///code.random]
+ (_.cover [/.dummy]
+ (\ /.equivalence = /.dummy location)))
+ )))
diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux
index 3a5a79711..a04371340 100644
--- a/stdlib/source/test/lux/target/jvm.lux
+++ b/stdlib/source/test/lux/target/jvm.lux
@@ -250,7 +250,7 @@
(def: $Double::random (:coerce (Random java/lang/Double) random.frac))
(def: $Double::literal
(-> java/lang/Double (Bytecode Any))
- (|>> (:coerce Frac) /.double))
+ /.double)
(def: valid_double
(Random java/lang/Double)
(random.filter (|>> (:coerce Frac) f.not_a_number? not)
@@ -794,14 +794,14 @@
@.jvm
(|>> (:coerce java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected)))}))
(do /.monad
- [_ (/.double (:coerce Frac expected))]
+ [_ (/.double expected)]
(/.invokestatic ..$Double "valueOf" (/type.method [(list /type.double) ..$Double (list)]))))
(<| (_.lift "INVOKEVIRTUAL")
(do random.monad
[expected ..$Double::random])
(..bytecode (|>> (:coerce Bit) (bit\= (f.not_a_number? (:coerce Frac expected)))))
(do /.monad
- [_ (/.double (:coerce Frac expected))
+ [_ (/.double expected)
_ ..$Double::wrap
_ (/.invokevirtual ..$Double "isNaN" (/type.method [(list) /type.boolean (list)]))]
..$Boolean::wrap))
@@ -817,7 +817,7 @@
(do /.monad
[_ (/.new ..$Double)
_ /.dup
- _ (/.double (:coerce Frac expected))]
+ _ (/.double expected)]
(/.invokespecial ..$Double "<init>" (/type.method [(list /type.double) /type.void (list)]))))
(<| (_.lift "INVOKEINTERFACE")
(do random.monad