Limbo 3.5.4
Loading...
Searching...
No Matches
test_string.cpp
Go to the documentation of this file.
1
7
8#include <iostream>
9#include <string>
10#include <limbo/string/String.h>
12#include <limbo/math/Math.h>
13using std::cout;
14using std::endl;
15using std::string;
16
19int main()
20{
21 string s1 = "limbo2343slimbo";
22 string s2 = "LiMbo2343SliMbo";
23
24 limboAssertMsg(limbo::toupper(s1) == "LIMBO2343SLIMBO", "limbo::toupper failed");
25 limboAssertMsg(limbo::tolower(s2) == "limbo2343slimbo", "limbo::tolower failed");
26 limboAssertMsg(limbo::iequals(s1, s2), "limbo::iequals failed");
27
28 string tmp;
30 cout << tmp << "(" << tmp.size() << ")" << " == " << limbo::lowest<int>() << endl;
31 tmp = limbo::to_string(std::numeric_limits<int>::max());
32 cout << tmp << "(" << tmp.size() << ")" << " == " << std::numeric_limits<int>::max() << endl;
34 cout << tmp << "(" << tmp.size() << ")" << " == " << limbo::lowest<float>() << endl;
35 tmp = limbo::to_string(std::numeric_limits<float>::max());
36 cout << tmp << "(" << tmp.size() << ")" << " == " << std::numeric_limits<float>::max() << endl;
37
38 return 0;
39}
assertion with message
#define limboAssertMsg(condition, args...)
custom assertion with message
Definition AssertMsg.h:24
mathematical utilities such as abs
Check string is integer, floating point, number... Convert string to upper/lower cases.
string to_string(int val)
convert integer to string
Definition ToString.h:24
string toupper(string const &s)
convert string to upper case
Definition String.h:83
int lowest< int >()
specialization for integer types
Definition Math.h:121
float lowest< float >()
specialization for floating point types
Definition Math.h:157
T lowest()
generic function to get lowest value of numbers
bool iequals(string const &s1, string const &s2)
check two strings equal, case-insensitive
Definition String.h:108
string tolower(string const &s)
convert string to lower case
Definition String.h:95
int main()
main function