Пример #1
0
TEST_F(DNSTest, NoRecords) {
    DNS dns;
    EXPECT_TRUE(dns.queries().empty());
    EXPECT_TRUE(dns.answers().empty());
    EXPECT_TRUE(dns.authority().empty());
    EXPECT_TRUE(dns.additional().empty());
}
Пример #2
0
TEST_F(DNSTest, Additional) {
    DNS dns;
    
    const char *domain = "carlos.example.com";
    dns.add_additional(
        DNS::Resource("www.example.com", domain, DNS::CNAME, DNS::IN, 0x762)
    );
    dns.add_additional(
        DNS::Resource("www.example.com", domain, DNS::CNAME, DNS::IN, 0x762)
    );
    
    ASSERT_EQ(dns.additional_count(), 2);
    
    DNS::resources_type resources = dns.additional();
    for(DNS::resources_type::const_iterator it = resources.begin(); it != resources.end(); ++it) {
        EXPECT_EQ("www.example.com", it->dname());
        EXPECT_EQ(it->type(), DNS::CNAME);
        EXPECT_EQ(it->ttl(), 0x762U);
        EXPECT_EQ(it->data(), domain);
        EXPECT_EQ(it->query_class(), DNS::IN);
    }
}