EnvironmentVariable tests. More...
Public Member Functions | |
| EnvVarTestCase () | |
| Constructor.   | |
| ~EnvVarTestCase () override | |
| Destructor.   | |
| Public Member Functions inherited from ns3::TestCase | |
| TestCase (const TestCase &)=delete | |
| virtual | ~TestCase () | 
| Destructor.   | |
| std::string | GetName () const | 
| TestCase & | operator= (const TestCase &)=delete | 
Private Types | |
| using | KeyFoundType = EnvironmentVariable::KeyFoundType | 
| The return type from EnvironmentVariable::Get().   | |
| using | KeyValueStore = EnvironmentVariable::Dictionary::KeyValueStore | 
| The key,value store.   | |
Private Member Functions | |
| void | Check (const std::string &where, const std::string &envValue, KeyValueStore expect) | 
Read envValue and check that it contains only the key,value pairs from expect.   | |
| void | CheckGet (const std::string &where, const std::string &key, KeyFoundType expect) | 
| Check the result from a Get.   | |
| void | DoRun () override | 
| Run the tests.   | |
| void | SetAndCheck (const std::string &where, const std::string &envValue, KeyValueStore expect) | 
| Set and Check the variable.   | |
| void | SetCheckAndGet (const std::string &where, const std::string &envValue, KeyValueStore expectDict, const std::string &key, KeyFoundType expectValue) | 
| Set, Check, and Get a variable.   | |
| void | SetVariable (const std::string &where, const std::string &value) | 
| Set the test environment variable.   | |
| void | UnsetVariable (const std::string &where) | 
| Unset the test environment variable.   | |
Private Attributes | |
| const std::string | m_delimiter {"|"} | 
| Always use a non-default delimiter.   | |
| const std::string | m_variable {"NS_ENVVAR_TEST"} | 
| Test environment variable name.   | |
Additional Inherited Members | |
| Public Types inherited from ns3::TestCase | |
| enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } | 
| How long the test takes to execute.  More... | |
| Protected Member Functions inherited from ns3::TestCase | |
| TestCase (std::string name) | |
| Constructor.   | |
| void | AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK) | 
| Add an individual child TestCase to this test suite.   | |
| TestCase * | GetParent () const | 
| Get the parent of this TestCase.   | |
| bool | IsStatusFailure () const | 
| Check if any tests failed.   | |
| bool | IsStatusSuccess () const | 
| Check if all tests passed.   | |
| void | SetDataDir (std::string directory) | 
| Set the data directory where reference trace files can be found.   | |
| void | ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line) | 
| Log the failure of this TestCase.   | |
| bool | MustAssertOnFailure () const | 
| Check if this run should assert on failure.   | |
| bool | MustContinueOnFailure () const | 
| Check if this run should continue on failure.   | |
| std::string | CreateDataDirFilename (std::string filename) | 
| Construct the full path to a file in the data directory.   | |
| std::string | CreateTempDirFilename (std::string filename) | 
| Construct the full path to a file in a temporary directory.   | |
EnvironmentVariable tests.
Definition at line 36 of file environment-variable-test-suite.cc.
The return type from EnvironmentVariable::Get().
Definition at line 53 of file environment-variable-test-suite.cc.
      
  | 
  private | 
The key,value store.
Definition at line 50 of file environment-variable-test-suite.cc.
| ns3::tests::EnvVarTestCase::EnvVarTestCase | ( | ) | 
Constructor.
Definition at line 116 of file environment-variable-test-suite.cc.
References ns3::TestCase::TestCase().
      
  | 
  override | 
Destructor.
Definition at line 121 of file environment-variable-test-suite.cc.
References UnsetVariable().
      
  | 
  private | 
Read envValue and check that it contains only the key,value pairs from expect. 
| where | The test condition being checked. | 
| envValue | The environment variable to parse and check. | 
| expect | The set of key,values expected. | 
Definition at line 148 of file environment-variable-test-suite.cc.
References ns3::EnvironmentVariable::GetDictionary(), m_delimiter, m_variable, and NS_TEST_EXPECT_MSG_EQ.
Referenced by DoRun(), and SetAndCheck().
      
  | 
  private | 
Check the result from a Get.
| where | The test condition being checked. | 
| key | The key to check. | 
| expect | The expected result. | 
Definition at line 213 of file environment-variable-test-suite.cc.
References ns3::EnvironmentVariable::Get(), m_delimiter, m_variable, and NS_TEST_EXPECT_MSG_EQ.
Referenced by DoRun(), and SetCheckAndGet().
      
  | 
  overrideprivatevirtual | 
Run the tests.
Implements ns3::TestCase.
Definition at line 237 of file environment-variable-test-suite.cc.
References Check(), CheckGet(), ns3::EnvironmentVariable::Get(), m_variable, NS_TEST_EXPECT_MSG_EQ, SetCheckAndGet(), and UnsetVariable().
      
  | 
  private | 
Set and Check the variable.
| where | The test condition being checked. | 
| envValue | The environment variable to parse and check. | 
| expect | The set of key,values expected. | 
Definition at line 204 of file environment-variable-test-suite.cc.
References Check(), and SetVariable().
Referenced by SetCheckAndGet().
      
  | 
  private | 
Set, Check, and Get a variable.
| where | The test condition being checked. | 
| envValue | The environment variable to parse and check. | 
| expectDict | The set of key,values expected. | 
| key | The key to check. | 
| expectValue | The expected result. | 
Definition at line 226 of file environment-variable-test-suite.cc.
References CheckGet(), and SetAndCheck().
Referenced by DoRun().
      
  | 
  private | 
Set the test environment variable.
| where | The test condition being checked. | 
| value | The value to set. | 
Definition at line 127 of file environment-variable-test-suite.cc.
References ns3::EnvironmentVariable::Clear(), m_variable, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_NE, and ns3::EnvironmentVariable::Set().
Referenced by SetAndCheck().
      
  | 
  private | 
Unset the test environment variable.
| where | The test condition being checked. | 
Definition at line 140 of file environment-variable-test-suite.cc.
References ns3::EnvironmentVariable::Clear(), NS_TEST_EXPECT_MSG_EQ, and ns3::EnvironmentVariable::Unset().
Referenced by ~EnvVarTestCase(), and DoRun().
      
  | 
  private | 
Always use a non-default delimiter.
Definition at line 108 of file environment-variable-test-suite.cc.
Referenced by Check(), and CheckGet().
      
  | 
  private | 
Test environment variable name.
Definition at line 111 of file environment-variable-test-suite.cc.
Referenced by Check(), CheckGet(), DoRun(), and SetVariable().