From 6ee205927000f2e91af21c67fab8ae260723cf14 Mon Sep 17 00:00:00 2001 From: TheUltimateOptimist Date: Mon, 29 Jan 2024 02:32:49 +0100 Subject: [PATCH] added test for gets with minLength --- test/test_userinput.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_userinput.c b/test/test_userinput.c index 38f0964..d2129ea 100644 --- a/test/test_userinput.c +++ b/test/test_userinput.c @@ -15,6 +15,14 @@ void test_gets_WithMinLengthAndMaxLength(void) { TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); } +void test_gets_WithMin(void) { + unsigned long minLength = 3; + char *input[] = {"", "ei", "e", "dddd", NULL}; + fakeInput = input; + char *actual = gets("", &minLength, NULL); + TEST_ASSERT_EQUAL_CHAR_ARRAY("dddd", actual, strlen(actual)); +} + void test_gethd_WithMinAndMax(void) { short min = 10; short max = 100;