diff options
Diffstat (limited to 'stdlib/source/test/lux/math/logic/fuzzy.lux')
-rw-r--r-- | stdlib/source/test/lux/math/logic/fuzzy.lux | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 10b75195a..64051ffd9 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -116,28 +116,26 @@ right ..triangle sample r.rev] ($_ _.and - (_.test "Union membership as as high as membership in any of its members." + (_.test (%name (name-of /.union)) (let [combined (/.union left right) combined-membership (/.membership sample combined)] (and (r/>= (/.membership sample left) combined-membership) (r/>= (/.membership sample right) combined-membership)))) - (_.test "Intersection membership as as low as membership in any of its members." + (_.test (%name (name-of /.intersection)) (let [combined (/.intersection left right) combined-membership (/.membership sample combined)] (and (r/<= (/.membership sample left) combined-membership) (r/<= (/.membership sample right) combined-membership)))) - (_.test "Complement membership is the opposite of normal membership." + (_.test (%name (name-of /.complement)) (r/= (/.membership sample left) (//.not (/.membership sample (/.complement left))))) - (_.test "Membership in the difference will never be higher than in the set being subtracted." - (bit@= (r/> (/.membership sample right) - (/.membership sample left)) - (r/< (/.membership sample left) - (/.membership sample (/.difference left right))))) + (_.test (%name (name-of /.difference)) + (r/<= (/.membership sample right) + (/.membership sample (/.difference left right)))) )))) (def: predicates-and-sets @@ -146,16 +144,12 @@ [#let [set-10 (set.from-list nat.hash (list.n/range 0 10))] sample (|> r.nat (:: @ map (n/% 20)))] ($_ _.and - (<| (_.context (%name (name-of /.from-predicate))) - (_.test (format "Values that satisfy a predicate have membership = 1." - "Values that don't have membership = 0.") - (bit@= (r/= //.true (/.membership sample (/.from-predicate n/even?))) - (n/even? sample)))) - (<| (_.context (%name (name-of /.from-set))) - (_.test (format "Values that belong to a set have membership = 1." - "Values that don't have membership = 0.") - (bit@= (r/= //.true (/.membership sample (/.from-set set-10))) - (set.member? set-10 sample)))) + (_.test (%name (name-of /.from-predicate)) + (bit@= (r/= //.true (/.membership sample (/.from-predicate n/even?))) + (n/even? sample))) + (_.test (%name (name-of /.from-set)) + (bit@= (r/= //.true (/.membership sample (/.from-set set-10))) + (set.member? set-10 sample))) ))) (def: thresholds |