PhoenixSlider  2.0.0
Tool to create HTML presentation automatically
main.cpp File Reference
#include <iostream>
#include "phoenix_assert.h"
#include "phoenix_check.h"
#include "PString.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

void checkCharToString ()
 Check phoenix_charToString. More...
 
void checkCount ()
 Check count. More...
 
void checkEraseChar ()
 Check erase char. More...
 
bool checkEraseFirstChars (const std::string &testName, const std::string &strExpr, const std::string &strReference)
 Check the erase first chars. More...
 
bool checkEraseFirstLastChars (const PString &testName, const PString &strExpr, const PString &strReference)
 Check the erase first last chars. More...
 
bool checkEraseLastChars (const PString &testName, const PString &strExpr, const PString &strReference)
 Check the erase last chars. More...
 
void checkFind ()
 Check the find method. More...
 
void checkFindPatternIndex ()
 Check the findPatternIndex method. More...
 
void checkFormat ()
 Check format. More...
 
void checkGetBetweenDelimiter ()
 Check the getBetweenDelimiter method. More...
 
void checkGetCommonBegining ()
 Check the getCommonBegining. More...
 
void checkIsSameBegining ()
 Check isSameBegining. More...
 
void checkKeepChar ()
 Check the keepChar method. More...
 
void checkPStringLowerUpper ()
 Test lower/upper to string. More...
 
void checkPStringReplace ()
 Check PString Replace. More...
 
void checkSplitMerge ()
 Check the split and merge. More...
 
bool checkString (const std::string &testName, const std::string &strValue, const std::string &strReference)
 Check string lower expression. More...
 
void checkValueToStringConvertion ()
 Test value to string and string to value. More...
 
int main (int argc, char **argv)
 
void testEscapeString ()
 Test the phoenix_escapeStr function. More...
 
void testPString ()
 Test the PString. More...
 
void testPStringConversion ()
 Test the PString conversion. More...
 

Function Documentation

◆ checkCharToString()

void checkCharToString ( )

Check phoenix_charToString.

Definition at line 186 of file main.cpp.

186  {
188  phoenix_assert(phoenix_charToString("some text") == "some text");
189 }
PString phoenix_charToString(const char *ch)
Convert a char pointer into a string (event if the char pointer is NULL)
Definition: PString.cpp:14
#define phoenix_assert(isOk)

References phoenix_assert, and phoenix_charToString().

Referenced by main().

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

◆ checkCount()

void checkCount ( )

Check count.

Definition at line 173 of file main.cpp.

173  {
174  phoenix_assert(PString("").count('o') == 0lu);
175  phoenix_assert(PString("some thing to count").count('o') == 3lu);
176  phoenix_assert(PString("some thing to count").count('w') == 0lu);
177 
178  phoenix_assert(PString("some string with text").count("") == 0lu);
179  phoenix_assert(PString("").count("nothing") == 0lu);
180  phoenix_assert(PString("").count("") == 0lu);
181  phoenix_assert(PString("some string with text").count("with") == 1lu);
182  phoenix_assert(PString("one char and two chars").count("char") == 2lu);
183 }
Extends the std::string.
Definition: PString.h:16

References phoenix_assert.

Referenced by main().

+ Here is the caller graph for this function:

◆ checkEraseChar()

void checkEraseChar ( )

Check erase char.

Definition at line 272 of file main.cpp.

