0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Add HostByName test

This commit is contained in:
Aaron 2009-01-21 15:50:49 -05:00
parent 9a36738d0c
commit 046e7f9acf
6 changed files with 52 additions and 1 deletions

View File

@ -17,7 +17,7 @@ OBJS=../stdafx.o ../util/sock.o ../grid/message.o ../util/mmap.o pdfile.o query.
DBGRID_OBJS=../stdafx.o json.o ../util/sock.o ../grid/message.o ../util/util.o jsobj.o ../client/dbclient.o ../dbgrid/dbgrid.o ../dbgrid/request.o ../client/connpool.o ../dbgrid/gridconfig.o commands.o ../dbgrid/dbgrid_commands.o ../dbgrid/griddatabase.o ../client/model.o ../util/background.o ../dbgrid/shard.o lasterror.o ../util/md5.o ../util/md5main.o security.o DBGRID_OBJS=../stdafx.o json.o ../util/sock.o ../grid/message.o ../util/util.o jsobj.o ../client/dbclient.o ../dbgrid/dbgrid.o ../dbgrid/request.o ../client/connpool.o ../dbgrid/gridconfig.o commands.o ../dbgrid/dbgrid_commands.o ../dbgrid/griddatabase.o ../client/model.o ../util/background.o ../dbgrid/shard.o lasterror.o ../util/md5.o ../util/md5main.o security.o
DBTEST_OBJS= $(OBJS) ../dbtests/dbtests.o ../dbtests/btreetests.o ../dbtests/jsobjtests.o ../dbtests/jsontests.o ../dbtests/matchertests.o ../dbtests/namespacetests.o ../dbtests/pairingtests.o ../dbtests/pdfiletests.o ../dbtests/querytests.o DBTEST_OBJS= $(OBJS) ../dbtests/dbtests.o ../dbtests/btreetests.o ../dbtests/jsobjtests.o ../dbtests/jsontests.o ../dbtests/matchertests.o ../dbtests/namespacetests.o ../dbtests/pairingtests.o ../dbtests/pdfiletests.o ../dbtests/querytests.o ../dbtests/socktests.o
GPP = g++ GPP = g++

View File

@ -90,6 +90,7 @@ int main( int argc, char** argv ) {
tests.add( pairingTests(), "pairing" ); tests.add( pairingTests(), "pairing" );
tests.add( pdfileTests(), "pdfile" ); tests.add( pdfileTests(), "pdfile" );
tests.add( queryTests(), "query" ); tests.add( queryTests(), "query" );
tests.add( sockTests(), "sock" );
return tests.run( argc, argv ); return tests.run( argc, argv );
} }

View File

@ -29,3 +29,4 @@ UnitTest::TestPtr namespaceTests();
UnitTest::TestPtr pairingTests(); UnitTest::TestPtr pairingTests();
UnitTest::TestPtr pdfileTests(); UnitTest::TestPtr pdfileTests();
UnitTest::TestPtr queryTests(); UnitTest::TestPtr queryTests();
UnitTest::TestPtr sockTests();

45
dbtests/socktests.cpp Normal file
View File

@ -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 >();
}

View File

@ -93,6 +93,7 @@
934DD88B0EFAD23B00459CC1 /* sock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sock.h; sourceTree = "<group>"; }; 934DD88B0EFAD23B00459CC1 /* sock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sock.h; sourceTree = "<group>"; };
934DD88D0EFAD23B00459CC1 /* unittest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unittest.h; sourceTree = "<group>"; }; 934DD88D0EFAD23B00459CC1 /* unittest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unittest.h; sourceTree = "<group>"; };
934DD88E0EFAD23B00459CC1 /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; }; 934DD88E0EFAD23B00459CC1 /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
937CACE90F27BF4900C57AA6 /* socktests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = socktests.cpp; sourceTree = "<group>"; };
93A6E10C0F24CF9800DA4EBF /* lasterror.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lasterror.h; sourceTree = "<group>"; }; 93A6E10C0F24CF9800DA4EBF /* lasterror.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lasterror.h; sourceTree = "<group>"; };
93A6E10D0F24CFB100DA4EBF /* flushtest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = flushtest.cpp; sourceTree = "<group>"; }; 93A6E10D0F24CFB100DA4EBF /* flushtest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = flushtest.cpp; sourceTree = "<group>"; };
93A6E10E0F24CFD300DA4EBF /* security.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = security.h; sourceTree = "<group>"; }; 93A6E10E0F24CFD300DA4EBF /* security.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = security.h; sourceTree = "<group>"; };
@ -156,6 +157,7 @@
934223850EF16D7000608550 /* dbtests */ = { 934223850EF16D7000608550 /* dbtests */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
937CACE90F27BF4900C57AA6 /* socktests.cpp */,
93D6BC9B0F266FC300FE5722 /* querytests.cpp */, 93D6BC9B0F266FC300FE5722 /* querytests.cpp */,
93D6BBF70F265E1100FE5722 /* matchertests.cpp */, 93D6BBF70F265E1100FE5722 /* matchertests.cpp */,
93AF75500F216D0300994C66 /* jsontests.cpp */, 93AF75500F216D0300994C66 /* jsontests.cpp */,

View File

@ -18,6 +18,8 @@
#pragma once #pragma once
#include "../stdafx.h"
#include <stdio.h> #include <stdio.h>
#include <sstream> #include <sstream>
#include "goodies.h" #include "goodies.h"