add testing frameworks

This commit is contained in:
Mark Canlas 2020-08-15 00:49:07 -04:00
parent 69286c8a86
commit 59c8c06a26
6 changed files with 49 additions and 41 deletions

View File

@ -3,7 +3,8 @@ lazy val root =
.in(file("."))
.settings(
initialCommands in console := "import com.htmlism._",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.1" % "test",
scalafmtOnCompile := true
)
.withCats
.withTesting
.withTestingBeta

View File

@ -13,6 +13,14 @@ object ProjectPlugin extends AutoPlugin {
def withCats: Project =
p
.settings(libraryDependencies += "org.typelevel" %% "cats-core" % "2.2.0-RC2")
def withTesting: Project =
p.settings(libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.1" % "test")
def withTestingBeta: Project =
p.settings(
libraryDependencies += "com.disneystreaming" %% "weaver-framework" % "0.4.2" % Test,
testFrameworks += new TestFramework("weaver.framework.TestFramework"))
}
}
}

View File

@ -26,7 +26,7 @@ object MatchOpcodes {
0x96 -> (STX -> ZeroPageY),
0xB6 -> (LDX -> ZeroPageY),
0xBE -> (LDX -> AbsoluteY),
0xBE -> (LDX -> AbsoluteY)
)
def injectedOpcodesRelative: Map[Int, (Instruction, AddressingMode)] =
@ -38,7 +38,7 @@ object MatchOpcodes {
0x90 -> BCC,
0xB0 -> BCS,
0xD0 -> BNE,
0xF0 -> BEQ,
0xF0 -> BEQ
).view.mapValues(x => x -> Relative).toMap
def injectedOpcodesImplied: Map[Int, (Instruction, AddressingMode)] =

View File

@ -4,8 +4,7 @@ sealed trait Color
object Color {
implicit val ev: Operand[Color] =
Operand
.operandInt
Operand.operandInt
.contra(toByte, _.toString)
def toByte(x: Color): Int =

View File

@ -67,7 +67,6 @@ object DslDemo extends App {
}
}
object registers {
sealed trait Register
@ -137,8 +136,7 @@ class AssemblyContext {
xs.append(InstructionWithOperand(instruction, x: A, s.some))
def printOut(): Unit = {
xs
.map(_.toAsm)
xs.map(_.toAsm)
.foreach(println)
}
}

View File

@ -20,7 +20,9 @@ case class UnaryInstruction(instruction: Instruction, comment: Option[String]) e
}
}
case class InstructionWithOperand[A](instruction: Instruction, operand: A, comment: Option[String])(implicit ev: Operand[A]) extends Statement {
case class InstructionWithOperand[A](instruction: Instruction, operand: A, comment: Option[String])(
implicit ev: Operand[A]
) extends Statement {
def toAsm: String = {
val left =
instruction.toString