mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2024-12-22 10:30:46 +00:00
Add EOR and SEX unit tests
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
95b6657576
commit
310415512f
49
MC6809/MC6809.UnitTest/EorTests.cs
Normal file
49
MC6809/MC6809.UnitTest/EorTests.cs
Normal file
@ -0,0 +1,49 @@
|
||||
// <copyright file="EorTests.cs" company="Adrian Conlon">
|
||||
// Copyright (c) Adrian Conlon. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace EightBit
|
||||
{
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
[TestClass]
|
||||
public class EorTests
|
||||
{
|
||||
private readonly Board board = new Board();
|
||||
private readonly MC6809 cpu;
|
||||
|
||||
public EorTests()
|
||||
{
|
||||
this.cpu = this.board.CPU;
|
||||
|
||||
this.board.Poke(0, 0x4f);
|
||||
}
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialise()
|
||||
{
|
||||
this.board.RaisePOWER();
|
||||
this.cpu.Step(); // Step over the reset
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup() => this.board.LowerPOWER();
|
||||
|
||||
[TestMethod]
|
||||
public void TestEOR_implied()
|
||||
{
|
||||
this.cpu.Y.Word = 0x12f0;
|
||||
this.cpu.A = 0xf2;
|
||||
this.cpu.CC = 0x03;
|
||||
this.board.Poke(0x12f8, 0x98);
|
||||
this.board.Poke(0xb00, 0xa8);
|
||||
this.board.Poke(0xb01, 0x28);
|
||||
this.cpu.PC.Word = 0xb00;
|
||||
this.cpu.Step();
|
||||
Assert.AreEqual(0x98, this.board.Peek(0x12f8));
|
||||
Assert.AreEqual(0x6a, this.cpu.A);
|
||||
Assert.AreEqual(0x01, this.cpu.CC);
|
||||
Assert.AreEqual(0x12f0, this.cpu.Y.Word);
|
||||
}
|
||||
}
|
||||
}
|
@ -65,6 +65,7 @@
|
||||
<Compile Include="ClrTests.cs" />
|
||||
<Compile Include="CmpTests.cs" />
|
||||
<Compile Include="DecTests.cs" />
|
||||
<Compile Include="EorTests.cs" />
|
||||
<Compile Include="ExgTests.cs" />
|
||||
<Compile Include="IncTests.cs" />
|
||||
<Compile Include="JsrTests.cs" />
|
||||
@ -72,6 +73,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RtsTests.cs" />
|
||||
<Compile Include="SbcTests.cs" />
|
||||
<Compile Include="SexTests.cs" />
|
||||
<Compile Include="SubTests.cs" />
|
||||
<Compile Include="TfrTests.cs" />
|
||||
<Compile Include="PshTests.cs" />
|
||||
|
49
MC6809/MC6809.UnitTest/SexTests.cs
Normal file
49
MC6809/MC6809.UnitTest/SexTests.cs
Normal file
@ -0,0 +1,49 @@
|
||||
// <copyright file="SexTests.cs" company="Adrian Conlon">
|
||||
// Copyright (c) Adrian Conlon. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace EightBit
|
||||
{
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
[TestClass]
|
||||
public class SexTests
|
||||
{
|
||||
private readonly Board board = new Board();
|
||||
private readonly MC6809 cpu;
|
||||
|
||||
public SexTests() => this.cpu = this.board.CPU;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialise()
|
||||
{
|
||||
this.board.RaisePOWER();
|
||||
this.cpu.Step(); // Step over the reset
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup() => this.board.LowerPOWER();
|
||||
|
||||
[TestMethod]
|
||||
public void TestSEX_Inherent_one()
|
||||
{
|
||||
this.board.Poke(0, 0x1d);
|
||||
this.cpu.A = 0x02;
|
||||
this.cpu.B = 0xe6;
|
||||
this.cpu.Step();
|
||||
Assert.AreEqual(0xff, this.cpu.A);
|
||||
Assert.AreEqual(0xe6, this.cpu.B);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSEX_Inherent_two()
|
||||
{
|
||||
this.board.Poke(0, 0x1d);
|
||||
this.cpu.A = 0x02;
|
||||
this.cpu.B = 0x76;
|
||||
this.cpu.Step();
|
||||
Assert.AreEqual(0x00, this.cpu.A);
|
||||
Assert.AreEqual(0x76, this.cpu.B);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user