ability to run code and check output in tests

This commit is contained in:
2024-12-28 13:19:15 -08:00
parent 95f90c8698
commit a6e68ac2a2
62 changed files with 459 additions and 31 deletions

24
tests/Equality.newt Normal file
View File

@@ -0,0 +1,24 @@
module Equality
data Eq : {A : U} -> A -> A -> U where
Refl : {A : U} {a : A} -> Eq a a
-- Some magic is not happening here.
sym : {A : U} {x y : A} -> Eq x y -> Eq y x
sym Refl = Refl
trans : {A : U} {x y z : A} -> Eq x y -> Eq y z -> Eq x z
trans Refl Refl = Refl
coerce : {A B : U} -> Eq A B -> A -> B
coerce Refl a = a
J : {A : U} ->
{C : (x y : A) -> Eq x y -> U} ->
(c : (x : _) -> C x x Refl) ->
(x y : A) ->
(p : Eq x y) ->
C x y p
-- this was failing until I constrained scrutinee to the constructor + args
J c x y Refl = c x