TEST(Address, ctor) { Address a; EXPECT_FALSE(a.is_manually_configured()); EXPECT_EQ(a.mid(), MacAddress()); EXPECT_EQ(a.station_type(), StationType::UNKNOWN); EXPECT_EQ(a.country_code(), 0); }
TEST_F(LocationTableTest, has_entry) { Address a; a.mid({1, 2, 3, 4, 5, 6}); EXPECT_FALSE(loct->has_entry(a)); LongPositionVector pv; pv.gn_addr = a; loct->update(pv); EXPECT_TRUE(loct->has_entry(a)); // only MID of GN_ADDR should be used for look-up a.country_code(42); EXPECT_TRUE(loct->has_entry(a)); a.mid({0, 2, 3, 4, 5, 6}); EXPECT_FALSE(loct->has_entry(a)); }
TEST(Address, equality) { Address a; Address b({0x01, 0x02, 0x03, 0x04, 0x05, 0x06}); EXPECT_NE(a, b); Address c = b; EXPECT_EQ(b, c); c.is_manually_configured(true); EXPECT_NE(b, c); Address d = c; EXPECT_EQ(c, d); d.station_type(StationType::PASSENGER_CAR); EXPECT_NE(c, d); Address e = d; EXPECT_EQ(d, e); e.country_code(8); EXPECT_NE(d, e); a.mid(b.mid()); EXPECT_EQ(a, b); }