diff options
-rw-r--r-- | assignment-12/cashModel.icl | 14 | ||||
-rw-r--r-- | assignment-12/gastje.icl | 4 |
2 files changed, 5 insertions, 13 deletions
diff --git a/assignment-12/cashModel.icl b/assignment-12/cashModel.icl index c9dfc55..d76b357 100644 --- a/assignment-12/cashModel.icl +++ b/assignment-12/cashModel.icl @@ -109,17 +109,5 @@ where Start = test fairness where fairness :: [Product] Product -> Property - fairness ps p = value newps =.= value ps + value out + fairness ps p = euro newps =.= euro ps + euro out where (newps, out) = model ps (Rem p) - -class value a :: (a -> Real) -instance value Real where value = id -instance value [a] | value a where value = sum o map value -instance value Euro where value = \e -> toReal e.euro * 100.0 + toReal (sign e.euro * e.cent) -instance value Product where value = value o euro -instance value Action -where - value = \a -> case a of - Add p -> value p - Rem p -> ~(value p) - Pay -> 0.0 diff --git a/assignment-12/gastje.icl b/assignment-12/gastje.icl index d3b20ce..62f9238 100644 --- a/assignment-12/gastje.icl +++ b/assignment-12/gastje.icl @@ -115,6 +115,10 @@ where // This fails for 0; should be <=. If we fix that, the test does not // terminate, as there are no 1000 integers with abs i < 10. + // Another option is to use: + // holds (False ==> t) p = [{prop & bool=True} \\ prop <- holds t p] + // I.e., *do* count cases where the antecedent is False. However, that can + // give a wrong idea about the test coverage. fac :: Int -> Int fac n | n < 0 = 1 |