From a715d029f7f2a027a8ff8f65354947b207f40c61 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 13 Sep 2021 22:35:23 +0200 Subject: [PATCH] Fix Haskell tests after changes to categoryContext and functionProb --- src/runtime/haskell/tests/basic.hs | 8 ++++---- src/runtime/haskell/tests/transactions.hs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/runtime/haskell/tests/basic.hs b/src/runtime/haskell/tests/basic.hs index a2a28aaba..e7e977520 100644 --- a/src/runtime/haskell/tests/basic.hs +++ b/src/runtime/haskell/tests/basic.hs @@ -21,10 +21,10 @@ main = do ,TestCase (assertBool "type of z" (eqJust (readType "N") (functionType gr "z"))) ,TestCase (assertBool "type of s" (eqJust (readType "N->N") (functionType gr "s"))) ,TestCase (assertBool "type of c" (eqJust (readType "N->S") (functionType gr "c"))) - ,TestCase (assertEqual "category context 1" [] (categoryContext gr "N")) - ,TestCase (assertEqual "category context 2" [] (categoryContext gr "S")) - ,TestCase (assertEqual "category context 3" [(Explicit,"_",DTyp [] "N" [])] (categoryContext gr "P")) - ,TestCase (assertEqual "category context 4" [] (categoryContext gr "X")) -- no such category + ,TestCase (assertEqual "category context 1" (Just []) (categoryContext gr "N")) + ,TestCase (assertEqual "category context 2" (Just []) (categoryContext gr "S")) + ,TestCase (assertEqual "category context 3" (Just [(Explicit,"_",DTyp [] "N" [])]) (categoryContext gr "P")) + ,TestCase (assertEqual "category context 4" Nothing (categoryContext gr "X")) -- no such category ,TestCase (assertEqual "function is constructor 1" True (functionIsConstructor gr "s")) ,TestCase (assertEqual "function is constructor 2" True (functionIsConstructor gr "z")) ,TestCase (assertEqual "function is constructor 3" True (functionIsConstructor gr "c")) diff --git a/src/runtime/haskell/tests/transactions.hs b/src/runtime/haskell/tests/transactions.hs index 37e75776e..fbd62f0d1 100644 --- a/src/runtime/haskell/tests/transactions.hs +++ b/src/runtime/haskell/tests/transactions.hs @@ -28,16 +28,16 @@ main = do ,TestCase (assertEqual "original categories" ["Float","Int","N","P","S","String"] (categories gr1)) ,TestCase (assertEqual "extended categories" ["Float","Int","N","P","Q","S","String"] (categories gr2)) ,TestCase (assertEqual "branched categories" ["Float","Int","N","P","R","S","String"] (categories gr3)) - ,TestCase (assertEqual "Q context" [(Explicit,"x",ty)] (categoryContext gr2 "Q")) - ,TestCase (assertEqual "R context" [(Explicit,"x",ty)] (categoryContext gr3 "R")) + ,TestCase (assertEqual "Q context" (Just [(Explicit,"x",ty)]) (categoryContext gr2 "Q")) + ,TestCase (assertEqual "R context" (Just [(Explicit,"x",ty)]) (categoryContext gr3 "R")) ,TestCase (assertEqual "reduced functions" ["c","s","z"] (functions gr6)) ,TestCase (assertEqual "reduced categories" ["Float","Int","N","P","String"] (categories gr6)) ,TestCase (assertEqual "old function type" Nothing (functionType gr1 "foo")) ,TestCase (assertEqual "new function type" (Just ty) (functionType gr2 "foo")) - ,TestCase (assertEqual "old function prob" (-log 0) (functionProb gr1 "foo")) - ,TestCase (assertEqual "new function prob" pi (functionProb gr2 "foo")) + ,TestCase (assertEqual "old function prob" (-log 0) (functionProbability gr1 "foo")) + ,TestCase (assertEqual "new function prob" pi (functionProbability gr2 "foo")) ] - + performMajorGC if (errors c == 0) && (failures c == 0)