test_assert_int.cocci 632 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. @@
  2. int e;
  3. constant c;
  4. @@
  5. (
  6. - tt_assert(e == c)
  7. + tt_int_op(e, OP_EQ, c)
  8. |
  9. - tt_assert(e != c)
  10. + tt_int_op(e, OP_NE, c)
  11. |
  12. - tt_assert(e < c)
  13. + tt_int_op(e, OP_LT, c)
  14. |
  15. - tt_assert(e <= c)
  16. + tt_int_op(e, OP_LE, c)
  17. |
  18. - tt_assert(e > c)
  19. + tt_int_op(e, OP_GT, c)
  20. |
  21. - tt_assert(e >= c)
  22. + tt_int_op(e, OP_GE, c)
  23. )
  24. @@
  25. unsigned int e;
  26. constant c;
  27. @@
  28. (
  29. - tt_assert(e == c)
  30. + tt_uint_op(e, OP_EQ, c)
  31. |
  32. - tt_assert(e != c)
  33. + tt_uint_op(e, OP_NE, c)
  34. |
  35. - tt_assert(e < c)
  36. + tt_uint_op(e, OP_LT, c)
  37. |
  38. - tt_assert(e <= c)
  39. + tt_uint_op(e, OP_LE, c)
  40. |
  41. - tt_assert(e > c)
  42. + tt_uint_op(e, OP_GT, c)
  43. |
  44. - tt_assert(e >= c)
  45. + tt_uint_op(e, OP_GE, c)
  46. )