mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 21:13:35 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
28
coding/coding_tests/base64_test.cpp
Normal file
28
coding/coding_tests/base64_test.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "testing/testing.hpp"
|
||||
|
||||
#include "coding/base64.hpp"
|
||||
|
||||
|
||||
using namespace base64;
|
||||
|
||||
UNIT_TEST(Base64_Smoke)
|
||||
{
|
||||
char const * bytes[] = {"H", "He", "Hel", "Hell", "Hello", "Hello,", "Hello, ", "Hello, World!"};
|
||||
char const * encoded[] = {"SA==", "SGU=", "SGVs", "SGVsbA==", "SGVsbG8=", "SGVsbG8s",
|
||||
"SGVsbG8sIA==", "SGVsbG8sIFdvcmxkIQ=="};
|
||||
|
||||
TEST_EQUAL(ARRAY_SIZE(bytes), ARRAY_SIZE(encoded), ());
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(bytes); ++i)
|
||||
{
|
||||
TEST_EQUAL(Encode(bytes[i]), encoded[i], ());
|
||||
TEST_EQUAL(Decode(encoded[i]), bytes[i], ());
|
||||
TEST_EQUAL(Decode(Encode(bytes[i])), bytes[i], ());
|
||||
TEST_EQUAL(Encode(Decode(encoded[i])), encoded[i], ());
|
||||
}
|
||||
|
||||
char const * str = "MapsWithMe is the offline maps application for any device in the world.";
|
||||
char const * encStr = "TWFwc1dpdGhNZSBpcyB0aGUgb2ZmbGluZSBtYXBzIGFwcGxpY2F0aW9uIGZvciBhbnkgZGV2aWNlIGluIHRoZSB3b3JsZC4=";
|
||||
TEST_EQUAL(Encode(str), encStr, ());
|
||||
TEST_EQUAL(Decode(encStr), str, ());
|
||||
}
|
||||
Reference in New Issue
Block a user