-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cb7d07
commit 5bbedef
Showing
6 changed files
with
53 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[test] | ||
fn TEST_NAME() { | ||
test("FOLDER_NAME/DIR_NAME"); | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,39 @@ | ||
#[cfg(test)] | ||
mod TEST_MODULE_NAME { | ||
use crate::run_test; | ||
//TEST_FUNCTIONS_STABLE | ||
|
||
//TEST_FUNCTIONS_EXPERIMENTAL | ||
// stable tests | ||
//TEST_FUNCTIONS_STABLE | ||
|
||
// experimental tests | ||
//TEST_FUNCTIONS_EXPERIMENTAL | ||
|
||
use scheduler::models::{input::Input, output::FinalTasks}; | ||
use std::path::Path; | ||
use crate::common; | ||
|
||
fn test(folder: &str) { | ||
let (actual_output, desired_output) = generate_outputs(folder); | ||
assert_eq!(actual_output, desired_output); | ||
} | ||
|
||
/// Function to generate outputs | ||
fn generate_outputs(directory: &str) -> (String, String) { | ||
let input_path_str = format!("./tests/jsons/{}/input.json", directory); | ||
let output_path_str = format!("./tests/jsons/{}/expected.json", directory); | ||
let actual_output_path_str = format!("./tests/jsons/{}/observed.json", directory); | ||
|
||
let input_path = Path::new(&input_path_str[..]); | ||
let output_path = Path::new(&output_path_str[..]); | ||
let actual_output_path = Path::new(&actual_output_path_str[..]); | ||
|
||
let input: Input = common::get_input_from_json(input_path).unwrap(); | ||
let desired_output: String = common::get_output_string_from_json(output_path).unwrap(); | ||
|
||
let output: FinalTasks = scheduler::run_scheduler(input); | ||
let actual_output = serde_json::to_string_pretty(&output).unwrap(); | ||
|
||
common::write_to_file(actual_output_path, &actual_output).unwrap(); | ||
|
||
(actual_output, desired_output) | ||
} | ||
} |