TestMathFunctions.cxx 470 B

123456789101112131415161718192021222324
  1. #include <string>
  2. #include <MathFunctions.h>
  3. int main(int argc, char* argv[])
  4. {
  5. if (argc < 2) {
  6. return -1;
  7. }
  8. std::string op(argv[1]);
  9. if (op == "add") {
  10. return mathfunctions::OpAdd(1.0, 1.0) != 2.0;
  11. } else if (op == "mul") {
  12. return mathfunctions::OpMul(5.0, 5.0) != 25.0;
  13. } else if (op == "sqrt") {
  14. return mathfunctions::sqrt(25.0) != 5.0;
  15. } else if (op == "sub") {
  16. return mathfunctions::OpSub(5.0, 1.0) != 4.0;
  17. }
  18. return -1;
  19. }