fixing compliation issue, adding unit tests for parsing

This commit is contained in:
Chris Stewart 2016-01-07 22:07:03 -06:00
parent 327844fa3b
commit 7159df8e6b
3 changed files with 13 additions and 8 deletions

View File

@ -7,7 +7,7 @@ trait ScriptParser {
/**
* Parses a script inside of a transaction
* Parses a script inside of a transaction
* @param str
* @tparam T
* @return

View File

@ -10,7 +10,12 @@ class ScriptParserTest extends FlatSpec with MustMatchers with ScriptParser {
"ScriptParser" must "parse an input script" in {
val parsedInput = parse(TestUtil.p2khInputScriptNotParsed)
val parsedInput = parse(TestUtil.p2pkhInputScriptNotParsed)
parsedInput must be (TestUtil.p2pkhInputScript)
}
it must "parse an output script" in {
val parsedOutput = parse(TestUtil.p2pkhOutputScriptNotParsed)
parsedOutput must be (TestUtil.p2pkhOutputScript)
}
}

View File

@ -17,11 +17,11 @@ object TestUtil {
val multiSigAddress = BitcoinAddress("342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey")
val assetAddress = AssetAddress("akJsoCcyh34FGPotxfEoSXGwFPCNAkyCgTA")
val p2khInputScriptNotParsed =
val p2pkhInputScriptNotParsed =
"3044022016ffdbb7c57634903c5e018fcfc48d59f4e37dc4bc3bbc9ba4e6ee39150bca030220119c2241a931819bc1a75d3596e4029d803d1cd6de123bf8a1a1a2c3665e1fac01" +
" 02af7dad03e682fcd0427b5c24140c220ac9d8abe286c15f8cf5bf77eed19c365
val p2khInputScript = List("3044022016ffdbb7c57634903c5e018fcfc48d59f4e37dc4bc3bbc9ba4e6ee39150bca030220119c2241a931819bc1a75d3596e4029d803d1cd6de123bf8a1a1a2c3665e1fac01",
"02af7dad03e682fcd0427b5c24140c220ac9d8abe286c15f8cf5bf77eed19c3652")2"
val p2pkhOutputScriptNotParsed = "OP_DUP OP_HASH160 e2e7c1ab3f807151e832dd1accb3d4f5d7d19b4b OP_EQUALVERIFY OP_CHECKSI
val p2khOutputScript = List(OP_DUP,OP_HASH160,ConstantImpl("e2e7c1ab3f807151e832dd1accb3d4f5d7d19b4b"),OP_EQUALVERIFY, OP_CHECKSIG)
" 02af7dad03e682fcd0427b5c24140c220ac9d8abe286c15f8cf5bf77eed19c365"
val p2pkhInputScript = List("3044022016ffdbb7c57634903c5e018fcfc48d59f4e37dc4bc3bbc9ba4e6ee39150bca030220119c2241a931819bc1a75d3596e4029d803d1cd6de123bf8a1a1a2c3665e1fac01",
"02af7dad03e682fcd0427b5c24140c220ac9d8abe286c15f8cf5bf77eed19c3652")
val p2pkhOutputScriptNotParsed = "OP_DUP OP_HASH160 e2e7c1ab3f807151e832dd1accb3d4f5d7d19b4b OP_EQUALVERIFY OP_CHECKSIG"
val p2pkhOutputScript = List(OP_DUP,OP_HASH160,ConstantImpl("e2e7c1ab3f807151e832dd1accb3d4f5d7d19b4b"),OP_EQUALVERIFY, OP_CHECKSIG)
}