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.
24 lines
658 B
24 lines
658 B
#include "unity.h"
|
|
#include "userinput.h"
|
|
#include "fakeinput.h"
|
|
#include <string.h>
|
|
|
|
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"};
|
|
fakeInput = input;
|
|
TEST_ASSERT_EQUAL_INT64(50, gethd("", &min, &max));
|
|
}
|