2007-02-26 18:54:03 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2005-01-27 21:05:44 +00:00
|
|
|
#include "../lstrings.h"
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2005-01-27 21:05:44 +00:00
|
|
|
using namespace lyx::support;
|
2007-02-26 18:54:03 +00:00
|
|
|
using namespace lyx;
|
2005-01-27 21:05:44 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
void test_lowercase()
|
|
|
|
{
|
2007-02-26 18:54:03 +00:00
|
|
|
cout << to_ascii(docstring(1, lowercase(char_type('A')))) << endl;
|
|
|
|
cout << to_ascii(lowercase(from_ascii("AlLe"))) << endl;
|
2005-01-27 21:05:44 +00:00
|
|
|
cout << lowercase('A') << endl;
|
2007-02-26 18:54:03 +00:00
|
|
|
cout << ascii_lowercase("AlLe") << endl;
|
2005-01-27 21:05:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_uppercase()
|
|
|
|
{
|
2007-02-26 18:54:03 +00:00
|
|
|
cout << to_ascii(docstring(1, uppercase(char_type('a')))) << endl;
|
|
|
|
cout << to_ascii(uppercase(from_ascii("AlLe"))) << endl;
|
2005-01-27 21:05:44 +00:00
|
|
|
cout << uppercase('a') << endl;
|
|
|
|
}
|
|
|
|
|
2015-05-14 10:10:42 +00:00
|
|
|
void test_formatFPNumber()
|
|
|
|
{
|
2015-06-28 09:26:40 +00:00
|
|
|
double const numbers[] = {
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
23.42,
|
|
|
|
1.3754937356458394574047e-20,
|
|
|
|
1.3754937356458394574047e-19,
|
|
|
|
1.3754937356458394574047e-18,
|
|
|
|
1.3754937356458394574047e-17,
|
|
|
|
1.3754937356458394574047e-16,
|
|
|
|
1.3754937356458394574047e-15,
|
|
|
|
1.3754937356458394574047e-14,
|
|
|
|
1.3754937356458394574047e-13,
|
|
|
|
1.3754937356458394574047e-12,
|
|
|
|
1.3754937356458394574047e-11,
|
|
|
|
1.3754937356458394574047e-10,
|
|
|
|
1.3754937356458394574047e-9,
|
|
|
|
1.3754937356458394574047e-8,
|
|
|
|
1.3754937356458394574047e-7,
|
|
|
|
1.3754937356458394574047e-6,
|
|
|
|
1.3754937356458394574047e-5,
|
|
|
|
1.3754937356458394574047e-4,
|
|
|
|
1.3754937356458394574047e-3,
|
|
|
|
1.3754937356458394574047e-2,
|
|
|
|
1.3754937356458394574047e-1,
|
|
|
|
1.3754937356458394574047,
|
|
|
|
1.3754937356458394574047e1,
|
|
|
|
1.3754937356458394574047e2,
|
|
|
|
1.3754937356458394574047e3,
|
|
|
|
1.3754937356458394574047e4,
|
|
|
|
1.3754937356458394574047e5,
|
|
|
|
1.3754937356458394574047e6,
|
|
|
|
1.3754937356458394574047e7,
|
|
|
|
1.3754937356458394574047e8,
|
|
|
|
1.3754937356458394574047e9,
|
|
|
|
1.3754937356458394574047e10,
|
|
|
|
1.3754937356458394574047e11,
|
|
|
|
1.3754937356458394574047e12,
|
|
|
|
1.3754937356458394574047e13,
|
|
|
|
1.3754937356458394574047e14,
|
|
|
|
1.3754937356458394574047e15,
|
|
|
|
1.3754937356458394574047e16,
|
|
|
|
1.3754937356458394574047e17,
|
|
|
|
1.3754937356458394574047e18,
|
|
|
|
1.3754937356458394574047e19,
|
|
|
|
1.3754937356458394574047e20,
|
|
|
|
1e-42,
|
|
|
|
1e42
|
|
|
|
};
|
|
|
|
int const n = sizeof(numbers) / sizeof(numbers[0]);
|
|
|
|
for (int i = 0; i < n; ++i)
|
|
|
|
cout << formatFPNumber(numbers[i]) << endl;
|
|
|
|
for (int i = 0; i < n; ++i)
|
|
|
|
cout << formatFPNumber(-numbers[i]) << endl;
|
2015-05-14 10:10:42 +00:00
|
|
|
}
|
|
|
|
|
2005-04-26 11:12:20 +00:00
|
|
|
int main()
|
2005-01-27 21:05:44 +00:00
|
|
|
{
|
|
|
|
test_lowercase();
|
|
|
|
test_uppercase();
|
2015-05-14 10:10:42 +00:00
|
|
|
test_formatFPNumber();
|
2005-01-27 21:05:44 +00:00
|
|
|
}
|