diff --git a/src/instructions/numeric.rs b/src/instructions/numeric.rs index 10a787c..100431b 100644 --- a/src/instructions/numeric.rs +++ b/src/instructions/numeric.rs @@ -13,13 +13,14 @@ use std::ops::{Add, Div, Mul, Sub}; use super::utils::{CastingTrait, NumericTrait}; /// Adds two addable values together. -fn _add(b: T, a: T) -> Option +fn _add(a: T, b: T) -> Option where T: Add + Copy, { Some(b + a) } make_instruction_new!(_add, int, int, int, int); +make_instruction_new!(_add, float, float, float, float); /// Subtracts two subtractable values from each other. fn _sub(vals: Vec) -> Option @@ -311,11 +312,8 @@ mod tests { /// Tests the _add function. #[test] fn add_test() { - let vals: Vec = vec![1, 2]; - assert_eq!(Some(3), _add(vals)); - - let vals: Vec = vec![dec!(1.1), dec!(2.2)]; - assert_eq!(Some(dec!(3.3)), _add(vals)); + assert_eq!(Some(3), _add(1, 2)); + assert_eq!(Some(dec!(3.3)), _add(dec!(1.1), dec!(2.2))); } /// Tests the _sub function. diff --git a/src/main.rs b/src/main.rs index 07d5c9b..9214a79 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,18 +7,6 @@ mod push; fn main() { // These need to stay so linter doesn't go crazy. - int_instructions(); - float_instructions(); - string_instructions(); - boolean_instructions(); - char_instructions(); - vector_int_instructions(); - vector_float_instructions(); - vector_string_instructions(); - vector_boolean_instructions(); - vector_char_instructions(); - exec_instructions(); - code_instructions(); let mut empty_state = EMPTY_STATE; interpret_program(&mut empty_state, 1000, 1000);