Verified Commit 18205d3d authored by Camil Staps's avatar Camil Staps 🚀

Made check type allow for relations of type (a b -> Bool)

parent 73590782
......@@ -29,7 +29,7 @@ instance \/ Bool Property
instance \/ Property Property
(=.=) infix 4 :: !a !a -> Property | Eq, genShow{|*|}, JSONEncode{|*|} a // shows values x and y if x =.= y yields False
check :: !(a a -> Bool) !a !a -> Property | genShow{|*|}, JSONEncode{|*|} a
check :: !(a b -> Bool) !a !b -> Property | genShow{|*|}, JSONEncode{|*|} a & genShow{|*|}, JSONEncode{|*|} b
class (==>) infixr 1 b :: !b p -> Property | Testable p
......
......@@ -157,7 +157,7 @@ ForEach list f = Prop ("ForEach " +++ thunk_name_to_string list +++ " " +++ thun
(For) infixl 0 :: !(x->p) ![x] -> Property | Testable p & TestArg x
(For) p list = ForEach list p
check :: !(a a -> Bool) !a !a -> Property | genShow{|*|}, JSONEncode{|*|} a
check :: !(a b -> Bool) !a !b -> Property | genShow{|*|}, JSONEncode{|*|} a & genShow{|*|}, JSONEncode{|*|} b
check op x y = Prop ("check " +++ thunk_name_to_string op) (affirm op (Other relName) x y)
where
relName = concat [thunk_name_to_string op, "{", thunk_to_module_name_string op, "}"]
......@@ -165,7 +165,7 @@ where
(=.=) infix 4 :: !a !a -> Property | Eq, genShow{|*|}, JSONEncode{|*|} a
(=.=) x y = Prop "=.=" (affirm (==) Eq x y)
affirm :: !(a a->Bool) !Relation a a .GenState !.Admin -> [Admin] | genShow{|*|}, JSONEncode{|*|} a
affirm :: !(a b->Bool) !Relation a b .GenState !.Admin -> [Admin] | genShow{|*|}, JSONEncode{|*|} a & genShow{|*|}, JSONEncode{|*|} b
affirm op rel x y rs admin
| op x y = evaluate True rs admin
| otherwise = evaluate
......
definition module Gast.ThunkNames
thunk_name_to_string :: !a -> String
thunk_to_module_name_string :: !(a a->Bool) -> String
thunk_to_module_name_string :: !a -> String
......@@ -15,10 +15,10 @@ thunk_name_to_string a = code {
.o 1 0
}
thunk_to_module_name_pointer :: ((a a->Bool) -> Int)
thunk_to_module_name_pointer :: (a -> Int)
thunk_to_module_name_pointer = IF_MAC v64mac (IF_INT_64_OR_32 v64 v32)
where
v32 :: !(a a -> Bool) -> Int
v32 :: !a -> Int
v32 _ = code {
pushD_a 0
pop_a 1
......@@ -28,7 +28,7 @@ where
load_i 6
}
v64 :: !(a a -> Bool) -> Int
v64 :: !a -> Int
v64 _ = code {
pushD_a 0
pop_a 1
......@@ -38,7 +38,7 @@ where
load_si32 6
}
v64mac :: !(a a -> Bool) -> Int
v64mac :: !a -> Int
v64mac _ = code {
pushD_a 0
pop_a 1
......@@ -52,7 +52,7 @@ where
addI
}
thunk_to_module_name_string :: !(a a->Bool) -> String;
thunk_to_module_name_string :: !a -> String;
thunk_to_module_name_string a
= get_module_name (thunk_to_module_name_pointer a);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment