From b242d1305474fb25ba883ebbb9779fa1577d5aa1 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Fri, 1 Apr 2022 09:04:45 -0400 Subject: [PATCH] make 'update' only compile for tests --- src/function.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/function.rs b/src/function.rs index 796add9..2691c19 100644 --- a/src/function.rs +++ b/src/function.rs @@ -258,20 +258,6 @@ impl FunctionEntry { self.invalidate_whole(); } - /// Update function settings - pub fn update( - &mut self, raw_func_str: &str, integral: bool, derivative: bool, - ) -> Option { - self.derivative = derivative; - self.integral = integral; - if raw_func_str != self.get_func_raw() { - self.update_string(raw_func_str); - self.get_test_result() - } else { - None - } - } - fn get_sum_func(&self, sum: Riemann) -> FunctionHelper { match sum { Riemann::Left => { @@ -571,6 +557,21 @@ impl FunctionEntry { /// Invalidate Derivative data pub fn invalidate_derivative(&mut self) { self.derivative_data = None; } + /// Depreciated, but still used for tests + #[cfg(test)] + pub fn update( + &mut self, raw_func_str: &str, integral: bool, derivative: bool, + ) -> Option { + self.derivative = derivative; + self.integral = integral; + if raw_func_str != self.get_func_raw() { + self.update_string(raw_func_str); + self.get_test_result() + } else { + None + } + } + /// Runs asserts to make sure everything is the expected value #[cfg(test)] pub fn tests(