Browse Source

[1177] More tests for SQLite3Accessor NSEC

Michal 'vorner' Vaner 13 years ago
parent
commit
a6cbb14cc9
1 changed files with 15 additions and 1 deletions
  1. 15 1
      src/lib/datasrc/tests/sqlite3_accessor_unittest.cc

+ 15 - 1
src/lib/datasrc/tests/sqlite3_accessor_unittest.cc

@@ -357,16 +357,30 @@ TEST_F(SQLite3AccessorTest, findPrevious) {
     // A name that doesn't exist
     EXPECT_EQ("dns01.example.com.",
               accessor->findPreviousName(1, "com.example.dns01x."));
+    // Largest name
+    EXPECT_EQ("www.example.com.",
+              accessor->findPreviousName(1, "com.example.wwww"));
     // Wrap around
     EXPECT_EQ("www.example.com.",
               accessor->findPreviousName(1, "com.example."));
+    // Out of zone before and after
+    EXPECT_EQ("www.example.com.",
+              accessor->findPreviousName(1, "bb.example."));
+    EXPECT_EQ("www.example.com.",
+              accessor->findPreviousName(1, "org.example."));
+    // Case insensitive?
+    EXPECT_EQ("dns01.example.com.",
+              accessor->findPreviousName(1, "com.exaMple.DNS02."));
+    // A name that doesn't exist
+    EXPECT_EQ("dns01.example.com.",
+              accessor->findPreviousName(1, "com.exaMple.DNS01X."));
 }
 
 TEST_F(SQLite3AccessorTest, findPreviousNoData) {
     // This one doesn't hold any NSEC records, so it shouldn't work
     // The underlying DB/data don't support DNSSEC, so it's not implemented
     // (does it make sense? Or different exception here?)
-    EXPECT_THROW(accessor->findPreviousName(3, "com.example."),
+    EXPECT_THROW(accessor->findPreviousName(3, "com.example.sql2.www."),
                  isc::NotImplemented);
 }