]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/tests/ntpd/rc_cmdlength.c
Upgrade NTP to 4.2.8p4.
[FreeBSD/releng/10.2.git] / contrib / ntp / tests / ntpd / rc_cmdlength.c
1 #include "config.h"
2
3 #include "ntp.h"
4 #include "ntp_calendar.h"
5 #include "ntp_stdlib.h"
6
7 #include "unity.h"
8
9 #include <string.h>
10
11 #include "test-libntp.h"
12
13
14 void
15 test_EvaluateCommandLength(void){
16         size_t length, commandLength;
17         const char *command1 = "Random Command";
18         const char *command2 = "Random Command\t\t\n\t";
19         const char *command3 = "Random\nCommand\t\t\n\t";
20         const char *command4 = "Random Command\t\t\n\t1 2 3";
21         
22         length = strlen(command1);
23         commandLength = remoteconfig_cmdlength(command1, command1+length);
24         TEST_ASSERT_EQUAL(14, commandLength );
25         
26         length = strlen(command2);
27         commandLength = remoteconfig_cmdlength(command2, command2+length);
28         TEST_ASSERT_EQUAL(14, commandLength );
29
30         length = strlen(command3);
31         commandLength = remoteconfig_cmdlength(command3, command3+length);
32         TEST_ASSERT_EQUAL(6, commandLength );
33         
34         length = strlen(command4);
35         commandLength = remoteconfig_cmdlength(command4, command4+length);
36         TEST_ASSERT_EQUAL(16, commandLength );
37
38 }