这是一个本人学习 csapp 的 learning 库
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.

57 lines
1.9 KiB

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <limits.h>
  4. #define TMin INT_MIN
  5. #define TMax INT_MAX
  6. #include "btest.h"
  7. #include "bits.h"
  8. test_rec test_set[] = {
  9. //1
  10. {"bitXor", (funct_t) bitXor, (funct_t) test_bitXor, 2, "& ~", 14, 1,
  11. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  12. {"tmin", (funct_t) tmin, (funct_t) test_tmin, 0, "! ~ & ^ | + << >>", 4, 1,
  13. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  14. //2
  15. {"isTmax", (funct_t) isTmax, (funct_t) test_isTmax, 1, "! ~ & ^ | +", 10, 1,
  16. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  17. {"allOddBits", (funct_t) allOddBits, (funct_t) test_allOddBits, 1,
  18. "! ~ & ^ | + << >>", 12, 2,
  19. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  20. {"negate", (funct_t) negate, (funct_t) test_negate, 1,
  21. "! ~ & ^ | + << >>", 5, 2,
  22. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  23. //3
  24. {"isAsciiDigit", (funct_t) isAsciiDigit, (funct_t) test_isAsciiDigit, 1,
  25. "! ~ & ^ | + << >>", 15, 3,
  26. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  27. {"conditional", (funct_t) conditional, (funct_t) test_conditional, 3, "! ~ & ^ | << >>", 16, 3,
  28. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  29. {"isLessOrEqual", (funct_t) isLessOrEqual, (funct_t) test_isLessOrEqual, 2,
  30. "! ~ & ^ | + << >>", 24, 3,
  31. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  32. //4
  33. {"logicalNeg", (funct_t) logicalNeg, (funct_t) test_logicalNeg, 1,
  34. "~ & ^ | + << >>", 12, 4,
  35. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  36. {"howManyBits", (funct_t) howManyBits, (funct_t) test_howManyBits, 1, "! ~ & ^ | + << >>", 90, 4,
  37. {{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
  38. //float
  39. {"floatScale2", (funct_t) floatScale2, (funct_t) test_floatScale2, 1,
  40. "$", 30, 4,
  41. {{1, 1},{1,1},{1,1}}},
  42. {"floatFloat2Int", (funct_t) floatFloat2Int, (funct_t) test_floatFloat2Int, 1,
  43. "$", 30, 4,
  44. {{1, 1},{1,1},{1,1}}},
  45. {"floatPower2", (funct_t) floatPower2, (funct_t) test_floatPower2, 1,
  46. "$", 30, 4,
  47. {{1, 1},{1,1},{1,1}}},
  48. {"", NULL, NULL, 0, "", 0, 0,
  49. {{0, 0},{0,0},{0,0}}}
  50. };