272  {
273  phoenix_assert(checkString("Test eraseChar", PString("").eraseChar('o'), ""));
274  phoenix_assert(checkString("Test eraseChar", PString("").eraseChar("o"), ""));
275  phoenix_assert(checkString("Test eraseChar", PString("some string to be used").eraseChar('o'), "sme string t be used"));
276  phoenix_assert(checkString("Test eraseChar", PString("some string to be used").eraseChar("o"), "sme string t be used"));
277  phoenix_assert(checkString("Test eraseChar", PString("some string to be used").eraseChar("oxi"), "sme strng t be used"));
278 
279  phoenix_assert(checkString("Test eraseLastChar", PString("").eraseLastChar("afe"), ""));
280  phoenix_assert(checkString("Test eraseLastChar", PString("").eraseLastChar("afe"), ""));
281 
282  phoenix_assert(checkEraseFirstChars("Erase first chars 1", "one thing", "one thing"));
283  phoenix_assert(checkEraseFirstChars("Erase first chars 2", " one thing", "one thing"));
284  phoenix_assert(checkEraseFirstChars("Erase first chars 3", "one thing ", "one thing "));
285  phoenix_assert(checkEraseFirstChars("Erase first chars 4", " one thing ", "one thing "));
286 
287  phoenix_assert(checkEraseLastChars("Erase last chars 1", "one thing", "one thing"));
288  phoenix_assert(checkEraseLastChars("Erase last chars 2", " one thing", " one thing"));
289  phoenix_assert(checkEraseLastChars("Erase last chars 3", "one thing ", "one thing"));
290  phoenix_assert(checkEraseLastChars("Erase last chars 4", " one thing ", " one thing"));
291 
292  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 1", "one thing", "one thing"));
293  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 2", " one thing", "one thing"));
294  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 3", "one thing ", "one thing"));
295  phoenix_assert(checkEraseFirstLastChars("Erase first last chars 4", " one thing ", "one thing"));
296 
297  PVecString vecIn;
298  vecIn.push_back(" one thing ");
299  PVecString vecOut = eraseFirstLastChar(vecIn, " ");
300  phoenix_assert(vecOut.size() == 1lu);
301  phoenix_assert(vecOut.front() == "one thing");
302 }
void eraseFirstLastChar(PVecString &vecOut, const PVecString &vecStr, const PString &vecChar)
Erase first and last characters of all PString in given vector.
Definition: PString.cpp:52
std::vector< PString > PVecString
Definition: PString.h:99
bool checkString(const std::string &testName, const std::string &strValue, const std::string &strReference)
Check string lower expression.
Definition: main.cpp:20
bool checkEraseLastChars(const PString &testName, const PString &strExpr, const PString &strReference)
Check the erase last chars.
Definition: main.cpp:252
bool checkEraseFirstChars(const std::string &testName, const std::string &strExpr, const std::string &strReference)
Check the erase first chars.
Definition: main.cpp:240
bool checkEraseFirstLastChars(const PString &testName, const PString &strExpr, const PString &strReference)
Check the erase first last chars.
Definition: main.cpp:264

References checkEraseFirstChars(), checkEraseFirstLastChars(), checkEraseLastChars(), checkString(), eraseFirstLastChar(), and phoenix_assert.

Referenced by main().

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

◆ checkEraseFirstChars()

bool checkEraseFirstChars ( const std::string &  testName,
const std::string &  strExpr,
const std::string &  strReference 
)

Check the erase first chars.

Parameters
testName: name of the test
strExpr: string to be parsed to get a MathExpr
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 240 of file main.cpp.

240  {
241  PString tmp(strExpr);
242  PString strErase(tmp.eraseFirstChar(" \t\n"));
243  return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
244 }
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.

References PString::eraseFirstChar(), and phoenix_check().

Referenced by checkEraseChar().

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

◆ checkEraseFirstLastChars()

bool checkEraseFirstLastChars ( const PString testName,
const PString strExpr,
const PString strReference 
)

Check the erase first last chars.

Parameters
testName: name of the test
strExpr: string to be parsed to get a MathExpr
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 264 of file main.cpp.

264  {
265  PString tmp(strExpr);
266  PString strErase(tmp.eraseFirstLastChar(" \t\n"));
267  return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
268 }

References PString::eraseFirstLastChar(), and phoenix_check().

Referenced by checkEraseChar().

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

◆ checkEraseLastChars()

bool checkEraseLastChars ( const PString testName,
const PString strExpr,
const PString strReference 
)

Check the erase last chars.

Parameters
testName: name of the test
strExpr: string to be parsed to get a MathExpr
strReference: reference string
Returns
true is both strings are equal, false otherwise

Definition at line 252 of file main.cpp.

252  {
253  PString tmp(strExpr);
254  PString strErase(tmp.eraseLastChar(" \t\n"));
255  return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
256 }

References PString::eraseLastChar(), and phoenix_check().

Referenced by checkEraseChar().

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

◆ checkFind()

void checkFind ( )

Check the find method.

Definition at line 201 of file main.cpp.

201  {
202  phoenix_assert(!PString("").find('0'));
203  phoenix_assert(!PString("123456").find('0'));
204  phoenix_assert(PString("1230456").find('0'));
205 
206  phoenix_assert(!PString("").find("0"));
207  phoenix_assert(!PString("some char").find(""));
208  phoenix_assert(PString("some char").find("co"));
209  phoenix_assert(!PString("some char").find("zwt"));
210 }

