Skip to content

Commit

Permalink
feat(std): add ordering assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Etherian committed Oct 16, 2019
1 parent 58e0043 commit 3efac99
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions std/test.glu
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ let assert_neq l r : [Show a] -> [Eq a] -> a -> a -> Eff [| writer : Test | r |]
if l /= r then wrap ()
else tell (Cons ("Assertion failed: " <> show l <> " == " <> show r) Nil)

let assert_lt l r : [Show a] -> [Ord a] -> a -> a -> Eff [| writer : Test | r |] () =
if l < r then wrap ()
else tell (Cons ("Assertion failed: " <> show l <> " >= " <> show r) Nil)

let assert_lte l r : [Show a] -> [Ord a] -> a -> a -> Eff [| writer : Test | r |] () =
if l <= r then wrap ()
else tell (Cons ("Assertion failed: " <> show l <> " > " <> show r) Nil)

let assert_gt l r : [Show a] -> [Ord a] -> a -> a -> Eff [| writer : Test | r |] () =
if l > r then wrap ()
else tell (Cons ("Assertion failed: " <> show l <> " <= " <> show r) Nil)

let assert_gte l r : [Show a] -> [Ord a] -> a -> a -> Eff [| writer : Test | r |] () =
if l >= r then wrap ()
else tell (Cons ("Assertion failed: " <> show l <> " < " <> show r) Nil)

let assert_ok res : [Show e] -> Result e a -> Eff [| writer : Test | r |] () =
match res with
| Ok _ -> wrap ()
Expand Down

0 comments on commit 3efac99

Please sign in to comment.