mirror of https://github.com/oxen-io/lokinet
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.
26 lines
488 B
C++
26 lines
488 B
C++
6 years ago
|
#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)
|
||
|
{
|
||
|
llarp::api::CreateSessionMessage msg;
|
||
|
msg.msgID = 0;
|
||
|
msg.sessionID = 12345;
|
||
|
msg.CalculateHash(&crypto, apiPassword);
|
||
|
ASSERT_TRUE(msg.IsWellFormed(&crypto, apiPassword));
|
||
|
};
|