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
658 B

  1. #include "unity.h"
  2. #include "userinput.h"
  3. #include "fakeinput.h"
  4. #include <string.h>
  5. void setUp(void){}
  6. void tearDown(void){}
  7. void test_gets_WithMinLengthAndMaxLength(void) {
  8. unsigned long minLength = 3;
  9. unsigned long maxLength = 10;
  10. char *input[] = {"ei", "e", "sddfdfdfdfdf", "dddd", NULL};
  11. fakeInput = input;
  12. char *actual = gets("", &minLength, &maxLength);
  13. TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual));
  14. }
  15. void test_gethd_WithMinAndMax(void) {
  16. short min = 10;
  17. short max = 100;
  18. char *input[] = {"sdf", "1", "101", "50"};
  19. fakeInput = input;
  20. TEST_ASSERT_EQUAL_INT64(50, gethd("", &min, &max));
  21. }