Commit b7d038718688c1e3fc0a01dcf6b4523e810f5dc7
1 parent
a9e7f7a3
update tests
Showing
1 changed file
with
32 additions
and
3 deletions
test/test_GApplication.cpp
| ... | ... | @@ -50,14 +50,43 @@ void test_GLog(void) |
| 50 | 50 | } |
| 51 | 51 | std::cout << "."; |
| 52 | 52 | |
| 53 | - // Test output stream | |
| 53 | + // Test stream logger | |
| 54 | 54 | try { |
| 55 | 55 | GLog log; |
| 56 | - log << "This is a text"; | |
| 56 | + log.date(true); | |
| 57 | + log.name("Test"); | |
| 58 | + log.open("test_GApplication.log", true); | |
| 59 | + log << "1. This is a C++ string" << std::endl; | |
| 60 | + log << "2. This is an integer: " << int(1) << std::endl; | |
| 61 | + log << "3. This is a single precision: " << float(1.23456789) << std::endl; | |
| 62 | + log << "4. This is a double precision: " << double(1.23456789) << std::endl; | |
| 63 | + log << "5. This is a character: " << 'a' << std::endl; | |
| 64 | + log << "6. This is a C string: " << "a" << std::endl; | |
| 65 | + log << "7. This is a Boolean: " << true << std::endl; | |
| 57 | 66 | } |
| 58 | 67 | catch (std::exception &e) { |
| 59 | 68 | std::cout << std::endl |
| 60 | - << "TEST ERROR: Unable to put stream into GLog object." | |
| 69 | + << "TEST ERROR: Unable to stream into GLog object." | |
| 70 | + << std::endl; | |
| 71 | + std::cout << e.what() << std::endl; | |
| 72 | + throw; | |
| 73 | + } | |
| 74 | + std::cout << "."; | |
| 75 | + | |
| 76 | + // Test C logger | |
| 77 | + try { | |
| 78 | + GLog log; | |
| 79 | + log.date(true); | |
| 80 | + log.name("Test"); | |
| 81 | + log.open("test_GApplication.log"); | |
| 82 | + log("%s", "8. This is a C++ string"); | |
| 83 | + log("%s %d", "9. This is an integer:", int(1)); | |
| 84 | + log("%s %f", "10. This is a single precision:", float(1.23456789)); | |
| 85 | + log("%s %f", "11. This is a double precision:", double(1.23456789)); | |
| 86 | + } | |
| 87 | + catch (std::exception &e) { | |
| 88 | + std::cout << std::endl | |
| 89 | + << "TEST ERROR: Unable to write into GLog object." | |
| 61 | 90 | << std::endl; |
| 62 | 91 | std::cout << e.what() << std::endl; |
| 63 | 92 | throw; | ... | ... |