|
@@ -0,0 +1,63 @@
|
|
|
+// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
|
|
|
+//
|
|
|
+// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
+// purpose with or without fee is hereby granted, provided that the above
|
|
|
+// copyright notice and this permission notice appear in all copies.
|
|
|
+//
|
|
|
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
|
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
+// PERFORMANCE OF THIS SOFTWARE.
|
|
|
+
|
|
|
+#include <exceptions/exceptions.h>
|
|
|
+
|
|
|
+#include <util/memory_segment_local.h>
|
|
|
+
|
|
|
+#include <dns/name.h>
|
|
|
+#include <dns/rrclass.h>
|
|
|
+
|
|
|
+#include <datasrc/result.h>
|
|
|
+#include <datasrc/memory/zone_data.h>
|
|
|
+#include <datasrc/memory/zone_table.h>
|
|
|
+#include <datasrc/memory/memory_client.h>
|
|
|
+
|
|
|
+#include <gtest/gtest.h>
|
|
|
+
|
|
|
+#include <new> // for bad_alloc
|
|
|
+
|
|
|
+using namespace isc::dns;
|
|
|
+using namespace isc::datasrc;
|
|
|
+using namespace isc::datasrc::memory;
|
|
|
+
|
|
|
+namespace {
|
|
|
+class MemoryClientTest : public ::testing::Test {
|
|
|
+protected:
|
|
|
+ MemoryClientTest() : zclass_(RRClass::IN()),
|
|
|
+ zname1(Name("example.com")),
|
|
|
+ zname2(Name("example.net")),
|
|
|
+ zname3(Name("example")),
|
|
|
+ client_(new InMemoryClient(zclass_))
|
|
|
+ {}
|
|
|
+ ~MemoryClientTest() {
|
|
|
+ if (client_ != NULL) {
|
|
|
+ delete client_;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ void TearDown() {
|
|
|
+ delete client_;
|
|
|
+ client_ = NULL;
|
|
|
+ EXPECT_TRUE(mem_sgmt_.allMemoryDeallocated()); // catch any leak here.
|
|
|
+ }
|
|
|
+ const RRClass zclass_;
|
|
|
+ const Name zname1, zname2, zname3;
|
|
|
+ isc::util::MemorySegmentLocal mem_sgmt_;
|
|
|
+ InMemoryClient* client_;
|
|
|
+ memory::ZoneTable* zone_table;
|
|
|
+};
|
|
|
+
|
|
|
+TEST_F(MemoryClientTest, create) {
|
|
|
+}
|
|
|
+}
|