Ejemplo n.º 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());
}
Ejemplo n.º 2
0
TEST_F(DNSTest, Authority) {
    DNS dns;
    
    const char *domain = "carlos.example.com";
    dns.add_authority(
        DNS::Resource("www.example.com", domain, DNS::CNAME, DNS::IN, 0x762)
    );
    dns.add_authority(
        DNS::Resource("www.example.com", domain, DNS::CNAME, DNS::IN, 0x762)
    );
    
    ASSERT_EQ(dns.authority_count(), 2);
    
    DNS::resources_type resources = dns.authority();
    EXPECT_EQ(2, resources.size());
    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);
    }
}