rc_cmdlength.c revision 293896
1#include "config.h"
2
3#include "ntp.h"
4#include "ntp_calendar.h"
5#include "ntp_stdlib.h"
6#include "rc_cmdlength.h"
7
8#include "unity.h"
9
10#include <string.h>
11
12#include "test-libntp.h"
13
14
15void
16test_EvaluateCommandLength(void){
17	size_t length, commandLength;
18	const char *command1 = "Random Command";
19	const char *command2 = "Random Command\t\t\n\t";
20	const char *command3 = "Random\nCommand\t\t\n\t";
21	const char *command4 = "Random Command\t\t\n\t1 2 3";
22
23	length = strlen(command1);
24	commandLength = remoteconfig_cmdlength(command1, command1+length);
25	TEST_ASSERT_EQUAL(14, commandLength );
26
27	length = strlen(command2);
28	commandLength = remoteconfig_cmdlength(command2, command2+length);
29	TEST_ASSERT_EQUAL(14, commandLength );
30
31	length = strlen(command3);
32	commandLength = remoteconfig_cmdlength(command3, command3+length);
33	TEST_ASSERT_EQUAL(6, commandLength );
34
35	length = strlen(command4);
36	commandLength = remoteconfig_cmdlength(command4, command4+length);
37	TEST_ASSERT_EQUAL(16, commandLength );
38
39}
40