References phoenix_assert.

Referenced by main().

+ Here is the caller graph for this function:

◆ checkFindPatternIndex()

void checkFindPatternIndex ( )

Check the findPatternIndex method.

Definition at line 125 of file main.cpp.

125  {
126  phoenix_assert(phoenix_check("Check findPatternIndex empty string", PString("").findPatternIndex("key="), 0lu));
127  phoenix_assert(phoenix_check("Check findPatternIndex empty pattern", PString("garbage key=value").findPatternIndex(""), 17lu));
128  phoenix_assert(phoenix_check("Check findPatternIndex", PString("garbage key=value").findPatternIndex("key="), 8lu));
129 
130  phoenix_assert(phoenix_check("Check findPatternIndex offset", PString("key=garbage other key=value").findPatternIndex("key=", 11lu), 18lu));
131 }

References phoenix_assert, and phoenix_check().

Referenced by main().

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

◆ checkFormat()

void checkFormat ( )

Check format.

Definition at line 166 of file main.cpp.

166  {
167  PString str3("Some {} to modify with other {}s");
168  phoenix_assert(checkString("Check format", str3.format("sentence"), "Some sentence to modify with other {}s"));
169  phoenix_assert(checkString("Check format", str3.format("violin"), "Some violin to modify with other {}s"));
170 }

References checkString(), PString::format(), and phoenix_assert.

Referenced by main().

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

◆ checkGetBetweenDelimiter()

void checkGetBetweenDelimiter ( )

Check the getBetweenDelimiter method.

Definition at line 134 of file main.cpp.

134  {
135  phoenix_assert(phoenix_check("Check getBetweenDelimiter", PString("garbage key=value; other garbage").getBetweenDelimiter("key=", ";"), "value"));
136  phoenix_assert(phoenix_check("Check getBetweenDelimiter", PString("garbage key=value/othergarbage").getBetweenDelimiter("key=", "/"), "value"));
137 }

References phoenix_assert, and phoenix_check().

Referenced by main().

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

◆ checkGetCommonBegining()

void checkGetCommonBegining ( )

Check the getCommonBegining.

Definition at line 192 of file main.cpp.

192  {
193  phoenix_assert(PString("").getCommonBegining("") == "");
194  phoenix_assert(PString("someString").getCommonBegining("") == "");
195  phoenix_assert(PString("").getCommonBegining("someString") == "");
196  phoenix_assert(PString("someString").getCommonBegining("someOtherString") == "some");
197  phoenix_assert(PString("someString").getCommonBegining("AndsomeOtherString") == "");
198 }

References phoenix_assert.

Referenced by main().

+ Here is the caller graph for this function:

◆ checkIsSameBegining()

void checkIsSameBegining ( )

Check isSameBegining.

Definition at line 157 of file main.cpp.

157  {
158  phoenix_assert(PString("").isSameBegining(""));
159  phoenix_assert(!PString("").isSameBegining("d"));
160  phoenix_assert(PString("start").isSameBegining("start"));
161  phoenix_assert(PString("start").isSameBegining("st"));
162  phoenix_assert(!PString("st").isSameBegining("start"));
163 }

References phoenix_assert.

Referenced by main().

+ Here is the caller graph for this function:

◆ checkKeepChar()

void checkKeepChar ( )

Check the keepChar method.

Definition at line 213 of file main.cpp.

213  {
214  phoenix_assert(checkString("test keepChar empty", PString("some text").keepChar(""), ""));
215  phoenix_assert(checkString("test keepChar", PString("some text").keepChar("oest"), "soetet"));
216 }

References checkString(), and phoenix_assert.

Referenced by main().

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

◆ checkPStringLowerUpper()

void checkPStringLowerUpper ( )

Test lower/upper to string.

Definition at line 305 of file main.cpp.

