Skip to content

Commit

Permalink
APU Implementation
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
Leirn committed Feb 22, 2022
1 parent a75334a commit 7cef968
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#[cfg(test)]
mod tests {
#[test]
fn nestest() {
let executable_directory = std::env::current_exe.unwrap().parent().unwrap();
let config_file = executable_directory.join("config.yaml");
let settings = load_file(config_file.to_str().unwrap());
test_name = "nestest";

let current_dir = std::env::current_dir().unwrap();
let rom_file = current_dir.join(
settings["tests"][test_name.as_str()]["rom_file"]
.as_str()
.unwrap(),
);
let log_file = current_dir.join(
settings["tests"][test_name.as_str()]["log_file"]
.as_str()
.unwrap(),
);
let entry_point = settings["tests"][test_name.as_str()]["entry_point"]
.as_i64()
.unwrap();
println!("Rom test file : {}", rom_file.to_str().unwrap());
println!("Log test file : {}", log_file.to_str().unwrap());
println!("Entry point should be : {:x}", entry_point);
let mut emulator = nes_emulator::NesEmulator::new(
rom_file.to_str().unwrap().to_string(),
);
emulator.set_test_mode(log_file.to_str().unwrap());
emulator.start(Some(
entry_point as u16,
),);
assert_eq!(2 + 2, 4);
}
}

0 comments on commit 7cef968

Please sign in to comment.