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.

23 lines
489 B

  1. #include "unity.h"
  2. #include <limits.h>
  3. #include "CreateCustomer.h"
  4. void test_generateID(){
  5. srand(time(0));
  6. const int test_values = USHRT_MAX;
  7. /*initialize blocks by calling generateID()*/
  8. int *numbers = calloc(test_values, sizeof(int));
  9. for(int i=0;i<test_values;++i)
  10. {
  11. *(numbers+i) = generateID();
  12. printf("%d\n", *(numbers+i));
  13. }
  14. int delta = 5000000, expected = 5000000;
  15. for(int i=0;i<test_values;++i)
  16. {
  17. TEST_ASSERT_INT_WITHIN(delta, expected,*(numbers+i));
  18. }
  19. }