1
0

MathTestExec.cxx 819 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. int res = 0;
  5. bool print = false;
  6. void test_expression(int x, int y, const char* text)
  7. {
  8. bool fail = (x) != (y);
  9. if (fail) {
  10. res++;
  11. printf("Problem with EXPR:");
  12. }
  13. if (fail || print) {
  14. printf("Expression: \"%s\" in CMake returns %d", text, (y));
  15. if (fail) {
  16. printf(" while in C returns: %d", (x));
  17. }
  18. printf("\n");
  19. }
  20. }
  21. int main(int argc, char* argv[])
  22. {
  23. if (argc > 2) {
  24. printf("Usage: %s [print]\n", argv[0]);
  25. return 1;
  26. }
  27. if (argc > 1) {
  28. if (strcmp(argv[1], "print") != 0) {
  29. printf("Usage: %s [print]\n", argv[0]);
  30. return 1;
  31. }
  32. print = true;
  33. }
  34. #include "MathTestTests.h"
  35. if (res != 0) {
  36. printf("%s: %d math tests failed\n", argv[0], res);
  37. return 1;
  38. }
  39. return 0;
  40. }