mirror of https://github.com/oxen-io/lokinet
Fix RouterVersion::IsEmpty() and RouterVersion::Clear()
This commit is contained in:
parent
f0571a9f2c
commit
cfabe72587
|
@ -40,7 +40,7 @@ namespace llarp
|
|||
RouterVersion::Clear()
|
||||
{
|
||||
m_Version.fill(0);
|
||||
m_ProtoVersion = LLARP_PROTO_VERSION;
|
||||
m_ProtoVersion = INVALID_VERSION;
|
||||
assert(IsEmpty());
|
||||
}
|
||||
|
||||
|
|
|
@ -30,4 +30,21 @@ TEST_F(TestRouterVersion, TestEmptyCompatibility)
|
|||
EXPECT_FALSE(v1.IsCompatableWith(llarp::emptyRouterVersion));
|
||||
}
|
||||
|
||||
TEST_F(TestRouterVersion, TestIsEmpty)
|
||||
{
|
||||
llarp::RouterVersion notEmpty( {0, 0, 1}, LLARP_PROTO_VERSION);
|
||||
EXPECT_FALSE(notEmpty.IsEmpty());
|
||||
|
||||
EXPECT_TRUE(llarp::emptyRouterVersion.IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(TestRouterVersion, TestClear)
|
||||
{
|
||||
llarp::RouterVersion version( {0, 0, 1}, LLARP_PROTO_VERSION);
|
||||
EXPECT_FALSE(version.IsEmpty());
|
||||
|
||||
version.Clear();
|
||||
|
||||
EXPECT_TRUE(version.IsEmpty());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue