common.h 784 B

12345678910111213
  1. #ifndef _SANDBOX__TEST_COMMON_H_
  2. # define _SANDBOX__TEST_COMMON_H_
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #define _assertTrue(a) { int _a = (int) a; if(!_a) { fprintf(stderr, "File %s, line %d: fail asserting %d as true\n", __FILE__, __LINE__, _a); return -1; }}
  6. #define _assertEqual(a, b) { long long int _a = (long long int) a; long long int _b = (long long int) b; if(_a != _b) { fprintf(stderr, "File %s, line %d: fail asserting %lld equals %lld\n", __FILE__, __LINE__, _a, _b); return -1; }}
  7. #define _assertDiff(a, b) { long long int _a = (long long int) a; long long int _b = (long long int) b; if(_a == _b) { fprintf(stderr, "File %s, line %d: fail asserting %lld is different than %lld\n", __FILE__, __LINE__, _a, _b); return -1; }}
  8. #endif /* _SANDBOX__TEST_COMMON_H_ */