Skip to content

Commit

Permalink
turn on hpc for Tests, test UpCasting
Browse files Browse the repository at this point in the history
  • Loading branch information
jberryman committed Jan 28, 2012
1 parent 316f250 commit 5ff0597
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ data Tree a = Branch (Tree a) (Tree a)
-- Don't know the appropriate way to run batch job:
main = defaultMain tests


tests =
[ testProperty "simple zipper creation" prop_simple_creation
, testProperty "recursive descent/ascent" prop_simple_recursive_movement
Expand All @@ -69,6 +70,7 @@ tests =
, testProperty "test successfully-performed move up" prop_moveUpSaving
, testProperty "moving up past top throws error" prop_simple_moveUp_past_top
, testProperty "moving up 0 to correct type succeeds and is id" prop_move_Up_0_is_id
, testProperty "move UpCasting works" prop_move_UpCasting
]


Expand Down Expand Up @@ -179,4 +181,11 @@ prop_move_Up_0_is_id s = maybe False (== s) $ move (Up 0 :: Up String String) (z


-- test move (UpCasting success and failure)
--
prop_move_UpCasting :: ((),((),(Int,Int))) -> Bool
prop_move_UpCasting tup = maybe False id $
return (zipper tup) >>=
move (to lSnd) >>= \zCheck -> -- ((),(Int,Int))
move (to lSnd) zCheck >>=
move (UpCasting :: UpCasting (Int,Int) ((),(Int,Int)) ) >>=
\z-> if (viewf z == viewf zCheck) then return True else return False

1 change: 1 addition & 0 deletions pez.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Test-Suite zipper-tests
Type: exitcode-stdio-1.0
Main-is: Tests.hs
Build-depends: base, QuickCheck, test-framework, test-framework-quickcheck2
GHC-Options: -fhpc -hpcdir dist/test/


Library
Expand Down

0 comments on commit 5ff0597

Please sign in to comment.