forked from willamowius/gnugk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Toolkit.t.cxx
46 lines (39 loc) · 1.05 KB
/
Toolkit.t.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Toolkit.t.cxx
*
* unit tests for Toolkit.cxx
*
* Copyright (c) 2013, Jan Willamowius
*
* This work is published under the GNU Public License version 2 (GPLv2)
* see file COPYING for details.
* We also explicitly grant the right to link this code
* with the OpenH323/H323Plus and OpenSSL library.
*
*/
#include "config.h"
#include "Toolkit.h"
#include "gtest/gtest.h"
namespace {
class ToolkitTest : public ::testing::Test {
protected:
ToolkitTest() { }
NetworkAddress na;
NetworkAddress na2;
NetworkAddress na6;
};
TEST_F(ToolkitTest, NetworkAddress) {
na = NetworkAddress();
EXPECT_STREQ("0.0.0.0/0", na.AsString());
EXPECT_TRUE(na.IsAny());
na = NetworkAddress("1.2.3.4/24");
EXPECT_STREQ("1.2.3.0/24", na.AsString());
EXPECT_EQ(24u, na.GetNetmaskLen());
EXPECT_FALSE(na.IsAny());
na = NetworkAddress("9.9.9.0/24");
na2 = NetworkAddress("9.9.10.0/24");
EXPECT_FALSE(na == na2);
na6 = NetworkAddress("2001:db8:85a3:8d3:1319:8a2e:370:7344/128");
EXPECT_STREQ("2001:db8:85a3:8d3:1319:8a2e:370:7344/128", na6.AsString());
}
} // namespace