You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.0 KiB

25 years ago
  1. #include <cl_io.h>
  2. #define ASSERT(expr) \
  3. if (!(expr)) { \
  4. fprint(cl_stderr,"Assertion failed! File "); \
  5. fprint(cl_stderr,__FILE__); \
  6. fprint(cl_stderr,", line "); \
  7. fprintdecimal(cl_stderr,__LINE__); \
  8. fprint(cl_stderr,".\n"); \
  9. error = 1; \
  10. }
  11. #define ASSERT1(expr,a) \
  12. if (!(expr)) { \
  13. fprint(cl_stderr,"Assertion failed! File "); \
  14. fprint(cl_stderr,__FILE__); \
  15. fprint(cl_stderr,", line "); \
  16. fprintdecimal(cl_stderr,__LINE__); \
  17. fprint(cl_stderr,".\n"); \
  18. fprint(cl_stderr,#a" = "); \
  19. fprint(cl_stderr,a); \
  20. fprint(cl_stderr,"\n"); \
  21. error = 1; \
  22. }
  23. #define ASSERT2(expr,a,b) \
  24. if (!(expr)) { \
  25. fprint(cl_stderr,"Assertion failed! File "); \
  26. fprint(cl_stderr,__FILE__); \
  27. fprint(cl_stderr,", line "); \
  28. fprintdecimal(cl_stderr,__LINE__); \
  29. fprint(cl_stderr,".\n"); \
  30. fprint(cl_stderr,#a" = "); \
  31. fprint(cl_stderr,a); \
  32. fprint(cl_stderr,"\n"#b" = "); \
  33. fprint(cl_stderr,b); \
  34. fprint(cl_stderr,"\n"); \
  35. error = 1; \
  36. }
  37. #define ASSERT3(expr,a,b,c) \
  38. if (!(expr)) { \
  39. fprint(cl_stderr,"Assertion failed! File "); \
  40. fprint(cl_stderr,__FILE__); \
  41. fprint(cl_stderr,", line "); \
  42. fprintdecimal(cl_stderr,__LINE__); \
  43. fprint(cl_stderr,".\n"); \
  44. fprint(cl_stderr,#a" = "); \
  45. fprint(cl_stderr,a); \
  46. fprint(cl_stderr,"\n"#b" = "); \
  47. fprint(cl_stderr,b); \
  48. fprint(cl_stderr,"\n"#c" = "); \
  49. fprint(cl_stderr,c); \
  50. fprint(cl_stderr,"\n"); \
  51. error = 1; \
  52. }
  53. #define ASSERT4(expr,a,b,c,d) \
  54. if (!(expr)) { \
  55. fprint(cl_stderr,"Assertion failed! File "); \
  56. fprint(cl_stderr,__FILE__); \
  57. fprint(cl_stderr,", line "); \
  58. fprintdecimal(cl_stderr,__LINE__); \
  59. fprint(cl_stderr,".\n"); \
  60. fprint(cl_stderr,#a" = "); \
  61. fprint(cl_stderr,a); \
  62. fprint(cl_stderr,"\n"#b" = "); \
  63. fprint(cl_stderr,b); \
  64. fprint(cl_stderr,"\n"#c" = "); \
  65. fprint(cl_stderr,c); \
  66. fprint(cl_stderr,"\n"#d" = "); \
  67. fprint(cl_stderr,d); \
  68. fprint(cl_stderr,"\n"); \
  69. error = 1; \
  70. }