--- /dev/null
+#define CATCH_CONFIG_RUNNER
+#include "catch.hpp"
+
+#include "operators.h"
+#include "operands.h"
+
+using namespace std;
+
+TEST_CASE("Noder")
+{
+ Const_int my_int{5};
+ Const_double my_double{2};
+ Const_double my_n_double{-2.3123124};
+ Const_int zero{0};
+
+ SECTION("Operands")
+ {
+ CHECK( my_int.get_postfix() == "5" );
+ CHECK( my_double.get_postfix() == "2.000" );
+ CHECK( my_n_double.get_postfix() == "-2.312" );
+
+ CHECK( my_int.get_infix() == "5" );
+ CHECK( my_double.get_infix() == "2.000" );
+ CHECK( my_n_double.get_infix() == "-2.312" );
+
+ CHECK( my_int.get_prefix() == "5" );
+ CHECK( my_double.get_prefix() == "2.000" );
+ CHECK( my_n_double.get_prefix() == "-2.312" );
+
+ CHECK( my_int.get_value() == 5 );
+ CHECK( my_double.get_value() == 2.0 );
+ CHECK( my_n_double.get_value() == -2.3123124 );
+ }
+
+ Addition my_add{my_int, my_double};
+ Subtraction my_sub{my_int, my_double};
+ Multiplication my_mult{my_int, my_double};
+ Division my_div{my_int, my_double};
+ Exponent my_exp{my_int, my_double};
+
+ SECTION("Operators")
+ {
+ CHECK( my_add.get_postfix() == "5 2.000 +" );
+ CHECK( my_add.get_infix() == "(5+2.000)" );
+ CHECK( my_add.get_prefix() == "+ 5 2.000" );
+ CHECK( my_add.get_value() == 7.0 );
+
+ CHECK( my_sub.get_postfix() == "5 2.000 -" );
+ CHECK( my_sub.get_infix() == "(5-2.000)" );
+ CHECK( my_sub.get_prefix() == "- 5 2.000" );
+ CHECK( my_sub.get_value() == 3.0 );
+
+ CHECK( my_mult.get_postfix() == "5 2.000 *" );
+ CHECK( my_mult.get_infix() == "(5*2.000)" );
+ CHECK( my_mult.get_prefix() == "* 5 2.000" );
+ CHECK( my_mult.get_value() == 10.0 );
+
+ CHECK( my_div.get_postfix() == "5 2.000 /" );
+ CHECK( my_div.get_infix() == "(5/2.000)" );
+ CHECK( my_div.get_prefix() == "/ 5 2.000" );
+ CHECK( my_div.get_value() == 2.5 );
+
+ CHECK( my_exp.get_postfix() == "5 2.000 ^" );
+ CHECK( my_exp.get_infix() == "(5^2.000)" );
+ CHECK( my_exp.get_prefix() == "^ 5 2.000" );
+ CHECK( my_exp.get_value() == 25.0);
+
+ CHECK_THROWS( Division{my_int, zero}.get_value() );
+ CHECK_THROWS( Division{my_double, zero}.get_value() );
+ CHECK_THROWS( Exponent{my_n_double, my_double}.get_value() );
+ CHECK_THROWS( Exponent{zero, my_n_double}.get_value() );
+ }
+}
+
+int main()
+{
+ Catch::Session session;
+
+ session.run();
+
+ return 0;
+}