A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
qkd-test-suite.cc
Go to the documentation of this file.
1
2// Include a header file from your module to test.
3#include "ns3/qkd.h"
4
5// An essential include is test.h
6#include "ns3/test.h"
7
8// Do not put your test classes in namespace ns3. You may find it useful
9// to use the using directive to access the ns3 namespace directly
10using namespace ns3;
11
12// This is an example TestCase.
13class QkdTestCase1 : public TestCase
14{
15public:
18
19private:
20 virtual void DoRun();
21};
22
23// Add some help text to this case to describe what it is intended to test
25 : TestCase("Qkd test case(does nothing)")
26{
27}
28
29// This destructor does nothing but we include it as a reminder that
30// the test case should clean up after itself
34
35//
36// This method is the pure virtual method from class TestCase that every
37// TestCase must implement
38//
39void
41{
42 // A wide variety of test macros are available in src/core/test.h
43 NS_TEST_ASSERT_MSG_EQ(true, true, "true doesn't equal true for some reason");
44 // Use this one for floating point comparisons
45 NS_TEST_ASSERT_MSG_EQ_TOL(0.01, 0.01, 0.001, "Numbers are not equal within tolerance");
46}
47
48// The TestSuite class names the TestSuite, identifies what type of TestSuite,
49// and enables the TestCases to be run. Typically, only the constructor for
50// this class must be defined
51//
52class QkdTestSuite : public TestSuite
53{
54public:
56};
57
59 : TestSuite("qkd", UNIT)
60{
61 // TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
63}
64
65// Do not forget to allocate an instance of this TestSuite
67
virtual void DoRun()
Implementation to actually run this TestCase.
encapsulates test code
Definition test.h:1050
static constexpr auto QUICK
Deprecated test duration simple enums.
Definition test.h:1067
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition test.h:134
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition test.h:327
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static QkdTestSuite qkdTestSuite