hello.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include <stdio.h>
  2. #include <time.h>
  3. /*
  4. * hello.c
  5. */
  6. #define NDEBUG
  7. #ifdef MDEBUG
  8. #define TEST_LOG(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
  9. #else
  10. #define TEST_LOG(format, ...) fprintf(stderr, format);
  11. #endif
  12. #define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
  13. #define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
  14. #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
  15. void TestName()
  16. // CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
  17. // namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); } /* NOLINT */ \
  18. // CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
  19. // static void TestName()
  20. #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
  21. #define INTERNAL_CATCH_TESTCASE( ... ) \
  22. INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
  23. #define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
  24. #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
  25. #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
  26. int test()
  27. {
  28. int num = 2;
  29. TEST_LOG("my num is 1");
  30. return num;
  31. }
  32. int main(void) {
  33. printf("Hello World!\n");
  34. printf("long lenth = %d, int lenth = %d\n", sizeof(long), sizeof(int));
  35. int a;
  36. long b;
  37. printf("a = %d\n", a);
  38. printf("b = %d\n", b);
  39. TEST_CASE("test");
  40. printf("----------ok----------\n");
  41. return 0;
  42. }