2018-07-06 16:08:30 +00:00
|
|
|
#include <gtest/gtest.h>
|
2018-12-12 01:02:36 +00:00
|
|
|
|
2019-01-11 00:12:43 +00:00
|
|
|
#include <util/aligned.hpp>
|
2019-01-10 19:41:51 +00:00
|
|
|
#include <util/encode.hpp>
|
2018-07-06 16:08:30 +00:00
|
|
|
|
|
|
|
struct Base32Test : public ::testing::Test
|
|
|
|
{
|
2019-01-11 00:12:43 +00:00
|
|
|
Base32Test()
|
2018-07-06 16:08:30 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(Base32Test, Serialize)
|
|
|
|
{
|
|
|
|
llarp::AlignedBuffer< 32 > addr, otherAddr;
|
|
|
|
addr.Randomize();
|
|
|
|
char tmp[64] = {0};
|
|
|
|
std::string encoded = llarp::Base32Encode(addr, tmp);
|
|
|
|
ASSERT_TRUE(llarp::Base32Decode(tmp, otherAddr));
|
|
|
|
ASSERT_TRUE(otherAddr == addr);
|
2019-04-25 23:21:19 +00:00
|
|
|
}
|