summaryrefslogtreecommitdiff
path: root/dbtests/socktests.cpp
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-01-21 15:50:49 -0500
committerAaron <aaron@10gen.com>2009-01-21 15:50:49 -0500
commit046e7f9acf00f96c77fc92dc37efc1a5fcd2652a (patch)
treec95ff3871272498f358060c4bfd8f243016a2c62 /dbtests/socktests.cpp
parent9a36738d0c62e7a6d5950d0495e30f8c41f23e96 (diff)
downloadmongo-046e7f9acf00f96c77fc92dc37efc1a5fcd2652a.tar.gz
Add HostByName test
Diffstat (limited to 'dbtests/socktests.cpp')
-rw-r--r--dbtests/socktests.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/dbtests/socktests.cpp b/dbtests/socktests.cpp
new file mode 100644
index 00000000000..7923f25e73c
--- /dev/null
+++ b/dbtests/socktests.cpp
@@ -0,0 +1,45 @@
+// socktests.cpp : sock.{h,cpp} unit tests.
+//
+
+/**
+ * Copyright (C) 2008 10gen Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "../util/sock.h"
+
+#include "dbtests.h"
+
+namespace SockTests {
+
+ class HostByName {
+ public:
+ void run() {
+ ASSERT_EQUALS( "127.0.0.1", hostbyname( "localhost" ) );
+ ASSERT_EQUALS( "127.0.0.1", hostbyname( "127.0.0.1" ) );
+ }
+ };
+
+ class All : public UnitTest::Suite {
+ public:
+ All() {
+ add< HostByName >();
+ }
+ };
+
+} // namespace SockTests
+
+UnitTest::TestPtr sockTests() {
+ return UnitTest::createSuite< SockTests::All >();
+} \ No newline at end of file