From e853e9340d41724a86c9c0a837d86b2764bfcbab Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 30 Jun 2022 13:26:43 -0400 Subject: Better naming for measure/quantity types. --- stdlib/source/test/lux/data/format/json.lux | 10 +++++----- stdlib/source/test/lux/type/unit.lux | 14 +++++++------- stdlib/source/test/lux/type/unit/scale.lux | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 8116043d2..7be586b4f 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -212,7 +212,7 @@ ... #instant instant.Instant ... #duration duration.Duration #date date.Date - #grams (unit.Qty unit.Gram)])) + #grams (unit.Measure unit.Gram)])) (def gen_recursive (Random Recursive) @@ -222,9 +222,9 @@ (random.and random.safe_frac gen_recursive))))) -(def qty - (All (_ unit) (Random (unit.Qty unit))) - (at random.monad each unit.quantity random.int)) +(def measure + (All (_ unit) (Random (unit.Measure unit))) + (at random.monad each unit.measure random.int)) (def gen_record (Random Record) @@ -243,7 +243,7 @@ ... \\test/instant.instant ... \\test/duration.duration random.date - ..qty + ..measure ))) (for @.old (these) diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index 6835769ba..b52ddd921 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -20,7 +20,7 @@ (with_template [ ] [(def ( range) - (-> Nat (Random (/.Qty Any ))) + (-> Nat (Random (/.Measure Any ))) (|> random.int (at random.monad each (i.% (.int range))) (random.only (|>> (i.= +0) not)) @@ -62,15 +62,15 @@ [/.Litre /.litre] [/.Second /.second] )) - (_.coverage [/.quantity /.number] + (_.coverage [/.measure /.number] (|> expected - /.quantity + /.measure /.number (i.= expected))) (_.coverage [/.unit /.type] (|> expected (at ..what in) - (is (/.Qty Any What)) + (is (/.Measure Any What)) (at ..what out) (i.= expected))) ))))) @@ -79,7 +79,7 @@ Test (do random.monad [.let [zero (at /.meter in +0) - (open "meter#[0]") (is (Equivalence (/.Qty Any /.Meter)) + (open "meter#[0]") (is (Equivalence (/.Measure Any /.Meter)) /.equivalence)] left (random.only (|>> (meter#= zero) not) (..meter 1,000)) right (..meter 1,000) @@ -95,7 +95,7 @@ )) (_.coverage [/.*] (let [expected (i.* (at /.meter out left) (at /.meter out right)) - actual (/.number (is (/.Qty Any [/.Meter /.Meter]) + actual (/.number (is (/.Measure Any [/.Meter /.Meter]) (/.* left right)))] (i.= expected actual))) (_.coverage [/./] @@ -108,7 +108,7 @@ (def .public test Test (<| (_.covering /._) - (_.for [/.Qty]) + (_.for [/.Measure]) (all _.and ..polymorphism ..unit diff --git a/stdlib/source/test/lux/type/unit/scale.lux b/stdlib/source/test/lux/type/unit/scale.lux index aa5d6fc1a..adc3523b5 100644 --- a/stdlib/source/test/lux/type/unit/scale.lux +++ b/stdlib/source/test/lux/type/unit/scale.lux @@ -45,7 +45,7 @@ (at ! each (i.% +1,000)) (at ! each (i.* +1,000,000,000)) (at ! each (at //.meter in))) - .let [(open "meter#[0]") (is (Equivalence (//.Qty Any //.Meter)) + .let [(open "meter#[0]") (is (Equivalence (//.Measure Any //.Meter)) //.equivalence)] unscaled (|> random.int (at ! each (i.% +1,000)) @@ -56,9 +56,9 @@ [(_.coverage [ ] (|> small (at up) - (is (//.Qty //.Meter)) + (is (//.Measure //.Meter)) (at down) - (is (//.Qty Any //.Meter)) + (is (//.Measure Any //.Meter)) (meter#= small)))] [/.Kilo /.kilo] @@ -69,9 +69,9 @@ [(_.coverage [ ] (|> large (at up) - (is (//.Qty //.Meter)) + (is (//.Measure //.Meter)) (at down) - (is (//.Qty Any //.Meter)) + (is (//.Measure Any //.Meter)) (meter#= large)))] [/.Milli /.milli] @@ -79,16 +79,16 @@ [/.Nano /.nano] )) (_.coverage [/.re_scaled] - (|> large (is (//.Qty Any //.Meter)) - (at /.kilo up) (is (//.Qty /.Kilo //.Meter)) - (/.re_scaled /.kilo /.milli) (is (//.Qty /.Milli //.Meter)) - (/.re_scaled /.milli /.kilo) (is (//.Qty /.Kilo //.Meter)) - (at /.kilo down) (is (//.Qty Any //.Meter)) + (|> large (is (//.Measure Any //.Meter)) + (at /.kilo up) (is (//.Measure /.Kilo //.Meter)) + (/.re_scaled /.kilo /.milli) (is (//.Measure /.Milli //.Meter)) + (/.re_scaled /.milli /.kilo) (is (//.Measure /.Kilo //.Meter)) + (at /.kilo down) (is (//.Measure Any //.Meter)) (meter#= large))) (_.coverage [/.scale /.type] (and (|> unscaled (at ..how up) - (is (//.Qty How //.Meter)) + (is (//.Measure How //.Meter)) (at ..how down) (meter#= unscaled)) (ratio#= [ratio.#denominator ..how::from -- cgit v1.2.3