diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-08-31 23:53:26 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-09-06 15:47:50 +0200 |
| commit | d85c396b2c4e677f41ed3967244b922feb2fa9dc (patch) | |
| tree | 2c530b80b98130ee244cbcccbd109f23758147f3 | |
| parent | ad77503d953302f22a621093ba359e24526892ec (diff) | |
| download | tools.nes-d85c396b2c4e677f41ed3967244b922feb2fa9dc.tar.gz tools.nes-d85c396b2c4e677f41ed3967244b922feb2fa9dc.zip | |
vnf-tests: add support for verbosity
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
| -rw-r--r-- | tests/vnf-tests/src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/vnf-tests/src/main.rs b/tests/vnf-tests/src/main.rs index 7ebf9dd..3ef35b0 100644 --- a/tests/vnf-tests/src/main.rs +++ b/tests/vnf-tests/src/main.rs @@ -51,9 +51,20 @@ fn parse_arguments() -> Args { res } +// Returns true if the 'VERBOSE' environment variable is either set to 'true' +// or '1', false otherwise. +fn verbose() -> bool { + let value = std::env::var("VNF_TESTS_VERBOSE") + .unwrap_or_else(|_| "0".to_string()) + .to_lowercase(); + + value == "true" || value == "1" +} + fn run_break_mark_test(path: &String) -> Result<(), String> { let rom = PathBuf::from(path).join("out/stack.nes"); let mut machine = Machine::from(&rom, 0x8000, MemoryPolicy::default())?; + machine.verbose = verbose(); // Get out of <start> let _ = machine.next_iteration(); @@ -116,6 +127,7 @@ fn run_joypad_test(path: &String) -> Result<(), String> { ], ); machine.run_function_mode = true; + machine.verbose = verbose(); machine.until_address(0xFFFF)?; assert_eq!(machine.ram[0x00].value, 2); |
