PhoenixGenerator  2.0.0
Set of tools to generate code
main.cpp File Reference
#include <iostream>
#include "phoenix_assert.h"
#include "phoenix_check.h"
#include "convertToString.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

template<typename T >
bool checkResultConvertToString (const std::string &testName, T value, const std::string &strReference)
 Check string expression. More...
 
int main (int argc, char **argv)
 
void testConvertToString ()
 Test convert to string. More...
 

Function Documentation

◆ checkResultConvertToString()

template<typename T >
bool checkResultConvertToString ( const std::string &  testName,
value,
const std::string &  strReference 
)

Check string expression.

Parameters
testName: name of the test
value: value to be tested
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 21 of file main.cpp.

21  {
22  std::string convertedValue(valueToString(value));
23  return phoenix_check(testName, convertedValue, strReference);
24 }
std::string valueToString(const T &val)
Convert a type into a string.
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.

References phoenix_check(), and valueToString().

+ Here is the call graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 53 of file main.cpp.

53  {
55  return 0;
56 }
void testConvertToString()
Test convert to string.
Definition: main.cpp:27

References testConvertToString().

+ Here is the call graph for this function:

◆ testConvertToString()

void testConvertToString ( )

Test convert to string.

Definition at line 27 of file main.cpp.

27  {
28  phoenix_assert(checkResultConvertToString<int>("Test value int", 1, "1"));
29  phoenix_assert(checkResultConvertToString<unsigned int>("Test value unsigned int", 1, "1"));
30  phoenix_assert(checkResultConvertToString<long int>("Test value long int", 1, "1"));
31  phoenix_assert(checkResultConvertToString<long unsigned int>("Test value long unsigned int", 1, "1"));
32  phoenix_assert(checkResultConvertToString<double>("Test value double", 1.0, "1"));
33  phoenix_assert(checkResultConvertToString<double>("Test value double", 1.5, "1.5"));
34  phoenix_assert(checkResultConvertToString<float>("Test value float", 1.0f, "1"));
35  phoenix_assert(checkResultConvertToString<float>("Test value float", 1.5f, "1.5"));
36  phoenix_assert(checkResultConvertToString<std::string>("Test value string", "1.0f", "1.0f"));
37  phoenix_assert(stringToValue<int>("314") == 314);
38  phoenix_assert(stringToValue<std::string>("314") == "314");
39 
40  phoenix_assert(stringToValue<PString>("314 456") == PString("314 456"));
41  phoenix_assert(valueToString<PString>(PString("314 456")) == "314 456");
42 
43  phoenix_assert(stringToValue<PPath>("314 456") == PPath("314 456"));
44  phoenix_assert(valueToString<PPath>(PPath("314 456")) == "314 456");
45 
46  phoenix_assert(valueToString(true) == "true");
47  phoenix_assert(valueToString(false) == "false");
48  phoenix_assert(stringToValue<bool>("true") == true);
49  phoenix_assert(stringToValue<bool>("false") == false);
50 }
Path of a directory or a file.
Definition: PPath.h:17
Extends the std::string.
Definition: PString.h:16
PPath stringToValue< PPath >(const std::string &str)
Convert a string to value (specialisation for PPath)
PString stringToValue< PString >(const std::string &str)
Convert a string to value (specialisation for PString)
std::string valueToString< PString >(const PString &val)
Convert a value to string (specialisation for PString)
std::string valueToString< PPath >(const PPath &val)
Convert a value to string (specialisation for PPath)
bool stringToValue< bool >(const std::string &str)
Convert a string to value (specialisation for bool)
#define phoenix_assert(isOk)

References phoenix_assert, stringToValue< bool >(), stringToValue< PPath >(), stringToValue< PString >(), valueToString(), valueToString< PPath >(), and valueToString< PString >().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: