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.

40 lines
939 B

  1. #include <unity.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. #include <Error.h>
  5. void setUp(){}
  6. void tearDown(){}
  7. void test_error()
  8. {
  9. /*arrange*/
  10. srand(time(0));
  11. int bound = 1000;
  12. int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10;
  13. /*act*/
  14. val1 = rand() % 1000 + 1;
  15. val2 = rand() % 1000 + 1;
  16. val3 = rand() % 1000 + 1;
  17. val4 = rand() % 1000 + 1;
  18. val5 = rand() % 1000 + 1;
  19. val6 = rand() % 1000 + 1;
  20. val7 = rand() % 1000 + 1;
  21. val8 = rand() % 1000 + 1;
  22. val9 = rand() % 1000 + 1;
  23. val10 = rand() % 1000 + 1;
  24. /*assertions*/
  25. TEST_ASSERT_EQUAL_INT(0,error(val1));
  26. TEST_ASSERT_EQUAL_INT(0,error(val2));
  27. TEST_ASSERT_EQUAL_INT(0,error(val3));
  28. TEST_ASSERT_EQUAL_INT(0,error(val4));
  29. TEST_ASSERT_EQUAL_INT(0,error(val5));
  30. TEST_ASSERT_EQUAL_INT(0,error(val6));
  31. TEST_ASSERT_EQUAL_INT(0,error(val7));
  32. TEST_ASSERT_EQUAL_INT(0,error(val8));
  33. TEST_ASSERT_EQUAL_INT(0,error(val9));
  34. TEST_ASSERT_EQUAL_INT(0,error(val10));
  35. }