Update README and add contrib dir
This commit is contained in:
23
contrib/real-device/test/examples-to-run.py
Normal file
23
contrib/real-device/test/examples-to-run.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
# A list of C++ examples to run in order to ensure that they remain
|
||||
# buildable and runnable over time. Each tuple in the list contains
|
||||
#
|
||||
# (example_name, do_run, do_valgrind_run).
|
||||
#
|
||||
# See test.py for more information.
|
||||
cpp_examples = [
|
||||
("evb-lan9668-sp", "True", "True"),
|
||||
("evb-lan9668-cbs", "True", "True"),
|
||||
("evb-lan9668-tas", "True", "True"),
|
||||
("evb-lan9668-psfp", "True", "True"),
|
||||
("evb-lan9668-frer", "True", "True"),
|
||||
]
|
||||
|
||||
# A list of Python examples to run in order to ensure that they remain
|
||||
# runnable over time. Each tuple in the list contains
|
||||
#
|
||||
# (example_name, do_run).
|
||||
#
|
||||
# See test.py for more information.
|
||||
python_examples = []
|
||||
86
contrib/real-device/test/real-device-test-suite.cc
Normal file
86
contrib/real-device/test/real-device-test-suite.cc
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
// Include a header file from your module to test.
|
||||
#include "ns3/evb-lan9668.h"
|
||||
|
||||
// An essential include is test.h
|
||||
#include "ns3/test.h"
|
||||
|
||||
// Do not put your test classes in namespace ns3. You may find it useful
|
||||
// to use the using directive to access the ns3 namespace directly
|
||||
using namespace ns3;
|
||||
|
||||
// Add a doxygen group for tests.
|
||||
// If you have more than one test, this should be in only one of them.
|
||||
/**
|
||||
* \defgroup real-device-tests Tests for real-device
|
||||
* \ingroup real-device
|
||||
* \ingroup tests
|
||||
*/
|
||||
|
||||
// This is an example TestCase.
|
||||
/**
|
||||
* \ingroup real-device-tests
|
||||
* Test case for feature 1
|
||||
*/
|
||||
class RealDeviceTestCase1 : public TestCase
|
||||
{
|
||||
public:
|
||||
RealDeviceTestCase1();
|
||||
virtual ~RealDeviceTestCase1();
|
||||
|
||||
private:
|
||||
void DoRun() override;
|
||||
};
|
||||
|
||||
// Add some help text to this case to describe what it is intended to test
|
||||
RealDeviceTestCase1::RealDeviceTestCase1()
|
||||
: TestCase("RealDevice test case (does nothing)")
|
||||
{
|
||||
}
|
||||
|
||||
// This destructor does nothing but we include it as a reminder that
|
||||
// the test case should clean up after itself
|
||||
RealDeviceTestCase1::~RealDeviceTestCase1()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// This method is the pure virtual method from class TestCase that every
|
||||
// TestCase must implement
|
||||
//
|
||||
void
|
||||
RealDeviceTestCase1::DoRun()
|
||||
{
|
||||
// A wide variety of test macros are available in src/core/test.h
|
||||
NS_TEST_ASSERT_MSG_EQ(true, true, "true doesn't equal true for some reason");
|
||||
// Use this one for floating point comparisons
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL(0.01, 0.01, 0.001, "Numbers are not equal within tolerance");
|
||||
}
|
||||
|
||||
// The TestSuite class names the TestSuite, identifies what type of TestSuite,
|
||||
// and enables the TestCases to be run. Typically, only the constructor for
|
||||
// this class must be defined
|
||||
|
||||
/**
|
||||
* \ingroup real-device-tests
|
||||
* TestSuite for module real-device
|
||||
*/
|
||||
class RealDeviceTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
RealDeviceTestSuite();
|
||||
};
|
||||
|
||||
RealDeviceTestSuite::RealDeviceTestSuite()
|
||||
: TestSuite("real-device", UNIT)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase(new RealDeviceTestCase1, TestCase::QUICK);
|
||||
}
|
||||
|
||||
// Do not forget to allocate an instance of this TestSuite
|
||||
/**
|
||||
* \ingroup real-device-tests
|
||||
* Static variable for test initialization
|
||||
*/
|
||||
static RealDeviceTestSuite srealDeviceTestSuite;
|
||||
Reference in New Issue
Block a user