-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Bernauer
committed
Oct 20, 2011
1 parent
afa8cc9
commit 44fa9e8
Showing
7 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
OP_TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Language.Bitcoin.Test.Parser | ||
( | ||
tests | ||
) where | ||
|
||
import Language.Bitcoin.Parser (run_parser') | ||
import Language.Bitcoin.Types | ||
import Test.HUnit | ||
|
||
tests = TestLabel "Parser" $ TestList $ good ++ bad | ||
|
||
goodCases = [ | ||
("OP_FALSE\n", [OP_FALSE]) | ||
, ("OP_FALSE;", [OP_FALSE]) | ||
, (" OP_FALSE;", [OP_FALSE]) | ||
, ("OP_FALSE;OP_TRUE;", [OP_FALSE, OP_TRUE]) | ||
, ("OP_FALSE\nOP_TRUE;", [OP_FALSE, OP_TRUE]) | ||
] | ||
|
||
badCases = [ | ||
"OP_DOESNOTEXIST;" | ||
] | ||
|
||
good :: [Test] | ||
good = map runTest goodCases | ||
where | ||
runTest (code, expected) = TestCase $ | ||
case run_parser' "<<test>>" code of | ||
Left e -> assertString $ show e | ||
Right script -> expected @=? script | ||
|
||
|
||
bad :: [Test] | ||
bad = map runTest badCases | ||
where | ||
runTest code = TestCase $ | ||
case run_parser' "<<test>>" code of | ||
Left _ -> return () | ||
Right _ -> assertString "Parser should have failed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters