#include "unity.h" #include "userinput.h" #include "fakeinput.h" #include void setUp(void){} void tearDown(void){} void test_gets_WithMinLengthAndMaxLength(void) { unsigned long minLength = 3; unsigned long maxLength = 10; char *input[] = {"ei", "e", "sddfdfdfdfdf", "dddd", NULL}; fakeInput = input; char *actual = gets("", &minLength, &maxLength); TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); } void test_gethd_WithMinAndMax(void) { short min = 10; short max = 100; char *input[] = {"sdf", "1", "101", "50", NULL}; fakeInput = input; TEST_ASSERT_EQUAL_INT64(50, gethd("", &min, &max)); } void test_getd_WithMinAndMax(void) { int min = 10; int max = 100000; char *input[] = {"sdf", "4", "10000000", "1167", NULL}; fakeInput = input; TEST_ASSERT_EQUAL_INT64(1167, getd("", &min, &max)); } void test_getld_WithMinAndMax(void) { long min = -100; long max = 100000000; char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; fakeInput = input; TEST_ASSERT_EQUAL_INT64(11001100, getld("", &min, &max)); } void test_getlld_WithMinAndMax(void) { long long min = -100; long long max = 100000000; char *input[] = {"sdf", "-400", "10000000000000", "11001100", NULL}; fakeInput = input; TEST_ASSERT_EQUAL_INT64(11001100, getlld("", &min, &max)); } void test_gethu_WithMinAndMax(void) { unsigned short min = 10; unsigned short max = 100; char *input[] = {"sdf", "-1", "1", "101", "50", NULL}; fakeInput = input; TEST_ASSERT_EQUAL_INT64(50, gethu("", &min, &max)); }