MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / encode_test

Function encode_test

tests/DCPS/FileSystemStorage/FileSystemStorageTest.cpp:10–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <stdexcept>
9
10bool 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
33int ACE_TMAIN(int, ACE_TCHAR*[])

Callers 1

ACE_TMAINFunction · 0.85

Calls 2

b32h_encodeFunction · 0.85
b32h_decodeFunction · 0.85

Tested by

no test coverage detected