Skip to content

Commit

Permalink
changed main.rs cfg tests to xyz instead of bool (no current support)
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroGGBM committed Feb 19, 2024
1 parent d27dfe3 commit 0ec5946
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 149 deletions.
6 changes: 3 additions & 3 deletions conjure_oxide/src/generate_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ pub fn get_example_model(filename: &str) -> Result<Model, Box<dyn Error>> {
pub fn get_example_model_by_path(filepath: &str) -> Result<Model, Box<dyn Error>> {
let essence_path = PathBuf::from(filepath);

// Check if file exists and has the correct '.essence' extension
if !essence_path.is_file() || essence_path.extension().map_or(true, |e| e != "essence") {
// return error if file not found
if essence_path.as_os_str().is_empty() {
return Err(Box::new(std::io::Error::new(
std::io::ErrorKind::NotFound,
"ERROR: File not found or incorrect file type",
"ERROR: File not found in any subdirectory",
)));
}

Expand Down
11 changes: 8 additions & 3 deletions conjure_oxide/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,25 @@ mod tests {

#[test]
fn test_get_example_model_success() {
let filename = "bool-01";
let filename = "input";
get_example_model(filename).unwrap();
}

#[test]
fn test_get_example_model_by_filepath() {
let filepath = "tests/integration/basic/bool/01/bool-01.essence";
let filepath = "tests/integration/xyz/input.essence";
get_example_model_by_path(filepath).unwrap();

}

#[test]
fn test_get_example_model_fail_empty_filename() {
let filename = "";
get_example_model(filename).unwrap_err();
}

#[test]
fn test_get_example_model_fail_empty_filepath() {
let filepath = "";
get_example_model_by_path(filepath).unwrap_err();
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SolverTotalTime:0.046887
SolverTotalTime:0.021903
SavileRowClauseOut:0
SolverSolveTime:0.04689
SavileRowTotalTime:0.132
SolverSolveTime:0.021904
SavileRowTotalTime:0.067
SolverSatisfiable:1
SavileRowTimeOut:0
SolverNodes:2
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"conjure-output/model000001.eprime" "null" 1 0 1 0.04689 0.046887 0 2 0 1 0.132 NA 0 0 NA NA
"conjure-output/model000001.eprime" "null" 1 0 1 0.021904 0.021903 0 2 0 1 0.067 NA 0 0 NA NA

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 0ec5946

Please sign in to comment.