Update MachineTest.scala

This commit is contained in:
kamoshi 2019-12-09 21:18:24 +01:00 committed by GitHub
parent 8f2f1a6ac9
commit 7096e3f9b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,10 +24,10 @@ object MachineTest
{ {
val input: Array[Long] = Reader.readString("/input5.txt").split("[^\\d-]+").map(x => x.toLong) val input: Array[Long] = Reader.readString("/input5.txt").split("[^\\d-]+").map(x => x.toLong)
val machine1: Machine = new Machine(input) val machine1: Machine = new Machine(input)
assert(machine1.runContinuous(List(1)).head == 12234644) assert(machine1.enqueue(1).run().outputAll.last == 12234644)
val machine2: Machine = new Machine(input) val machine2: Machine = new Machine(input)
assert(machine2.run().runInput(5).run().runOutput() == 3508186) assert(machine2.enqueue(5).run().output == 3508186)
} }
def testDay09(): Unit = def testDay09(): Unit =
@ -37,12 +37,10 @@ object MachineTest
for(i <- input.indices) { memory(i) = input(i)} for(i <- input.indices) { memory(i) = input(i)}
val machine1: Machine = new Machine(memory) val machine1: Machine = new Machine(memory)
machine1.run().runInput(1) assert(machine1.enqueue(1).run().output == 4288078517L)
assert(machine1.run().runOutput() == 4288078517L)
val machine2: Machine = new Machine(memory) val machine2: Machine = new Machine(memory)
machine2.run().runInput(2) assert(machine2.enqueue(2).run().output == 69256)
assert(machine2.run().runOutput() == 69256)
} }
} }