update tests
This commit is contained in:
parent
8c3aa1d0d4
commit
345851d8b4
@ -456,23 +456,9 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn left_function_test() {
|
fn function_entry_test() {
|
||||||
let area_target = 0.9600000000000001;
|
do_test(Riemann::Left, 0.9600000000000001);
|
||||||
|
do_test(Riemann::Middle, 0.92);
|
||||||
do_test(Riemann::Left, area_target);
|
do_test(Riemann::Right, 0.8800000000000001);
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn middle_function_test() {
|
|
||||||
let area_target = 0.92;
|
|
||||||
|
|
||||||
do_test(Riemann::Middle, area_target);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn right_function_test() {
|
|
||||||
let area_target = 0.8800000000000001;
|
|
||||||
|
|
||||||
do_test(Riemann::Right, area_target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,9 @@ impl FunctionOutput {
|
|||||||
/// expected
|
/// expected
|
||||||
#[test]
|
#[test]
|
||||||
fn function_output_test() {
|
fn function_output_test() {
|
||||||
|
let empty_value = vec![Value::new(0, 0)];
|
||||||
|
let empty_bars = (vec![Bar::new(0.0, 0.0)], 0.0);
|
||||||
|
|
||||||
let mut function_output = FunctionOutput::new_empty();
|
let mut function_output = FunctionOutput::new_empty();
|
||||||
assert!(function_output.back.is_none());
|
assert!(function_output.back.is_none());
|
||||||
assert!(function_output.integral.is_none());
|
assert!(function_output.integral.is_none());
|
||||||
@ -51,23 +54,23 @@ fn function_output_test() {
|
|||||||
assert!(function_output.extrema.is_none());
|
assert!(function_output.extrema.is_none());
|
||||||
assert!(function_output.roots.is_none());
|
assert!(function_output.roots.is_none());
|
||||||
|
|
||||||
function_output.back = Some(vec![Value::new(0, 0)]);
|
function_output.back = Some(empty_value.clone());
|
||||||
function_output.invalidate_back();
|
function_output.invalidate_back();
|
||||||
assert!(function_output.back.is_none());
|
assert!(function_output.back.is_none());
|
||||||
|
|
||||||
function_output.integral = Some((vec![Bar::new(0.0, 0.0)], 0.0));
|
function_output.integral = Some(empty_bars.clone());
|
||||||
function_output.invalidate_integral();
|
function_output.invalidate_integral();
|
||||||
assert!(function_output.integral.is_none());
|
assert!(function_output.integral.is_none());
|
||||||
|
|
||||||
function_output.derivative = Some(vec![Value::new(0, 0)]);
|
function_output.derivative = Some(empty_value.clone());
|
||||||
function_output.invalidate_derivative();
|
function_output.invalidate_derivative();
|
||||||
assert!(function_output.derivative.is_none());
|
assert!(function_output.derivative.is_none());
|
||||||
|
|
||||||
function_output.back = Some(vec![Value::new(0, 0)]);
|
function_output.back = Some(empty_value.clone());
|
||||||
function_output.integral = Some((vec![Bar::new(0.0, 0.0)], 0.0));
|
function_output.integral = Some(empty_bars);
|
||||||
function_output.derivative = Some(vec![Value::new(0, 0)]);
|
function_output.derivative = Some(empty_value.clone());
|
||||||
function_output.extrema = Some(vec![Value::new(0, 0)]);
|
function_output.extrema = Some(empty_value.clone());
|
||||||
function_output.roots = Some(vec![Value::new(0, 0)]);
|
function_output.roots = Some(empty_value);
|
||||||
|
|
||||||
function_output.invalidate_whole();
|
function_output.invalidate_whole();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user