305  {
306  phoenix_assert(!PString("").isLowerCase());
307  phoenix_assert(!PString("notOnlyLowerCase").isLowerCase());
308  phoenix_assert(PString("fulllowercase").isLowerCase());
309  phoenix_assert(!PString("").isUpperCase());
310  phoenix_assert(!PString("NOToNLYuPPERcASE").isUpperCase());
311  phoenix_assert(PString("FULLYUPPERCASE").isUpperCase());
312  phoenix_assert(!PString("").isNumber());
313  phoenix_assert(!PString("FULLYUPPERCASE").isNumber());
314  phoenix_assert(PString("12345").isNumber());
315 
316  phoenix_assert(checkString("Test", PString("").toLower(), ""));
317  phoenix_assert(checkString("Test", PString("StRiNg").toLower(), "string"));
318  phoenix_assert(checkString("Test", PString("StRiNg1234").toLower(), "string1234"));
319  phoenix_assert(checkString("Test", PString("ABCDEFGHIJKLMNOPQRSTUVWXYZ").toLower(), "abcdefghijklmnopqrstuvwxyz"));
320  phoenix_assert(checkString("Test", PString("").toUpper(), ""));
321  phoenix_assert(checkString("Test", PString("StRiNg").toUpper(), "STRING"));
322  phoenix_assert(checkString("Test", PString("StRiNg1234").toUpper(), "STRING1234"));
323  phoenix_assert(checkString("Test", PString("abcdefghijklmnopqrstuvwxyz").toUpper(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
324  phoenix_assert(checkString("Test", PString("").firstToLower(), ""));
325  phoenix_assert(checkString("Test", PString("ABC").firstToLower(), "aBC"));
326  phoenix_assert(checkString("Test", PString("aBC").firstToLower(), "aBC"));
327  phoenix_assert(checkString("Test", PString("Vec").firstToLower(), "vec"));
328  phoenix_assert(checkString("Test", PString("").firstToUpper(), ""));
329  phoenix_assert(checkString("Test", PString("ABC").firstToUpper(), "ABC"));
330  phoenix_assert(checkString("Test", PString("Vec").firstToUpper(), "Vec"));
331  phoenix_assert(checkString("Test", PString("aBC").firstToUpper(), "ABC"));
332  phoenix_assert(checkString("Test", PString("vec").firstToUpper(), "Vec"));
333  phoenix_assert(checkString("Test", PString("").toLowerUnderscore(), ""));
334  phoenix_assert(checkString("Test", PString("StringType").toLowerUnderscore(), "stringtype"));
335  phoenix_assert(checkString("Test", PString("String Type").toLowerUnderscore(), "string_type"));
336 }

References checkString(), and phoenix_assert.

Referenced by main().

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

◆ checkPStringReplace()

void checkPStringReplace ( )

Check PString Replace.

Definition at line 140 of file main.cpp.

140  {
141  PString str = "Some string to modify";
142  phoenix_assert(checkString("Check replace", str.replace("string", "sentence"), "Some sentence to modify"));
143  phoenix_assert(checkString("Check replace", PString("some string to modify").replace("string", "sentence"), "some sentence to modify"));
144 
145  PString str2("Some string to modify");
146  phoenix_assert(checkString("Check replace", str2.replace("string", "sentence", 0lu), "Some string to modify"));
147  phoenix_assert(checkString("Check replace", str2.replace("string", "sentence", 1lu), "Some sentence to modify"));
148 
149  PString str3("Some string to modify with other strings");
150  phoenix_assert(checkString("Check replace", str3.replace("string", "sentence", 1lu), "Some sentence to modify with other strings"));
151  phoenix_assert(checkString("Check replace", str3.replace("string", "violin", 1lu), "Some violin to modify with other strings"));
152 
153  phoenix_assert(checkString("Check replaceChar", PString("some string\nwith\tchar to replace").replaceChar(" \t\n", "_"), "some_string_with_char_to_replace"));
154 }
PString replace(const PString &pattern, const PString &replaceStr) const
Replace a PString into an other PString.
Definition: PString.cpp:251

References checkString(), phoenix_assert, and PString::replace().

Referenced by main().

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

◆ checkSplitMerge()

void checkSplitMerge ( )

Check the split and merge.

Definition at line 219 of file main.cpp.

219  {
220  phoenix_assert(PString("").split(' ').size() == 0lu);
221  PVecString vecStr(PString("Some String to split").split(' '));
222  phoenix_assert(vecStr.size() == 4lu);
223  phoenix_assert(PString("").merge(vecStr, " ") == "Some String to split");
224 
225  phoenix_assert(PString("").split("").size() == 0lu);
226  phoenix_assert(PString("Some String").split("").size() == 0lu);
227  phoenix_assert(PString("").split(" ").size() == 0lu);
228 
229  PVecString splitStr(PString("Some String to\tsplit").split(" \t"));
230  phoenix_assert(splitStr.size() == 4lu);
231  phoenix_assert(PString("").merge(splitStr, " ") == "Some String to split");
232 }

References phoenix_assert.

Referenced by main().

+ Here is the caller graph for this function:

◆ checkString()

bool checkString ( const std::string &  testName,
const std::string &  strValue,
const std::string &  strReference 
)

Check string lower expression.

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

Definition at line 20 of file main.cpp.

20  {
21  return phoenix_check(testName, strValue, strReference);
22 }

References phoenix_check().

+ Here is the call graph for this function:

◆ checkValueToStringConvertion()

void checkValueToStringConvertion ( )

Test value to string and string to value.

Definition at line 117 of file main.cpp.

117  {
118  PString str;
119  str.fromValue(3.14);
120  phoenix_assert(checkString("Test fromValue", str, "3.14"));
121  phoenix_assert(3.14 == str.toValue<double>());
122 }
PString & fromValue(const T &other)
Convert a value to a PString.
Definition: PString_impl.h:36
static T toValue(const PString &other)
Convert the given string into a value.
Definition: PString_impl.h:27

References checkString(), PString::fromValue(), phoenix_assert, and PString::toValue().

Referenced by main().

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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 355 of file main.cpp.

355  {
356  testPString();
362  checkFormat();
363  checkCount();
366  checkFind();
367  checkKeepChar();
368  checkSplitMerge();
369  checkEraseChar();
372  return 0;
373 }
void checkFindPatternIndex()
Check the findPatternIndex method.
Definition: main.cpp:125
void checkEraseChar()
Check erase char.
Definition: main.cpp:272
void checkFormat()
Check format.
Definition: main.cpp:166
void checkGetBetweenDelimiter()
Check the getBetweenDelimiter method.
Definition: main.cpp:134
void checkSplitMerge()
Check the split and merge.
Definition: main.cpp:219
void checkGetCommonBegining()
Check the getCommonBegining.
Definition: main.cpp:192
void checkIsSameBegining()
Check isSameBegining.
Definition: main.cpp:157
void checkPStringLowerUpper()
Test lower/upper to string.
Definition: main.cpp:305
void checkCount()
Check count.
Definition: main.cpp:173
void checkValueToStringConvertion()
Test value to string and string to value.
Definition: main.cpp:117
void testPString()
Test the PString.
Definition: main.cpp:25
void checkKeepChar()
Check the keepChar method.
Definition: main.cpp:213
void testEscapeString()
Test the phoenix_escapeStr function.
Definition: main.cpp:339
void checkFind()
Check the find method.
Definition: main.cpp:201
void checkPStringReplace()
Check PString Replace.
Definition: main.cpp:140
void checkCharToString()
Check phoenix_charToString.
Definition: main.cpp:186

References checkCharToString(), checkCount(), checkEraseChar(), checkFind(), checkFindPatternIndex(), checkFormat(), checkGetBetweenDelimiter(), checkGetCommonBegining(), checkIsSameBegining(), checkKeepChar(), checkPStringLowerUpper(), checkPStringReplace(), checkSplitMerge(), checkValueToStringConvertion(), testEscapeString(), and testPString().

+ Here is the call graph for this function:

◆ testEscapeString()

void testEscapeString ( )

Test the phoenix_escapeStr function.

Definition at line 339 of file main.cpp.

339  {
340  phoenix_assert(phoenix_check("PString::escapeStr", PString("some string with escape's \"char\"").escapeStr(" '\"", "\\"), "some\\ string\\ with\\ escape\\'s\\ \\\"char\\\""));
341 }

References phoenix_assert, and phoenix_check().

Referenced by main().

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

◆ testPString()

void testPString ( )

Test the PString.

Definition at line 25 of file main.cpp.

25  {
26  PString baseStr("baseString");
27  phoenix_assert(checkString("Test constructor", baseStr, "baseString"));
28  PString checkEqual;
29  checkEqual = baseStr;
30  phoenix_assert(checkString("Test equal", checkEqual, "baseString"));
31 
32  PString checkEqualStdString;
33  checkEqualStdString = std::string("baseString");
34  phoenix_assert(checkString("Test equal std::string", checkEqualStdString, "baseString"));
35 
36  PString checkConstructorStdString(std::string("baseString"));
37  phoenix_assert(checkString("Test constructor std::string", checkConstructorStdString, "baseString"));
38 
39  PString copyString(baseStr);
40  phoenix_assert(checkString("Test copy constructor", copyString, "baseString"));
41  PString equalOperatorStr;
42  equalOperatorStr = baseStr;
43  phoenix_assert(checkString("Test equal operator str", equalOperatorStr, "baseString"));
44 
45  PString equalOperatorFluxStr;
46  equalOperatorFluxStr = baseStr;
47  phoenix_assert(checkString("Test << operator str", equalOperatorFluxStr, "baseString"));
48 
49  baseStr += " end";
50  phoenix_assert(checkString("Test += string", baseStr, "baseString end"));
51 
52  PString valDouble;
53  valDouble = 42.0;
54  phoenix_assert(checkString("Test equal operator double", valDouble, "42"));
55 
56  PString valFloat;
57  valFloat = 42.0f;
58  phoenix_assert(checkString("Test equal operator float", valFloat, "42"));
59 
60  PString valDoubleFlux;
61  valDoubleFlux << 42.0;
62  phoenix_assert(checkString("Test << operator double", valDoubleFlux, "42"));
63 
64  PString strAndChar("strin");
65  strAndChar += 'g';
66  phoenix_assert(checkString("Test + operator char", strAndChar, "string"));
67 
68  PString valFloatFlux;
69  valFloatFlux << 42.0f;
70  phoenix_assert(checkString("Test << operator float", valFloatFlux, "42"));
71 
72  valDouble += 3.14;
73  phoenix_assert(checkString("Test += operator double", valDouble, "423.14"));
74 
75  valFloat += 3.14f;
76  phoenix_assert(checkString("Test += operator float", valFloat, "423.14"));
77 
78  PString resAdd = valDouble + valFloat;
79  phoenix_assert(checkString("Test + operator PString", resAdd, "423.14423.14"));
80 
81  PString resAddDouble;
82  resAddDouble = PString("double ") + PString::toString(3.14);
83  phoenix_assert(checkString("Test + operator double", resAddDouble, "double 3.14"));
84 
85  PString resAddFloat;
86  resAddFloat = PString("float ") + PString::toString(3.14);
87  phoenix_assert(checkString("Test + operator float", resAddFloat, "float 3.14"));
88 
89  PString strA("str1"), strB("str2"), resResAB, resFluxAB;
90  resResAB = strA + strB;
91  phoenix_assert(checkString("Test + operator PString", resResAB, "str1str2"));
92  resFluxAB << strA << strB;
93  phoenix_assert(checkString("Test << operator PString", resFluxAB, "str1str2"));
94 
95  PString strAddStr("Some string");
96  strAddStr += " other string";
97  phoenix_assert(checkString("Test += operator std::string", strAddStr, "Some string other string"));
98 
99  PString strAddFluxStr("Some string");
100  strAddFluxStr << " other string";
101  phoenix_assert(checkString("Test << operator std::string", strAddFluxStr, "Some string other string"));
102 
103  PString strFlux;
104  strFlux << strAddFluxStr;
105  phoenix_assert(checkString("Test << operator PString", strFlux, "Some string other string"));
106 
107  strFlux += std::string(" and the end");
108  phoenix_assert(checkString("Test += operator std::string", strFlux, "Some string other string and the end"));
109 
110  strFlux << std::string(".");
111  phoenix_assert(checkString("Test += operator std::string", strFlux, "Some string other string and the end."));
112 
113  strA << (strFlux << strAddFluxStr);
114 }
static PString toString(const T &value)
Convert a value to a PString.
Definition: PString_impl.h:18

References checkString(), phoenix_assert, and PString::toString().

Referenced by main().

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

◆ testPStringConversion()

void testPStringConversion ( )

Test the PString conversion.

Definition at line 344 of file main.cpp.

344  {
345  phoenix_assert(PString::toValue<int>("314") == 314);
346  phoenix_assert(PString::toValue<std::string>("314") == "314");
347 
348  phoenix_assert(PString::toString(true) == "true");
349  phoenix_assert(PString::toString(false) == "false");
350  phoenix_assert(PString::toValue<bool>("true") == true);
351  phoenix_assert(PString::toValue<bool>("false") == false);
352 
353 }

References phoenix_assert, and PString::toString().

+ Here is the call graph for this function: