-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed typo in sameto() test * Add FMULP unit test
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
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()]); | ||
} | ||
} | ||
} |
This file contains 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