more test coverage
This commit is contained in:
parent
b492eb5f49
commit
dfce9bf9fe
200
.idea/workspace.xml
generated
200
.idea/workspace.xml
generated
@ -9,8 +9,6 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9bcba7c5-ac1d-4216-959a-63faee7047bc" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gemma/src/chip8/instructions.rs" beforeDir="false" afterPath="$PROJECT_DIR$/gemma/src/chip8/instructions.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gemma/tests/unit_tests.rs" beforeDir="false" afterPath="$PROJECT_DIR$/gemma/tests/unit_tests.rs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -38,102 +36,100 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Cargo.Build `Run emmagui`.executor": "Run",
|
||||
"Cargo.Build `Run gemmaegui_viewer`.executor": "Run",
|
||||
"Cargo.Build `Run gemmaegui`.executor": "Run",
|
||||
"Cargo.Build `Run gemmaimgui`.executor": "Run",
|
||||
"Cargo.Build `Run trevors_chip8_toy`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::computer::test::cls_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::LdStVx_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::random_produces_different_numbers`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::series8xy6_corex_tests`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::shl_vx_vy_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::util::test::byte_to_bool_changes`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::util::test::ubln`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::video::test::poke_byte_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::video::test::poke_byte`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::video::test::scroll_down_1_row_test`.executor": "Run",
|
||||
"Cargo.Build `Test computer::test`.executor": "Run",
|
||||
"Cargo.Build `Test computer_dump_registers_to_string`.executor": "Run",
|
||||
"Cargo.Build `Test instructions::test (1)`.executor": "Run",
|
||||
"Cargo.Build `Test instructions::test`.executor": "Run",
|
||||
"Cargo.Build `Test instructions_name_tests`.executor": "Run",
|
||||
"Cargo.Build `Test video::test`.executor": "Run",
|
||||
"Cargo.Build gemma.executor": "Run",
|
||||
"Cargo.Run emmagui.executor": "Run",
|
||||
"Cargo.Run gemmaegui.executor": "Debug",
|
||||
"Cargo.Run gemmaegui_viewer.executor": "Debug",
|
||||
"Cargo.Run gemmaimgui.executor": "Debug",
|
||||
"Cargo.Run trevors_chip8_toy.executor": "Debug",
|
||||
"Cargo.Test chip8::computer::test::cls_test.executor": "Run",
|
||||
"Cargo.Test chip8::computer::test::decoder_test_valid_instructions.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::LdStVx_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::LdVxDt_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::LdiAddr_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::RndVxByte_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::ShrVxVy_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::SneVxVy_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::decoder_test_invalid_instructions.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::draw_nibble_vx_vy_n_test.executor": "Debug",
|
||||
"Cargo.Test chip8::instructions::test::encode_decode_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::random_produces_different_numbers.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::series4000_corex_tests.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::series8xy4_corex_tests.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::series8xy6_corex_tests.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::shl_vx_vy_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::subn_vx_vy_test.executor": "Run",
|
||||
"Cargo.Test chip8::util::test::bool_to_byte_changes.executor": "Run",
|
||||
"Cargo.Test chip8::util::test::byte_to_bool_changes.executor": "Run",
|
||||
"Cargo.Test chip8::util::test::ubln.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::poke_byte.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::poke_byte_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::poke_sprite_test.executor": "Debug",
|
||||
"Cargo.Test chip8::video::test::reset_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::scroll_down_10_row_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::scroll_down_1_row_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::write_checkboard.executor": "Run",
|
||||
"Cargo.Test computer::test.executor": "Debug",
|
||||
"Cargo.Test computer_dump_registers_to_string.executor": "Run",
|
||||
"Cargo.Test encode_decode_name_test.executor": "Debug",
|
||||
"Cargo.Test instructions::test (1).executor": "Debug",
|
||||
"Cargo.Test instructions::test.executor": "Debug",
|
||||
"Cargo.Test instructions_name_tests.executor": "Run",
|
||||
"Cargo.Test sound_timer::test.executor": "Run",
|
||||
"Cargo.Test util::test.executor": "Run",
|
||||
"Cargo.Test video::test.executor": "Debug",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.rust.reset.selective.auto.import": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"last_opened_file_path": "/home/tmerritt/Projects/chip8_toy/gemmaimgui",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
|
||||
"org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
|
||||
"org.rust.first.attach.projects": "true",
|
||||
"settings.editor.selected.configurable": "advanced.settings"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Cargo.Build `Run emmagui`.executor": "Run",
|
||||
"Cargo.Build `Run gemmaegui_viewer`.executor": "Run",
|
||||
"Cargo.Build `Run gemmaegui`.executor": "Run",
|
||||
"Cargo.Build `Run gemmaimgui`.executor": "Run",
|
||||
"Cargo.Build `Run trevors_chip8_toy`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::computer::test::cls_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::LdStVx_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::random_produces_different_numbers`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::series8xy6_corex_tests`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::instructions::test::shl_vx_vy_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::util::test::byte_to_bool_changes`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::util::test::ubln`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::video::test::poke_byte_test`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::video::test::poke_byte`.executor": "Run",
|
||||
"Cargo.Build `Test chip8::video::test::scroll_down_1_row_test`.executor": "Run",
|
||||
"Cargo.Build `Test computer::test`.executor": "Run",
|
||||
"Cargo.Build `Test instructions::test (1)`.executor": "Run",
|
||||
"Cargo.Build `Test instructions::test`.executor": "Run",
|
||||
"Cargo.Build `Test video::test`.executor": "Run",
|
||||
"Cargo.Build gemma.executor": "Run",
|
||||
"Cargo.Run ch8asm.executor": "Run",
|
||||
"Cargo.Run emmagui.executor": "Run",
|
||||
"Cargo.Run gemmaegui.executor": "Debug",
|
||||
"Cargo.Run gemmaegui_viewer.executor": "Debug",
|
||||
"Cargo.Run gemmaimgui.executor": "Debug",
|
||||
"Cargo.Run trevors_chip8_toy.executor": "Debug",
|
||||
"Cargo.Test ch8asm::test.executor": "Debug",
|
||||
"Cargo.Test chip8::computer::test::cls_test.executor": "Run",
|
||||
"Cargo.Test chip8::computer::test::decoder_test_valid_instructions.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::LdStVx_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::LdVxDt_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::LdiAddr_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::RndVxByte_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::ShrVxVy_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::SneVxVy_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::decoder_test_invalid_instructions.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::draw_nibble_vx_vy_n_test.executor": "Debug",
|
||||
"Cargo.Test chip8::instructions::test::encode_decode_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::random_produces_different_numbers.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::series4000_corex_tests.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::series8xy4_corex_tests.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::series8xy6_corex_tests.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::shl_vx_vy_test.executor": "Run",
|
||||
"Cargo.Test chip8::instructions::test::subn_vx_vy_test.executor": "Run",
|
||||
"Cargo.Test chip8::util::test::bool_to_byte_changes.executor": "Run",
|
||||
"Cargo.Test chip8::util::test::byte_to_bool_changes.executor": "Run",
|
||||
"Cargo.Test chip8::util::test::ubln.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::poke_byte.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::poke_byte_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::poke_sprite_test.executor": "Debug",
|
||||
"Cargo.Test chip8::video::test::reset_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::scroll_down_10_row_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::scroll_down_1_row_test.executor": "Run",
|
||||
"Cargo.Test chip8::video::test::write_checkboard.executor": "Run",
|
||||
"Cargo.Test computer::test.executor": "Debug",
|
||||
"Cargo.Test instruction_tests.executor": "Run",
|
||||
"Cargo.Test instructions::test (1).executor": "Debug",
|
||||
"Cargo.Test instructions::test.executor": "Debug",
|
||||
"Cargo.Test sound_timer::test.executor": "Run",
|
||||
"Cargo.Test util::test.executor": "Run",
|
||||
"Cargo.Test video::test.executor": "Debug",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.rust.reset.selective.auto.import": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"last_opened_file_path": "/home/tmerritt/Projects/chip8_toy/gemmaimgui",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
|
||||
"org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
|
||||
"org.rust.first.attach.projects": "true",
|
||||
"settings.editor.selected.configurable": "advanced.settings"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [
|
||||
"TEXT"
|
||||
"keyToStringList": {
|
||||
"com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [
|
||||
"TEXT"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/gemmaimgui" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/resources/octoroms" />
|
||||
<recent name="$PROJECT_DIR$/resources/schip_font" />
|
||||
<recent name="$PROJECT_DIR$/gemmautil/src" />
|
||||
<recent name="$PROJECT_DIR$/gemmaimgui/src/bin" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Cargo.Test instructions_name_tests">
|
||||
<configuration name="Run gemmaegui" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||
<option name="command" value="run --package gemmaegui --bin gemmaegui" />
|
||||
<component name="RunManager" selected="Cargo.Run gemmaimgui">
|
||||
<configuration name="Run ch8asm" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||
<option name="command" value="run --package gemmautil --bin ch8asm" />
|
||||
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
|
||||
<envs />
|
||||
<option name="emulateTerminal" value="true" />
|
||||
@ -166,8 +162,8 @@
|
||||
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Test computer_dump_registers_to_string" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||
<option name="command" value="test --package gemma --test unit_tests computer_dump_registers_to_string -- --exact" />
|
||||
<configuration name="Test ch8asm::test" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||
<option name="command" value="test --package gemmautil --bin ch8asm test" />
|
||||
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
|
||||
<envs />
|
||||
<option name="emulateTerminal" value="true" />
|
||||
@ -183,8 +179,8 @@
|
||||
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Test instructions_name_tests" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||
<option name="command" value="test --package gemma --test unit_tests instructions_name_tests -- --exact" />
|
||||
<configuration name="Test instruction_tests" type="CargoCommandRunConfiguration" factoryName="Cargo Command" temporary="true">
|
||||
<option name="command" value="test --package gemma --test instruction_tests" />
|
||||
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
|
||||
<envs />
|
||||
<option name="emulateTerminal" value="true" />
|
||||
@ -219,11 +215,11 @@
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Cargo.Test instructions_name_tests" />
|
||||
<item itemvalue="Cargo.Run gemmaegui" />
|
||||
<item itemvalue="Cargo.Run gemmaegui" />
|
||||
<item itemvalue="Cargo.Run gemmaimgui" />
|
||||
<item itemvalue="Cargo.Test computer_dump_registers_to_string" />
|
||||
<item itemvalue="Cargo.Test instruction_tests" />
|
||||
<item itemvalue="Cargo.Test ch8asm::test" />
|
||||
<item itemvalue="Cargo.Run ch8asm" />
|
||||
<item itemvalue="Cargo.Test video::test" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
@ -262,8 +258,9 @@
|
||||
<workItem from="1729353568282" duration="4624000" />
|
||||
<workItem from="1729375372050" duration="3579000" />
|
||||
<workItem from="1729797802231" duration="9220000" />
|
||||
<workItem from="1729992186995" duration="4226000" />
|
||||
<workItem from="1730115460078" duration="30915000" />
|
||||
<workItem from="1729992186995" duration="4475000" />
|
||||
<workItem from="1730040713781" duration="2808000" />
|
||||
<workItem from="1730065968935" duration="6000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -273,6 +270,17 @@
|
||||
<component name="UnknownFeatures">
|
||||
<option featureType="com.intellij.fileTypeFactory" implementationName="*.asc" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/emma/src/chip8/system_memory.rs</url>
|
||||
<line>46</line>
|
||||
<option name="timeStamp" value="2" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/trevors_chip8_toy$Test_video__test.info" NAME="Test video::test Coverage Results" MODIFIED="1728072993962" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="RsCoverageRunner" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" CONTEXT_FILE_PATH="$PROJECT_DIR$" />
|
||||
</component>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -300,8 +300,8 @@ impl Chip8CpuInstructions {
|
||||
Chip8CpuInstructions::SKP(_) => INST_SKP,
|
||||
Chip8CpuInstructions::SNEB(_, _) => INST_SNEB,
|
||||
Chip8CpuInstructions::SNEY(_, _) => INST_SNEY,
|
||||
Chip8CpuInstructions::SKNP(_) => INST_SNKP,
|
||||
Chip8CpuInstructions::STR(x) => INST_STR,
|
||||
Chip8CpuInstructions::SKNP(_) => INST_SKNP,
|
||||
Chip8CpuInstructions::STR(_) => INST_STR,
|
||||
Chip8CpuInstructions::SUB(_, _) => INST_SUB,
|
||||
Chip8CpuInstructions::SUBC(_, _) => INST_SUBC,
|
||||
Chip8CpuInstructions::SYS(_) => INST_SYS,
|
||||
@ -329,8 +329,8 @@ impl Chip8CpuInstructions {
|
||||
format!("0x{x:02x}, 0x{byte:02x}")
|
||||
}
|
||||
// Reg, Reg
|
||||
Chip8CpuInstructions::SEY(x, y) |
|
||||
Chip8CpuInstructions::LDR_Y(x, y) |
|
||||
SEY(x, y) |
|
||||
LDR_Y(x, y) |
|
||||
Chip8CpuInstructions::OR(x, y) |
|
||||
Chip8CpuInstructions::AND(x, y) |
|
||||
Chip8CpuInstructions::ORY(x, y) |
|
||||
@ -489,8 +489,44 @@ impl Chip8CpuInstructions {
|
||||
INST_RND => {
|
||||
RND(param1 as u8, param2 as u8)
|
||||
}
|
||||
INST_DRW => {
|
||||
DRW(param1 as u8, param2 as u8, param3 as u8)
|
||||
INST_SKP => {
|
||||
SKP(param1 as u8)
|
||||
}
|
||||
INST_SKNP => {
|
||||
SKNP(param1 as u8)
|
||||
}
|
||||
INST_LDRD => {
|
||||
LDRD(param1 as u8)
|
||||
}
|
||||
INST_LDRK => {
|
||||
LDRK(param1 as u8)
|
||||
}
|
||||
INST_LDRI => {
|
||||
LDRI(param1 as u8)
|
||||
}
|
||||
INST_BCD => {
|
||||
BCD(param1 as u8)
|
||||
}
|
||||
INST_LDF => {
|
||||
LDFX(param1 as u8)
|
||||
}
|
||||
INST_LDF2 => {
|
||||
LDF2(param1 as u8)
|
||||
}
|
||||
INST_LDIX => {
|
||||
LDIX(param1 as u8)
|
||||
}
|
||||
INST_LIDR => {
|
||||
LIDR(param1 as u8)
|
||||
}
|
||||
INST_LDIS => {
|
||||
LDIS(param1 as u8)
|
||||
}
|
||||
INST_STR => {
|
||||
STR(param1 as u8)
|
||||
}
|
||||
INST_LDD => {
|
||||
LDD(param1 as u8)
|
||||
}
|
||||
_ => {
|
||||
XXXXERRORINSTRUCTION
|
||||
|
||||
@ -36,7 +36,7 @@ pub const INST_LDF2: &str = "LDF2";
|
||||
pub const INST_LDIA: &str = "LDIA";
|
||||
pub const INST_LDIX: &str = "LDIX";
|
||||
pub const INST_LIDR: &str = "LIDR";
|
||||
pub const INST_LDIS: &str = "LIDS";
|
||||
pub const INST_LDIS: &str = "LDIS";
|
||||
pub const INST_LDR: &str = "LDR";
|
||||
pub const INST_LDRD: &str = "LDRD";
|
||||
pub const INST_LDRI: &str = "LDRI";
|
||||
@ -53,9 +53,9 @@ pub const INST_SEY: &str = "SEY";
|
||||
pub const INST_SHL: &str = "SHL";
|
||||
pub const INST_SHR: &str = "SHR";
|
||||
pub const INST_SKP: &str = "SKP";
|
||||
pub const INST_SKNP: &str = "SKNP";
|
||||
pub const INST_SNEB: &str = "SNEB";
|
||||
pub const INST_SNEY: &str = "SNEY";
|
||||
pub const INST_SNKP: &str = "SNKP";
|
||||
pub const INST_STR: &str = "STR";
|
||||
pub const INST_SUB: &str = "SUB";
|
||||
pub const INST_SUBC: &str = "SUBC";
|
||||
|
||||
@ -13,7 +13,7 @@ use gemma::chip8::util::InstructionUtil;
|
||||
use gemma::chip8::video::Chip8Video;
|
||||
use gemma::constants::*;
|
||||
|
||||
const TEST_OUTPUT_SAMPLE_DIR: &str = "/home/tmerritt/Projects/chip8_toy/resources/test/";
|
||||
const TEST_OUTPUT_SAMPLE_DIR: &str = "../resources/test/";
|
||||
|
||||
fn read_test_result(suffix: &str) -> String {
|
||||
std::fs::read_to_string(TEST_OUTPUT_SAMPLE_DIR.to_owned() + suffix)
|
||||
@ -1330,6 +1330,7 @@ fn video_scroll_right_4_row_test_high_def() {
|
||||
struct InstructionTest {
|
||||
name: String,
|
||||
instruction: Chip8CpuInstructions,
|
||||
operands: String,
|
||||
asm: String,
|
||||
encoded: u16,
|
||||
}
|
||||
@ -1346,6 +1347,7 @@ fn instructions_name_tests() {
|
||||
InstructionTest {
|
||||
name: INST_SYS.to_string(),
|
||||
instruction: Chip8CpuInstructions::SYS(0x123),
|
||||
operands: "0x0123".to_string(),
|
||||
asm: "SYS 0x0123".to_string(),
|
||||
encoded: 0x0123
|
||||
},
|
||||
@ -1353,207 +1355,310 @@ fn instructions_name_tests() {
|
||||
name: INST_CLS.to_string(),
|
||||
instruction: Chip8CpuInstructions::CLS,
|
||||
asm: "CLS".to_string(),
|
||||
operands: "".to_string(),
|
||||
encoded: 0x00E0
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_RET.to_string(),
|
||||
instruction: Chip8CpuInstructions::RET,
|
||||
asm: "RET".to_string(),
|
||||
operands: "".to_string(),
|
||||
encoded: 0x00ee
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_JPA.to_string(),
|
||||
instruction: JPA(0x234),
|
||||
asm: "JPA 0x0234".to_string(),
|
||||
encoded: 0xb234
|
||||
encoded: 0xb234,
|
||||
operands: "0x0234".to_string(),
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_CALL.to_string(),
|
||||
instruction: Chip8CpuInstructions::CALL(0x123),
|
||||
asm: "CALL 0x0123".to_string(),
|
||||
encoded: 0x2123,
|
||||
operands: "0x0123".to_string()
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_DRW.to_string(),
|
||||
instruction: Chip8CpuInstructions::DRW(0x01, 0x02, 0x03),
|
||||
operands: "0x01, 0x02, 0x03".to_string(),
|
||||
asm: "DRW 0x01, 0x02, 0x03".to_string(),
|
||||
encoded: 0xd123
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_JPI.to_string(),
|
||||
instruction: Chip8CpuInstructions::JPI(0x321),
|
||||
operands: "0x0321".to_string(),
|
||||
asm: "JPI 0x0321".to_string(),
|
||||
encoded: 0xb321
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SDN.to_string(),
|
||||
instruction: Chip8CpuInstructions::SDN(0x01),
|
||||
operands: "0x01".to_string(),
|
||||
asm: "SDN 0x01".to_string(),
|
||||
encoded: 0x00c1
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SRT.to_string(),
|
||||
instruction: Chip8CpuInstructions::SRT,
|
||||
operands: "".to_string(),
|
||||
asm: "SRT".to_string(),
|
||||
encoded: 0x00FB
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SLF.to_string(),
|
||||
instruction: Chip8CpuInstructions::SLF,
|
||||
operands: "".to_string(),
|
||||
asm: "SLF".to_string(),
|
||||
encoded: 0x00FC,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_EXIT.to_string(),
|
||||
instruction: Chip8CpuInstructions::EXIT,
|
||||
operands: "".to_string(),
|
||||
asm: "EXIT".to_string(),
|
||||
encoded: 0x00FD,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_DIS.to_string(),
|
||||
instruction: Chip8CpuInstructions::DIS,
|
||||
operands: "".to_string(),
|
||||
asm: "DIS".to_string(),
|
||||
encoded: 0x00FE,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_ENA.to_string(),
|
||||
instruction: Chip8CpuInstructions::ENA,
|
||||
operands: "".to_string(),
|
||||
asm: "ENA".to_string(),
|
||||
encoded: 0x00FF,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SEX.to_string(),
|
||||
instruction: Chip8CpuInstructions::SEX(0x01, 0xfa),
|
||||
operands: "0x01, 0xfa".to_string(),
|
||||
asm: "SEX 0x01, 0xfa".to_string(),
|
||||
encoded: 0x32fa,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SNEB.to_string(),
|
||||
instruction: Chip8CpuInstructions::SNEB(0x01, 0xab),
|
||||
operands: "0x01, 0xab".to_string(),
|
||||
asm: "SNEB 0x01, 0xab".to_string(),
|
||||
encoded: 0x41ab,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SEY.to_string(),
|
||||
instruction: Chip8CpuInstructions::SEY(0x1, 0x2),
|
||||
operands: "0x1, 0x2".to_string(),
|
||||
asm: "SEY 0x1, 0x2".to_string(),
|
||||
encoded: 0x5120
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDR.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDR(0xa, 0xbe),
|
||||
operands: "0x0a, 0xbe".to_string(),
|
||||
asm: "LDR 0x0a, 0xbe".to_string(),
|
||||
encoded: 0x6abe,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_ADD.to_string(),
|
||||
instruction: Chip8CpuInstructions::ADD(0x01, 0xab),
|
||||
operands: "0x01, 0xab".to_string(),
|
||||
asm: "ADD 0x01, 0xab".to_string(),
|
||||
encoded: 0x71ab
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDRY.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDR_Y(0x1, 0x2),
|
||||
operands: "0x1, 0x2".to_string(),
|
||||
asm: "LDRY 0x1, 0x2".to_string(),
|
||||
encoded: 0x8120,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_OR.to_string(),
|
||||
instruction: Chip8CpuInstructions::OR(0x1, 0x2),
|
||||
operands: "0x1, 0x2".to_string(),
|
||||
asm: "OR 0x1, 0x2".to_string(),
|
||||
encoded: 0x8121
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_AND.to_string(),
|
||||
instruction: Chip8CpuInstructions::AND(0xb, 0xc),
|
||||
operands: "0xb, 0xc".to_string(),
|
||||
asm: "AND 0xb, 0xc".to_string(),
|
||||
encoded: 0x8bc2,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_ORY.to_string(),
|
||||
instruction: Chip8CpuInstructions::ORY(0xa, 0x3),
|
||||
operands: "0xa, 0x3".to_string(),
|
||||
asm: "ORY 0xa, 0x3".to_string(),
|
||||
encoded: 0x8a33
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_ADDR.to_string(),
|
||||
instruction: Chip8CpuInstructions::ADDR(0x1, 0x2),
|
||||
operands: "0x1, 0x2".to_string(),
|
||||
asm: "ADDR 0x1, 0x2".to_string(),
|
||||
encoded: 0x8124
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SUB.to_string(),
|
||||
instruction: Chip8CpuInstructions::SUB(0x4, 0x5),
|
||||
operands: "0x4, 0x5".to_string(),
|
||||
asm: "SUB 0x4, 0x5".to_string(),
|
||||
encoded: 0x8455
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SHR.to_string(),
|
||||
instruction: Chip8CpuInstructions::SHR(0x01, 0x1),
|
||||
operands: "0x1, 0x1".to_string(),
|
||||
asm: "SHR 0x1, 0x1".to_string(),
|
||||
encoded: 0x8116,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SUBC.to_string(),
|
||||
instruction: Chip8CpuInstructions::SUBC(0xf, 0xa),
|
||||
operands: "0xf, 0xa".to_string(),
|
||||
asm: "SUBC 0xf, 0xa".to_string(),
|
||||
encoded: 0x8fa7,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SHL.to_string(),
|
||||
instruction: Chip8CpuInstructions::SHL(0x1, 0x4),
|
||||
operands: "0x1, 0x4".to_string(),
|
||||
asm: "SHL 0x1, 0x4".to_string(),
|
||||
encoded: 0x814e,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SNEY.to_string(),
|
||||
instruction: Chip8CpuInstructions::SNEY(0x4, 0x5),
|
||||
operands: "0x4, 0x5".to_string(),
|
||||
asm: "SNEY 0x4, 0x5".to_string(),
|
||||
encoded: 0x9450,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDIA.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDIA(0xbee),
|
||||
operands: "0x0bee".to_string(),
|
||||
asm: "LDIA 0x0bee".to_string(),
|
||||
encoded: 0x9bee
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_JPI.to_string(),
|
||||
instruction: Chip8CpuInstructions::JPI(0xfee),
|
||||
operands: "0x0fee".to_string(),
|
||||
asm: "JPI 0x0fee".to_string(),
|
||||
encoded: 0xbfee
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_RND.to_string(),
|
||||
instruction: Chip8CpuInstructions::RND(0x1, 0xae),
|
||||
operands: "0x01, 0xae".to_string(),
|
||||
asm: "RND 0x01, 0xae".to_string(),
|
||||
encoded: 0xc1ae,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_DRW.to_string(),
|
||||
instruction: Chip8CpuInstructions::DRW(0x1, 0x2, 0xf),
|
||||
operands: "0x01, 0x02, 0x0f".to_string(),
|
||||
asm: "DRW 0x01, 0x02, 0x0f".to_string(),
|
||||
encoded: 0xd12f
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SKP.to_string(),
|
||||
instruction: Chip8CpuInstructions::SKP(0x4),
|
||||
operands: "0x04".to_string(),
|
||||
asm: "SKP 0x04".to_string(),
|
||||
encoded: 0xe49e,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_SKNP.to_string(),
|
||||
instruction: Chip8CpuInstructions::SKNP(0x3),
|
||||
operands: "0x03".to_string(),
|
||||
asm: "SKNP 0x03".to_string(),
|
||||
encoded: 0x83a1
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDRD.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDRD(0x4),
|
||||
operands: "0x04".to_string(),
|
||||
asm: "LDRD 0x04".to_string(),
|
||||
encoded: 0xF407
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDRK.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDRK(0x6),
|
||||
operands: "0x06".to_string(),
|
||||
asm: "LDRK 0x06".to_string(),
|
||||
encoded: 0xF60A
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDD.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDD(0x02),
|
||||
operands: "0x02".to_string(),
|
||||
asm: "LDD 0x02".to_string(),
|
||||
encoded: 0xF215,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDRI.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDRI(0x01),
|
||||
operands: "0x01".to_string(),
|
||||
asm: "LDRI 0x01".to_string(),
|
||||
encoded: 0xF118,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_BCD.to_string(),
|
||||
instruction: Chip8CpuInstructions::BCD(0x4),
|
||||
operands: "0x04".to_string(),
|
||||
asm: "BCD 0x04".to_string(),
|
||||
encoded: 0xF433,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDF.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDFX(0x5),
|
||||
operands: "0x05".to_string(),
|
||||
asm: "LDF 0x05".to_string(),
|
||||
encoded: 0xF529
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDF2.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDF2(0x6),
|
||||
operands: "0x06".to_string(),
|
||||
asm: "LDF2 0x06".to_string(),
|
||||
encoded: 0xF630
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDIX.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDIX(0x5),
|
||||
operands: "0x05".to_string(),
|
||||
asm: "LDIX 0x05".to_string(),
|
||||
encoded: 0xF555
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LDIS.to_string(),
|
||||
instruction: Chip8CpuInstructions::LDIS(0xf),
|
||||
operands: "0x0f".to_string(),
|
||||
asm: "LDIS 0x0f".to_string(),
|
||||
encoded: 0xFF18
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_LIDR.to_string(),
|
||||
instruction: Chip8CpuInstructions::LIDR(0x4),
|
||||
operands: "0x04".to_string(),
|
||||
asm: "LIDR 0x04".to_string(),
|
||||
encoded: 0xF485,
|
||||
},
|
||||
InstructionTest {
|
||||
name: INST_STR.to_string(),
|
||||
instruction: Chip8CpuInstructions::STR(0xa),
|
||||
operands: "0x0a".to_string(),
|
||||
asm: "STR 0x0a".to_string(),
|
||||
encoded: 0xF000
|
||||
}
|
||||
/*
|
||||
0xE09E..=0xEFA1 => match last_byte {
|
||||
0x9E => Chip8CpuInstructions::SKP(ubln),
|
||||
0xA1 => Chip8CpuInstructions::SKNP(ubln),
|
||||
0xF007..=0xFF65 => match last_byte {
|
||||
0x07 => Chip8CpuInstructions::LDRD(ubln),
|
||||
0x0A => Chip8CpuInstructions::LDRK(ubln),
|
||||
0x15 => Chip8CpuInstructions::LDD(ubln),
|
||||
0x18 => Chip8CpuInstructions::LDIS(ubln),
|
||||
0x1E => Chip8CpuInstructions::ADDI(ubln),
|
||||
0x29 => Chip8CpuInstructions::LDFX(ubln),
|
||||
0x30 => Chip8CpuInstructions::LDF2(ubln),
|
||||
0x33 => Chip8CpuInstructions::BCD(ubln),
|
||||
0x55 => Chip8CpuInstructions::LDIX(ubln),
|
||||
0x65 => Chip8CpuInstructions::LDRI(ubln),
|
||||
0x75 => Chip8CpuInstructions::STR(ubln),
|
||||
0x85 => Chip8CpuInstructions::LIDR(ubln),
|
||||
|
||||
*/
|
||||
];
|
||||
|
||||
for current in it {
|
||||
@ -1563,6 +1668,7 @@ fn instructions_name_tests() {
|
||||
assert_eq!(i.to_string(), current.asm);
|
||||
let asm = Chip8CpuInstructions::from_str(¤t.asm);
|
||||
assert_eq!(i.to_string(), asm.to_string());
|
||||
assert_eq!(i.operands(), current.operands);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1614,7 +1720,10 @@ fn instruction_test_scrolling_lowres() {
|
||||
|
||||
#[test]
|
||||
fn computer_dump_keypad_to_string() {
|
||||
|
||||
let mut x = Chip8Computer::new();
|
||||
x.keypad.push_key(0x1);
|
||||
x.keypad.push_key(0x2);
|
||||
assert_eq!(read_test_result("test_keypad_to_string.asc"), x.dump_keypad_to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
BIN
resources/roms/mondrian.ch8
Normal file
BIN
resources/roms/mondrian.ch8
Normal file
Binary file not shown.
4
resources/test/test_keypad_to_string.asc
Normal file
4
resources/test/test_keypad_to_string.asc
Normal file
@ -0,0 +1,4 @@
|
||||
|*|*|3|c|
|
||||
|4|5|6|d|
|
||||
|7|8|9|e|
|
||||
|a|0|b|f|
|
||||
Loading…
x
Reference in New Issue
Block a user