1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/test/base32_unittest.cpp
2018-12-13 16:28:50 -05:00

24 lines
496 B
C++

#include <gtest/gtest.h>
#include <crypto.hpp>
#include <encode.hpp>
#include <logger.hpp>
struct Base32Test : public ::testing::Test
{
Base32Test() : crypto(llarp::Crypto::sodium{})
{
}
llarp::Crypto crypto;
};
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);
};