aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/ntp/sntp/tests/run-packetProcessing.c
blob: ad02b7a543b19dbad98d171272b5022074461871 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* AUTOGENERATED FILE. DO NOT EDIT. */

//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
  Unity.CurrentTestName = #TestFunc; \
  Unity.CurrentTestLineNumber = TestLineNum; \
  Unity.NumberOfTests++; \
  if (TEST_PROTECT()) \
  { \
      setUp(); \
      TestFunc(); \
  } \
  if (TEST_PROTECT() && !TEST_IS_IGNORED) \
  { \
    tearDown(); \
  } \
  UnityConcludeTest(); \
}

//=======Automagically Detected Files To Include=====
#include "unity.h"
#include <setjmp.h>
#include <stdio.h>
#include "config.h"
#include "sntptest.h"
#include "networking.h"
#include "ntp_stdlib.h"

//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
extern void test_TooShortLength(void);
extern void test_LengthNotMultipleOfFour(void);
extern void test_TooShortExtensionFieldLength(void);
extern void test_UnauthenticatedPacketReject(void);
extern void test_CryptoNAKPacketReject(void);
extern void test_AuthenticatedPacketInvalid(void);
extern void test_AuthenticatedPacketUnknownKey(void);
extern void test_ServerVersionTooOld(void);
extern void test_ServerVersionTooNew(void);
extern void test_NonWantedMode(void);
extern void test_KoDRate(void);
extern void test_KoDDeny(void);
extern void test_RejectUnsyncedServer(void);
extern void test_RejectWrongResponseServerMode(void);
extern void test_AcceptNoSentPacketBroadcastMode(void);
extern void test_CorrectUnauthenticatedPacket(void);
extern void test_CorrectAuthenticatedPacketMD5(void);
extern void test_CorrectAuthenticatedPacketSHA1(void);


//=======Test Reset Option=====
void resetTest(void);
void resetTest(void)
{
  tearDown();
  setUp();
}

char const *progname;


//=======MAIN=====
int main(int argc, char *argv[])
{
  progname = argv[0];
  UnityBegin("packetProcessing.c");
  RUN_TEST(test_TooShortLength, 25);
  RUN_TEST(test_LengthNotMultipleOfFour, 26);
  RUN_TEST(test_TooShortExtensionFieldLength, 27);
  RUN_TEST(test_UnauthenticatedPacketReject, 28);
  RUN_TEST(test_CryptoNAKPacketReject, 29);
  RUN_TEST(test_AuthenticatedPacketInvalid, 30);
  RUN_TEST(test_AuthenticatedPacketUnknownKey, 31);
  RUN_TEST(test_ServerVersionTooOld, 32);
  RUN_TEST(test_ServerVersionTooNew, 33);
  RUN_TEST(test_NonWantedMode, 34);
  RUN_TEST(test_KoDRate, 35);
  RUN_TEST(test_KoDDeny, 36);
  RUN_TEST(test_RejectUnsyncedServer, 37);
  RUN_TEST(test_RejectWrongResponseServerMode, 38);
  RUN_TEST(test_AcceptNoSentPacketBroadcastMode, 39);
  RUN_TEST(test_CorrectUnauthenticatedPacket, 40);
  RUN_TEST(test_CorrectAuthenticatedPacketMD5, 41);
  RUN_TEST(test_CorrectAuthenticatedPacketSHA1, 42);

  return (UnityEnd());
}