| 8 | #include <stdexcept> |
| 9 | |
| 10 | bool encode_test(const char* plaintext, const char* expected) |
| 11 | { |
| 12 | using namespace OpenDDS::FileSystemStorage; |
| 13 | |
| 14 | ACE_TString result = b32h_encode(ACE_TEXT_CHAR_TO_TCHAR(plaintext)); |
| 15 | ACE_DEBUG((LM_DEBUG, "encoded {%C} =>\t{%s}\n", plaintext, result.c_str())); |
| 16 | ACE_TString exp(ACE_TEXT_CHAR_TO_TCHAR(expected)); |
| 17 | if (exp != result) |
| 18 | { |
| 19 | ACE_DEBUG ((LM_DEBUG, "\tshould be\t{%C}\n", expected)); |
| 20 | return false; |
| 21 | } |
| 22 | ACE_TString round_trip = b32h_decode(result.c_str()); |
| 23 | ACE_TString exp2(ACE_TEXT_CHAR_TO_TCHAR(plaintext)); |
| 24 | if (exp2 != round_trip) |
| 25 | { |
| 26 | ACE_DEBUG((LM_DEBUG, "decoding returned {%s}\n", round_trip.c_str())); |
| 27 | return false; |
| 28 | } |
| 29 | return true; |
| 30 | } |
| 31 | |
| 32 | |
| 33 | int ACE_TMAIN(int, ACE_TCHAR*[]) |
no test coverage detected