-
-
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.
rmvwht, depad, stripb and zonkhl tests, fixes to majorbbs (#232)
* rmvwht and zonkhl tests, fixes to majorbbs * Add trailing CR * Fixed trailing CRs and using * Fixed blank space * Updated Tests/Ordinals * Format * format * Formatting * Updated depad test * Update stripb() * Update stripb() * stripb tests * Update stripb declaration * add update AX check
- Loading branch information
Showing
7 changed files
with
160 additions
and
44 deletions.
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,35 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using MBBSEmu.Memory; | ||
using Xunit; | ||
|
||
namespace MBBSEmu.Tests.ExportedModules.Majorbbs | ||
{ | ||
public class depad_Tests : ExportedModuleTestBase | ||
{ | ||
private const int DEPAD_ORDINAL = 164; | ||
|
||
[Theory] | ||
[InlineData("% ", 3, "%\0")] | ||
[InlineData("T ", 4, "T\0")] | ||
[InlineData("T ", 1, "T\0")] | ||
[InlineData("TeSt ", 2, "TeSt\0")] | ||
[InlineData("TeSt", 0, "TeSt\0")] | ||
[InlineData("", 0, "\0")] | ||
public void DEPAD_Test(string inputString, ushort expected, string expectedString) | ||
{ | ||
//Reset State | ||
Reset(); | ||
|
||
var stringPointer = mbbsEmuMemoryCore.AllocateVariable("INPUT_STRING", (ushort)(inputString.Length + 1)); | ||
mbbsEmuMemoryCore.SetArray("INPUT_STRING", Encoding.ASCII.GetBytes(inputString)); | ||
|
||
//Execute Test | ||
ExecuteApiTest(HostProcess.ExportedModules.Majorbbs.Segment, DEPAD_ORDINAL, new List<IntPtr16> { stringPointer }); | ||
|
||
//Verify Results | ||
Assert.Equal(expected, mbbsEmuCpuRegisters.AX); | ||
Assert.Equal(expectedString, Encoding.ASCII.GetString(mbbsEmuMemoryCore.GetString("INPUT_STRING"))); | ||
} | ||
} | ||
} |
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 System.Collections.Generic; | ||
using System.Text; | ||
using MBBSEmu.Memory; | ||
using Xunit; | ||
|
||
namespace MBBSEmu.Tests.ExportedModules.Majorbbs | ||
{ | ||
public class rmvwht_Tests : ExportedModuleTestBase | ||
{ | ||
private const int RMVWHT_ORDINAL = 501; | ||
|
||
[Theory] | ||
[InlineData("upper case", "uppercase\0")] | ||
[InlineData(" capitalize me", "capitalizeme\0")] | ||
[InlineData("lower case words", "lowercasewords\0")] | ||
[InlineData(" ---&&&^^^ hello", "---&&&^^^hello\0")] | ||
[InlineData(" hi", "hi\0")] | ||
public void RMVWHT_Test(string inputString, string expectedString) | ||
{ | ||
//Reset State | ||
Reset(); | ||
|
||
var stringPointer = mbbsEmuMemoryCore.AllocateVariable("INPUT_STRING", (ushort)(inputString.Length + 1)); | ||
mbbsEmuMemoryCore.SetArray("INPUT_STRING", Encoding.ASCII.GetBytes(inputString)); | ||
|
||
//Execute Test | ||
ExecuteApiTest(HostProcess.ExportedModules.Majorbbs.Segment, RMVWHT_ORDINAL, new List<IntPtr16> { stringPointer }); | ||
|
||
//Verify Results | ||
Assert.Equal(expectedString, Encoding.ASCII.GetString(mbbsEmuMemoryCore.GetString("INPUT_STRING"))); | ||
} | ||
} | ||
} |
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
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
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,34 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using MBBSEmu.Memory; | ||
using Xunit; | ||
|
||
namespace MBBSEmu.Tests.ExportedModules.Majorbbs | ||
{ | ||
public class stripb_Tests : ExportedModuleTestBase | ||
{ | ||
private const int STRIPB_ORDINAL = 577; | ||
|
||
[Theory] | ||
[InlineData("T", "T\0")] | ||
[InlineData("T ", "T\0")] | ||
[InlineData(" ", " \0")] | ||
[InlineData(" XX ", " XX\0")] | ||
[InlineData("TEST test TEST\0", "TEST test TEST\0")] | ||
[InlineData("TeSt \0", "TeSt\0")] | ||
public void STRIPB_Test(string inputString, string expectedString) | ||
{ | ||
//Reset State | ||
Reset(); | ||
|
||
var stringPointer = mbbsEmuMemoryCore.AllocateVariable("INPUT_STRING", (ushort)(inputString.Length + 1)); | ||
mbbsEmuMemoryCore.SetArray("INPUT_STRING", Encoding.ASCII.GetBytes(inputString)); | ||
|
||
//Execute Test | ||
ExecuteApiTest(HostProcess.ExportedModules.Majorbbs.Segment, STRIPB_ORDINAL, new List<IntPtr16> { stringPointer }); | ||
|
||
//Verify Results | ||
Assert.Equal(expectedString, Encoding.ASCII.GetString(mbbsEmuMemoryCore.GetString("INPUT_STRING"))); | ||
} | ||
} | ||
} |
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,34 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using MBBSEmu.Memory; | ||
using Xunit; | ||
|
||
namespace MBBSEmu.Tests.ExportedModules.Majorbbs | ||
{ | ||
public class zonkhl_Tests : ExportedModuleTestBase | ||
{ | ||
private const int ZONKHL_ORDINAL = 652; | ||
|
||
[Theory] | ||
[InlineData("upper case", "Upper Case\0")] | ||
[InlineData(" capitalize me", " Capitalize Me\0")] | ||
[InlineData("lower case words", "Lower Case Words\0")] | ||
[InlineData("loWER caSE worDS", "Lower Case Words\0")] | ||
[InlineData(" ---&&&^^^ hello", " ---&&&^^^ Hello\0")] | ||
[InlineData(" hi", " Hi\0")] | ||
public void ZONKHL_Test(string inputString, string expectedString) | ||
{ | ||
//Reset State | ||
Reset(); | ||
|
||
var stringPointer = mbbsEmuMemoryCore.AllocateVariable("INPUT_STRING", (ushort)(inputString.Length + 1)); | ||
mbbsEmuMemoryCore.SetArray("INPUT_STRING", Encoding.ASCII.GetBytes(inputString)); | ||
|
||
//Execute Test | ||
ExecuteApiTest(HostProcess.ExportedModules.Majorbbs.Segment, ZONKHL_ORDINAL, new List<IntPtr16> { stringPointer }); | ||
|
||
//Verify Results | ||
Assert.Equal(expectedString, Encoding.ASCII.GetString(mbbsEmuMemoryCore.GetString("INPUT_STRING"))); | ||
} | ||
} | ||
} |
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