MCPcopy Create free account
hub / github.com/apache/thrift / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

lib/cpp/test/Base64Test.cpp:49–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49BOOST_AUTO_TEST_CASE(test_Base64_Encode_Decode) {
50 int len;
51 uint8_t testInput[3];
52 uint8_t testOutput[4];
53
54 // Test all possible encoding / decoding cases given the
55 // three byte limit for base64_encode.
56
57 for (int i = 0xFFFFFF; i >= 0; i--) {
58
59 // fill testInput based on i
60 setupTestData(i, testInput, len);
61
62 // encode the test data, then decode it again
63 base64_encode(testInput, len, testOutput);
64
65 // verify each byte has a valid Base64 value (alphanumeric or either + or /)
66 checkEncoding(testOutput, len);
67
68 // decode output and check that it matches input
69 base64_decode(testOutput, len + 1);
70 BOOST_ASSERT(0 == memcmp(testInput, testOutput, len));
71 }
72}
73
74BOOST_AUTO_TEST_SUITE_END()

Callers

nothing calls this directly

Calls 4

setupTestDataFunction · 0.85
base64_encodeFunction · 0.85
checkEncodingFunction · 0.85
base64_decodeFunction · 0.85

Tested by

no test coverage detected