Skip to content

Commit

Permalink
Unit Test Updates (#524)
Browse files Browse the repository at this point in the history
* Fixed typo in sameto() test

* Add FMULP unit test
  • Loading branch information
tuday2 authored Jan 1, 2022
1 parent 4d32b94 commit e95eb35
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions MBBSEmu.Tests/CPU/FMULP_tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Iced.Intel;
using Xunit;
using static Iced.Intel.AssemblerRegisters;

namespace MBBSEmu.Tests.CPU
{
public class FMULP_Tests : CpuTestBase
{
[Theory]
[InlineData(2, 2)]
[InlineData(1, .5)]
[InlineData(0, 0)]
[InlineData(6, 0)]
public void FMULP_Test(float ST0Value, float ST1Value)
{
Reset();

mbbsEmuCpuRegisters.Fpu.SetStackTop(1);
mbbsEmuCpuCore.FpuStack[1] = ST0Value; //ST0
mbbsEmuCpuCore.FpuStack[0] = ST1Value; //ST1

var instructions = new Assembler(16);
instructions.fmulp(st1, st0);
CreateCodeSegment(instructions);

mbbsEmuCpuCore.Tick();

var expectedValue = ST1Value * ST0Value;

Assert.Equal(expectedValue, mbbsEmuCpuCore.FpuStack[mbbsEmuCpuRegisters.Fpu.GetStackTop()]);
}
}
}
2 changes: 1 addition & 1 deletion MBBSEmu.Tests/ExportedModules/Majorbbs/sameto_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace MBBSEmu.Tests.ExportedModules.Majorbbs
{
public class sameto_Tests : ExportedModuleTestBase
{
private const int SAMETO_ORDINAL = 521;
private const int SAMETO_ORDINAL = 522;

[Theory]
//Actual examples from the documentation! XD
Expand Down

0 comments on commit e95eb35

Please sign in to comment.