This commit is contained in:
Simon Gardling
2022-03-15 00:14:07 -04:00
parent 32e4699c5f
commit 5e9dc18469
6 changed files with 69 additions and 34 deletions

View File

@@ -133,7 +133,8 @@ pub fn process_func_str(function_in: String) -> String {
output_string.replace("log(", "log10(")
}
// Tests function to make sure it's able to be parsed. Returns the string of the Error produced, or an empty string if it runs successfully.
// Tests function to make sure it's able to be parsed. Returns the string of the
// Error produced, or an empty string if it runs successfully.
pub fn test_func(function_string: &str) -> Option<String> {
let parse_result = exmex::parse::<f64>(function_string);
@@ -169,7 +170,8 @@ pub fn test_func(function_string: &str) -> Option<String> {
}
}
// Used for testing: passes function to `add_asterisks` before running `test_func`
// Used for testing: passes function to `add_asterisks` before running
// `test_func`
#[cfg(test)]
fn test_func_helper(function_string: &str) -> Option<String> {
test_func(&process_func_str(function_string.to_string()))
@@ -225,7 +227,8 @@ fn func_process_test() {
test_process_helper("10pi", "10*π");
test_process_helper("pi10", "π*10");
// Need to fix these checks, maybe I need to rewrite the whole asterisk adding system... (or just implement these changes into meval-rs, idk)
// Need to fix these checks, maybe I need to rewrite the whole asterisk
// adding system... (or just implement these changes into meval-rs, idk)
// test_process_helper("emax(x)", "e*max(x)");
// test_process_helper("pisin(x)", "pi*sin(x)");
}