lokinet/test/api_unittest.cpp

25 lines
449 B
C++
Raw Normal View History

2018-06-23 00:00:44 +00:00
#include <gtest/gtest.h>
#include <llarp/api/messages.hpp>
class APITest : public ::testing::Test
{
public:
llarp_crypto crypto;
std::string apiPassword = "password";
APITest()
{
llarp_crypto_libsodium_init(&crypto);
}
~APITest()
{
}
};
TEST_F(APITest, TestMessageWellFormed)
{
2018-07-13 19:26:28 +00:00
llarp::api::AckMessage msg;
msg.seqno = 1;
2018-06-23 00:00:44 +00:00
msg.CalculateHash(&crypto, apiPassword);
ASSERT_TRUE(msg.IsWellFormed(&crypto, apiPassword));
};