MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/coding/coding_tests/base64_test.cpp:7–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace base64;
6
7UNIT_TEST(Base64_Smoke)
8{
9 char const * bytes[] = {"H", "He", "Hel", "Hell", "Hello", "Hello,", "Hello, ", "Hello, World!"};
10 char const * encoded[] = {
11 "SA==", "SGU=", "SGVs", "SGVsbA==", "SGVsbG8=", "SGVsbG8s", "SGVsbG8sIA==", "SGVsbG8sIFdvcmxkIQ=="};
12
13 TEST_EQUAL(ARRAY_SIZE(bytes), ARRAY_SIZE(encoded), ());
14
15 for (size_t i = 0; i < ARRAY_SIZE(bytes); ++i)
16 {
17 TEST_EQUAL(Encode(bytes[i]), encoded[i], ());
18 TEST_EQUAL(Decode(encoded[i]), bytes[i], ());
19 TEST_EQUAL(Decode(Encode(bytes[i])), bytes[i], ());
20 TEST_EQUAL(Encode(Decode(encoded[i])), encoded[i], ());
21 }
22
23 char const * str = "MapsWithMe is the offline maps application for any device in the world.";
24 char const * encStr =
25 "TWFwc1dpdGhNZSBpcyB0aGUgb2ZmbGluZSBtYXBzIGFwcGxpY2F0aW9uIGZvciBhbnkgZGV2aWNlIGluIHRoZSB3b3JsZC4=";
26 TEST_EQUAL(Encode(str), encStr, ());
27 TEST_EQUAL(Decode(encStr), str, ());
28}

Callers

nothing calls this directly

Calls 2

EncodeFunction · 0.50
DecodeFunction · 0.50

Tested by

no test coverage detected