nx_video_source_sdk  1.0
Video Source SDK
Classes | Macros | Functions | Variables
ini_config_ut.cpp File Reference
#include <cstring>
#include <ctime>
#include <fstream>
#include <iostream>
#include <string>
#include <nx/kit/test.h>
#include <nx/kit/ini_config.h>

Classes

struct  TestIni
 
struct  SavedIni
 

Macros

#define ASSERT_INI_PARAM_EQ(PARAM)   ASSERT_EQ_AT_LINE(line, expected.PARAM, actual.PARAM)
 
#define ASSERT_INI_PARAM_STREQ(PARAM)   ASSERT_STREQ_AT_LINE(line, expected.PARAM, actual.PARAM)
 
#define GENERATE_INI_PARAM_VAL(PARAM)   content << #PARAM << "=" << nx::kit::utils::toString(ini.PARAM) << std::endl
 
#define GENERATE_INI_PARAM_STR(PARAM)   outputStr(ini.PARAM, #PARAM)
 

Functions

std::ostream & nx::kit::operator<< (std::ostream &s, IniConfig::ParamType value)
 
static TestIniini ()
 
template<class ExpectedIni , class ActualIni >
static void assertIniEquals (int line, const ExpectedIni &expected, const ActualIni &actual)
 
static void generateIniFile (const SavedIni &ini)
 
template<class Ini , class ExpectedIni >
static void testReload (int line, const ExpectedIni &expectedIni, Ini *ini, const std::string &testCaseTag, const std::string &expectedOutput)
 
 TEST (iniConfig, testSuccess)
 

Variables

static constexpr char kIniFile [] = "test.ini"
 
static const TestIni defaultIni
 

Detailed Description

NOTE: Intended to be compiled twice - both with and without -DNX_INI_CONFIG_DISABLED. This is needed to test ini_config in both Enabled and Disabled modes. To avoid symbol clashing, one or both of the two compilations should produce a dynamic library.

Function Documentation

◆ generateIniFile()

static void generateIniFile ( const SavedIni ini)
static

Create a .ini file with the contents from the supplied IniConfig object.

◆ ini()

static TestIni& ini ( )
static

Using a static instance just to test this possibility.