|
@ -6,112 +6,112 @@ |
|
|
void setUp(void){} |
|
|
void setUp(void){} |
|
|
void tearDown(void){} |
|
|
void tearDown(void){} |
|
|
|
|
|
|
|
|
void test_gets_WithMinLengthAndMaxLength(void) { |
|
|
|
|
|
|
|
|
void test_usergets_WithMinLengthAndMaxLength(void) { |
|
|
unsigned long minLength = 3; |
|
|
unsigned long minLength = 3; |
|
|
unsigned long maxLength = 10; |
|
|
unsigned long maxLength = 10; |
|
|
char *input[] = {"ei", "e", "sddfdfdfdfdf", "dddd", NULL}; |
|
|
char *input[] = {"ei", "e", "sddfdfdfdfdf", "dddd", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
char *actual = gets("", &minLength, &maxLength); |
|
|
|
|
|
|
|
|
char *actual = usergets("", &minLength, &maxLength); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_gets_WithMinLength(void) { |
|
|
|
|
|
|
|
|
void test_usergets_WithMinLength(void) { |
|
|
unsigned long minLength = 3; |
|
|
unsigned long minLength = 3; |
|
|
char *input[] = {"", "ei", "e", "dddd", NULL}; |
|
|
char *input[] = {"", "ei", "e", "dddd", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
char *actual = gets("", &minLength, NULL); |
|
|
|
|
|
|
|
|
char *actual = usergets("", &minLength, NULL); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_gets_WithMaxLength(void) { |
|
|
|
|
|
|
|
|
void test_usergets_WithMaxLength(void) { |
|
|
unsigned long maxLength = 6; |
|
|
unsigned long maxLength = 6; |
|
|
char *input[] = {"dfdfdfdf", "dddd", NULL}; |
|
|
char *input[] = {"dfdfdfdf", "dddd", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
char *actual = gets("", NULL, &maxLength); |
|
|
|
|
|
|
|
|
char *actual = usergets("", NULL, &maxLength); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_gets_WithAnyLength(void) { |
|
|
|
|
|
|
|
|
void test_usergets_WithAnyLength(void) { |
|
|
char *input[] = {"dfdfdfdf", NULL}; |
|
|
char *input[] = {"dfdfdfdf", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
char *actual = gets("", NULL, NULL); |
|
|
|
|
|
|
|
|
char *actual = usergets("", NULL, NULL); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dfdfdfdf", actual, strlen(actual)); |
|
|
TEST_ASSERT_EQUAL_CHAR_ARRAY("dfdfdfdf", actual, strlen(actual)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_gethd_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergethd_WithMinAndMax(void) { |
|
|
short min = 10; |
|
|
short min = 10; |
|
|
short max = 100; |
|
|
short max = 100; |
|
|
char *input[] = {"sdf", "1", "101", "50", NULL}; |
|
|
char *input[] = {"sdf", "1", "101", "50", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_INT64(50, gethd("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT64(50, usergethd("", &min, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getd_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergetd_WithMinAndMax(void) { |
|
|
int min = 10; |
|
|
int min = 10; |
|
|
int max = 100000; |
|
|
int max = 100000; |
|
|
char *input[] = {"sdf", "4", "10000000", "1167", NULL}; |
|
|
char *input[] = {"sdf", "4", "10000000", "1167", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_INT64(1167, getd("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT64(1167, usergetd("", &min, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getd_WithMin(void) { |
|
|
|
|
|
|
|
|
void test_usergetd_WithMin(void) { |
|
|
int min = 10; |
|
|
int min = 10; |
|
|
char *input[] = {"sdf", "4", "10000000", NULL}; |
|
|
char *input[] = {"sdf", "4", "10000000", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_INT64(10000000, getd("", &min, NULL)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT64(10000000, usergetd("", &min, NULL)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getd_WithMax(void) { |
|
|
|
|
|
|
|
|
void test_usergetd_WithMax(void) { |
|
|
int max = 1000; |
|
|
int max = 1000; |
|
|
char *input[] = {"sdf", "4000", "10000000", "-200", NULL}; |
|
|
char *input[] = {"sdf", "4000", "10000000", "-200", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_INT64(-200, getd("", NULL, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT64(-200, usergetd("", NULL, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getld_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergetld_WithMinAndMax(void) { |
|
|
long min = -100; |
|
|
long min = -100; |
|
|
long max = 100000000; |
|
|
long max = 100000000; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_INT64(11001100, getld("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT64(11001100, usergetld("", &min, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getlld_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergetlld_WithMinAndMax(void) { |
|
|
long long min = -100; |
|
|
long long min = -100; |
|
|
long long max = 100000000; |
|
|
long long max = 100000000; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_INT64(11001100, getlld("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT64(11001100, usergetlld("", &min, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_gethu_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergethu_WithMinAndMax(void) { |
|
|
unsigned short min = 10; |
|
|
unsigned short min = 10; |
|
|
unsigned short max = 100; |
|
|
unsigned short max = 100; |
|
|
char *input[] = {"sdf", "-1", "1", "101", "50", NULL}; |
|
|
char *input[] = {"sdf", "-1", "1", "101", "50", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_UINT64(50, gethu("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(50, usergethu("", &min, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getu_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergetu_WithMinAndMax(void) { |
|
|
unsigned int min = 10; |
|
|
unsigned int min = 10; |
|
|
unsigned int max = 100000; |
|
|
unsigned int max = 100000; |
|
|
char *input[] = {"sdf", "4", "10000000", "1167", NULL}; |
|
|
char *input[] = {"sdf", "4", "10000000", "1167", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_UINT64(1167, getu("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(1167, usergetu("", &min, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getlu_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergetlu_WithMinAndMax(void) { |
|
|
unsigned long min = 100; |
|
|
unsigned long min = 100; |
|
|
unsigned long max = 100000000; |
|
|
unsigned long max = 100000000; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_UINT64(11001100, getlu("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(11001100, usergetlu("", &min, &max)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_getllu_WithMinAndMax(void) { |
|
|
|
|
|
|
|
|
void test_usergetllu_WithMinAndMax(void) { |
|
|
unsigned long long min = 100; |
|
|
unsigned long long min = 100; |
|
|
unsigned long long max = 100000000; |
|
|
unsigned long long max = 100000000; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; |
|
|
fakeInput = input; |
|
|
fakeInput = input; |
|
|
TEST_ASSERT_EQUAL_UINT64(11001100, getllu("", &min, &max)); |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(11001100, usergetllu("", &min, &max)); |
|
|
} |
|
|
} |