Defining bitwise operations

This commit is contained in:
Chris Stewart 2016-01-06 15:30:42 -06:00
parent a062ac8e14
commit d3e8f3ee0b
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package org.scalacoin.script.bitwise
import org.scalacoin.script.ScriptOperation
/**
* Created by chris on 1/6/16.
*/
sealed trait BitwiseOperation extends ScriptOperation
/**
* Returns 1 if the inputs are exactly equal, 0 otherwise.
*/
case object OP_EQUAL extends ScriptOperation {
override def opCode = 135
}
/**
* Same as OP_EQUAL, but runs OP_VERIFY afterward.
*/
case object OP_EQUALVERIFY extends ScriptOperation {
override def opCode = 136
}

View File

@ -0,0 +1,18 @@
package org.scalacoin.script.bitwise
import org.scalatest.{FlatSpec, MustMatchers}
/**
* Created by chris on 1/6/16.
*/
class BitwiseOperationsTest extends FlatSpec with MustMatchers {
"BitwiseOperations" must "define OP_EQUAL" in {
OP_EQUAL.opCode must be (135)
}
it must "define OP_EQUALVERIFY" in {
OP_EQUALVERIFY.opCode must be (136)
}
}