Skip to content

Commit

Permalink
[test-rust-cli.rs] Add failure test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jul 18, 2023
1 parent 0365acc commit 4e3b648
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
1 change: 1 addition & 0 deletions examples/common/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pub(crate) fn run_command(
.args(args.iter())
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn();
let mut child = match child {
Ok(child) => child,
Expand Down
49 changes: 27 additions & 22 deletions examples/test-rust-cli.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
#[path = "./common/lib.rs"]
mod common;

use common::{run_tests, test_search_succeeds};

// TODO: Support `#[test]`.
fn copy_of_basic_cpp_cli_tests() -> Result<(), ()> {
test_search_succeeds(
common::CliCommand::Rust(),
&["samples/main/3x3x3.tws", "samples/main/tperm.scr"],
None,
" R2 D' F2 U F2 R2 U R2 U' R2",
)?;

// TODO: uncomment once the C++ CLI test passes.
// test_search_fails(
// common::CliCommand::Rust(),
// &["examples/test-cases/wildcard_conflict.tws"],
// None,
// "",
// )?;

// If no tests failed until now, we're okay!
Ok(())
}
use common::{run_tests, test_search_fails, test_search_succeeds};

// TODO: Support `#[test]`.
fn json_tests() -> Result<(), ()> {
Expand Down Expand Up @@ -52,6 +31,32 @@ fn json_tests() -> Result<(), ()> {
"F R U R' U' F'",
)?;

test_search_fails(
common::CliCommand::Rust(),
&[
"--moves",
"U,R,F",
"samples/json/3x3x3/3x3x3-Reid.def.json",
"samples/json/3x3x3/FRURUF.search-pattern.json",
],
None,
"11: ! scramble position permutation doesn't match solved",
)?;

test_search_fails(
common::CliCommand::Rust(),
&[
"--experimental-target-pattern",
"samples/json/3x3x3/OLL-or-CLS.target-pattern.json",
"--moves",
"U,R,F",
"samples/json/3x3x3/3x3x3-Reid.def.json",
"samples/json/3x3x3/FRURUF.exact.search-pattern.json",
],
None,
"11: ! scramble position permutation doesn't match solved",
)?;

test_search_succeeds(
common::CliCommand::Rust(),
&[
Expand Down

0 comments on commit 4e3b648

Please sign in to comment.