You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/test/base32_unittest.cpp

26 lines
505 B
C++

#include <gtest/gtest.h>
#include <encode.hpp>
#include <llarp/aligned.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);
};