From 4ca397765805eda5ddee393901ed3a02001a960a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 25 Dec 2020 09:22:38 -0400 Subject: Replaced kebab-case with snake_case for naming convention. --- stdlib/source/test/lux.lux | 94 +++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'stdlib/source/test/lux.lux') diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 7caf3eba1..c00ef0964 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -60,7 +60,7 @@ (not (is? self other)))) ))) -(def: increment-and-decrement +(def: increment_and_decrement Test (do random.monad [value random.i64] @@ -72,15 +72,15 @@ (and (|> (inc value) (n.- value) (n.= 1)) (|> value (n.- (dec value)) (n.= 1))))))) -(def: (check-neighbors has-property? value) +(def: (check_neighbors has_property? value) (All [a] (-> (Predicate (I64 a)) (I64 a) Bit)) - (and (|> value inc has-property?) - (|> value dec has-property?))) + (and (|> value inc has_property?) + (|> value dec has_property?))) -(def: (even-or-odd rand-gen even? odd?) +(def: (even_or_odd rand_gen even? odd?) (All [a] (-> (Random (I64 a)) (Predicate (I64 a)) (Predicate (I64 a)) Test)) (do random.monad - [value rand-gen] + [value rand_gen] ($_ _.and (_.test "Every number is either even or odd." (if (even? value) @@ -88,8 +88,8 @@ (odd? value))) (_.test "Every odd/even number is surrounded by two of the other kind." (if (even? value) - (check-neighbors odd? value) - (check-neighbors even? value)))))) + (check_neighbors odd? value) + (check_neighbors even? value)))))) (type: (Choice a) (-> a a a)) @@ -100,11 +100,11 @@ (type: (Equivalence a) (-> a a Bit)) -(def: (choice rand-gen = [< choose]) +(def: (choice rand_gen = [< choose]) (All [a] (-> (Random a) (Equivalence a) [(Order a) (Choice a)] Test)) (do random.monad - [left rand-gen - right rand-gen + [left rand_gen + right rand_gen #let [choice (choose left right)]] ($_ _.and (_.test "The choice between 2 values is one of them." @@ -115,27 +115,27 @@ (< right choice) (< left choice)))))) -(def: (minimum-and-maximum rand-gen = min' max') +(def: (minimum_and_maximum rand_gen = min' max') (All [a] (-> (Random a) (Equivalence a) [(Order a) (Choice a)] [(Order a) (Choice a)] Test)) ($_ _.and (<| (_.context "Minimum.") - (choice rand-gen = min')) + (choice rand_gen = min')) (<| (_.context "Maximum.") - (choice rand-gen = max')))) + (choice rand_gen = max')))) -(def: (conversion rand-gen forward backward =) +(def: (conversion rand_gen forward backward =) (All [a b] (-> (Random a) (-> a b) (-> b a) (Equivalence a) Test)) (do random.monad - [value rand-gen] + [value rand_gen] (_.test "Can convert between types in a lossless way." (|> value forward backward (= value))))) -(def: frac-rev +(def: frac_rev (Random Rev) - (let [bits-to-ignore 11] - (\ random.functor map (i64.left-shift bits-to-ignore) random.rev))) + (let [bits_to_ignore 11] + (\ random.functor map (i64.left_shift bits_to_ignore) random.rev))) -(def: prelude-macros +(def: prelude_macros Test ($_ _.and (do random.monad @@ -193,27 +193,27 @@ (n.= (n.+ (n.* cat0 cat0) (n.* cat1 cat1)) (quadrance cat0 cat1))))) -(def: cross-platform-support +(def: cross_platform_support Test (do random.monad - [on-default random.nat - on-fake-host random.nat - on-valid-host random.nat] + [on_default random.nat + on_fake_host random.nat + on_valid_host random.nat] ($_ _.and (_.test "Can provide default in case there is no particular host/platform support." - (n.= on-default - (for {"" on-fake-host} - on-default))) + (n.= on_default + (for {"" on_fake_host} + on_default))) (_.test "Can pick code depending on the host/platform being targeted." - (n.= on-valid-host - (for {@.old on-valid-host - @.jvm on-valid-host - @.js on-valid-host} - on-default)))))) + (n.= on_valid_host + (for {@.old on_valid_host + @.jvm on_valid_host + @.js on_valid_host} + on_default)))))) -(def: sub-tests +(def: sub_tests Test - (_.in-parallel (list& /abstract.test + (_.in_parallel (list& /abstract.test /control.test /data.test /locale.test @@ -231,50 +231,50 @@ ))) (def: test - (<| (_.context (name.module (name-of /._))) - (_.in-parallel + (<| (_.context (name.module (name_of /._))) + (_.in_parallel (list (!bundle ($_ _.and (<| (_.context "Identity.") ..identity) (<| (_.context "Increment & decrement.") - ..increment-and-decrement) + ..increment_and_decrement) (<| (_.context "Even or odd.") ($_ _.and (<| (_.context "Natural numbers.") - (..even-or-odd random.nat n.even? n.odd?)) + (..even_or_odd random.nat n.even? n.odd?)) (<| (_.context "Integers.") - (..even-or-odd random.int i.even? i.odd?)))) + (..even_or_odd random.int i.even? i.odd?)))) (<| (_.context "Minimum and maximum.") (`` ($_ _.and (~~ (template [<=> ] [(<| (_.context ) - (..minimum-and-maximum <=> [ ] [ ]))] + (..minimum_and_maximum <=> [ ] [ ]))] [i.= i.< i.min i.> i.max random.int "Integers."] [n.= n.< n.min n.> n.max random.nat "Natural numbers."] [r.= r.< r.min r.> r.max random.rev "Revolutions."] - [f.= f.< f.min f.> f.max random.safe-frac "Fractions."] + [f.= f.< f.min f.> f.max random.safe_frac "Fractions."] ))))) (<| (_.context "Conversion.") (`` ($_ _.and (~~ (template [<=> ] - [(<| (_.context (format (%.name (name-of )) - " " (%.name (name-of )))) + [(<| (_.context (format (%.name (name_of )) + " " (%.name (name_of )))) (..conversion <=>))] [i.= .nat .int (random\map (i.% +1,000,000) random.int)] [n.= .int .nat (random\map (n.% 1,000,000) random.nat)] [i.= i.frac f.int (random\map (i.% +1,000,000) random.int)] [f.= f.int i.frac (random\map (|>> (i.% +1,000,000) i.frac) random.int)] - [r.= r.frac f.rev frac-rev] + [r.= r.frac f.rev frac_rev] ))))) (<| (_.context "Prelude macros.") - ..prelude-macros) + ..prelude_macros) (<| (_.context "Templates.") ..templates) (<| (_.context "Cross-platform support.") - ..cross-platform-support))) - ..sub-tests + ..cross_platform_support))) + ..sub_tests )))) (program: args -- cgit v1.2.3