Created
March 15, 2016 02:25
-
-
Save rhysforyou/71f9cf28c9a181097ca9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import XCTest | |
| @testable import GameBro | |
| class CPUTests : XCTestCase { | |
| func testLD() { | |
| var cpu = CPU(memory: Memory()) | |
| cpu.LD(&cpu.A, UInt8(20)) // LD A, 20 | |
| cpu.LD(&cpu.B, cpu.A) // LD B, A | |
| cpu.LD(&cpu.A, UInt8(10)) // LD A, 10 | |
| XCTAssert(cpu.A == UInt8(10), "Accumulator should have value of 10") | |
| XCTAssert(cpu.B == UInt8(20), "B register should have value of 20") | |
| cpu.LD(Address(0xDFFF), cpu.A) // LD $DFFF, A | |
| cpu.LD(&cpu.C, Address(0xDFFF)) // LD C, $DFFF | |
| XCTAssert(cpu.C == UInt8(10), "C register should have value of 10") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment