From bd40855b6c2f0ea8f5407f1da09f36ff337668f4 Mon Sep 17 00:00:00 2001 From: TheUltimateOptimist Date: Mon, 29 Jan 2024 01:56:29 +0100 Subject: [PATCH] added test for gets wit minLength and maxLength --- test/test_userinput.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/test_userinput.c diff --git a/test/test_userinput.c b/test/test_userinput.c new file mode 100644 index 0000000..f41c11d --- /dev/null +++ b/test/test_userinput.c @@ -0,0 +1,16 @@ +#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)); +} \ No newline at end of file