summaryrefslogtreecommitdiff
path: root/src/mongo/unittest
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2012-06-04 13:42:11 -0400
committerAndy Schwerin <schwerin@10gen.com>2012-06-04 13:42:11 -0400
commit5975ab63216078b444b531fb87486a4c1e7bf64b (patch)
tree3319e27dc540445a235dbae22ffbd75ff0f805b2 /src/mongo/unittest
parent82811e8dc84a7f59e8f1dc00187a3863f8fb349f (diff)
downloadmongo-5975ab63216078b444b531fb87486a4c1e7bf64b.tar.gz
SERVER-5702 Whitespace fixup.
Diffstat (limited to 'src/mongo/unittest')
-rw-r--r--src/mongo/unittest/unittest.cpp34
-rw-r--r--src/mongo/unittest/unittest.h46
2 files changed, 40 insertions, 40 deletions
diff --git a/src/mongo/unittest/unittest.cpp b/src/mongo/unittest/unittest.cpp
index 34b90dccc33..54f5d56734b 100644
--- a/src/mongo/unittest/unittest.cpp
+++ b/src/mongo/unittest/unittest.cpp
@@ -31,7 +31,7 @@ namespace mongo {
namespace {
typedef std::map<std::string, Suite*> SuiteMap;
- inline SuiteMap &_allSuites() {
+ inline SuiteMap& _allSuites() {
static SuiteMap allSuites;
return allSuites;
}
@@ -40,7 +40,7 @@ namespace mongo {
class Result {
public:
- Result( const std::string &name ) : _name( name ) , _rc(0) , _tests(0) , _fails(0) , _asserts(0) {}
+ Result( const std::string& name ) : _name( name ) , _rc(0) , _tests(0) , _fails(0) , _asserts(0) {}
std::string toString() {
std::stringstream ss;
@@ -71,7 +71,7 @@ namespace mongo {
static Result * cur;
};
- Result *Result::cur = 0;
+ Result* Result::cur = 0;
Test::Test() {}
Test::~Test() {}
@@ -85,7 +85,7 @@ namespace mongo {
void Test::setUp() {}
void Test::tearDown() {}
- Suite::Suite( const std::string &name ) : _name( name ) {
+ Suite::Suite( const std::string& name ) : _name( name ) {
registerSuite( name , this );
}
@@ -105,7 +105,7 @@ namespace mongo {
Result::cur = r;
for ( std::vector<TestHolder*>::iterator i=_tests.begin(); i!=_tests.end(); i++ ) {
- TestHolder * tc = *i;
+ TestHolder* tc = *i;
if ( filter.size() && tc->getName().find( filter ) == std::string::npos ) {
log(1) << "\t skipping test: " << tc->getName() << " because doesn't match filter" << std::endl;
continue;
@@ -126,7 +126,7 @@ namespace mongo {
tc->run();
passes = true;
}
- catch ( const TestAssertionFailureException & ae ) {
+ catch ( const TestAssertionFailureException& ae ) {
err << ae.toString();
}
catch ( const std::exception& e ) {
@@ -158,7 +158,7 @@ namespace mongo {
return r;
}
- int Suite::run( const std::vector<std::string> &suites , const std::string& filter ) {
+ int Suite::run( const std::vector<std::string>& suites , const std::string& filter ) {
if (_allSuites().empty()) {
std::cout << "error: no suites registered.";
@@ -202,7 +202,7 @@ namespace mongo {
int asserts = 0;
for ( std::vector<Result*>::iterator i=results.begin(); i!=results.end(); i++ ) {
- Result * r = *i;
+ Result* r = *i;
std::cout << r->toString();
if ( abs( r->rc() ) > abs( rc ) )
rc = r->rc();
@@ -222,7 +222,7 @@ namespace mongo {
return rc;
}
- void Suite::registerSuite( const std::string &name , Suite * s ) {
+ void Suite::registerSuite( const std::string& name , Suite* s ) {
Suite*& m = _allSuites()[name];
fassert( 10162, ! m );
m = s;
@@ -238,16 +238,16 @@ namespace mongo {
void Suite::setupTests() {}
TestAssertionFailureDetails::TestAssertionFailureDetails(
- const std::string &theFile,
+ const std::string& theFile,
unsigned theLine,
- const std::string &theMessage )
+ const std::string& theMessage )
: file( theFile ), line( theLine ), message( theMessage ) {
}
TestAssertionFailureException::TestAssertionFailureException(
- const std::string &theFile,
+ const std::string& theFile,
unsigned theLine,
- const std::string &theFailingExpression )
+ const std::string& theFailingExpression )
: _details( new TestAssertionFailureDetails( theFile, theLine, theFailingExpression ) ) {
}
@@ -257,7 +257,7 @@ namespace mongo {
return os.str();
}
- TestAssertion::TestAssertion( const std::string &file, unsigned line )
+ TestAssertion::TestAssertion( const std::string& file, unsigned line )
: _file( file ), _line( line ) {
++Result::cur->_asserts;
@@ -265,12 +265,12 @@ namespace mongo {
TestAssertion::~TestAssertion() {}
- void TestAssertion::fail( const std::string &message ) const {
+ void TestAssertion::fail( const std::string& message ) const {
throw TestAssertionFailureException( _file, _line, message );
}
- ComparisonAssertion::ComparisonAssertion( const std::string &aexp, const std::string &bexp,
- const std::string &file, unsigned line )
+ ComparisonAssertion::ComparisonAssertion( const std::string& aexp, const std::string& bexp,
+ const std::string& file, unsigned line )
: TestAssertion( file, line ), _aexp( aexp ), _bexp( bexp ) {}
std::vector<std::string> getAllSuiteNames() {
diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h
index 68a0699c66a..bccda07ecc9 100644
--- a/src/mongo/unittest/unittest.h
+++ b/src/mongo/unittest/unittest.h
@@ -82,7 +82,7 @@
::mongo::unittest::TestAssertion _testAssertion( __FILE__, __LINE__ ); \
try { \
EXPRESSION; \
- } catch ( const EXCEPTION_TYPE & ) { threw = true; } \
+ } catch ( const EXCEPTION_TYPE& ) { threw = true; } \
if (!threw) \
_testAssertion.fail("Expected expression " #EXPRESSION \
" to throw " #EXCEPTION_TYPE " but it threw nothing."); \
@@ -198,7 +198,7 @@ namespace mongo {
*/
class Suite : private boost::noncopyable {
public:
- Suite( const string &name );
+ Suite( const string& name );
virtual ~Suite();
template<class T>
@@ -218,7 +218,7 @@ namespace mongo {
Result * run( const std::string& filter );
- static int run( const std::vector<std::string> &suites , const std::string& filter );
+ static int run( const std::vector<std::string>& suites , const std::string& filter );
/**
* Get a suite with the given name, creating it if necessary.
@@ -250,7 +250,7 @@ namespace mongo {
TestHolderList _tests;
bool _ran;
- void registerSuite( const std::string &name , Suite *s );
+ void registerSuite( const std::string& name , Suite* s );
};
/**
@@ -259,9 +259,9 @@ namespace mongo {
*/
class TestAssertionFailureDetails : private boost::noncopyable {
public:
- TestAssertionFailureDetails( const std::string &theFile,
+ TestAssertionFailureDetails( const std::string& theFile,
unsigned theLine,
- const std::string &theMessage );
+ const std::string& theMessage );
const std::string file;
const unsigned line;
@@ -279,13 +279,13 @@ namespace mongo {
*/
class TestAssertionFailureException {
public:
- TestAssertionFailureException( const std::string &theFile,
+ TestAssertionFailureException( const std::string& theFile,
unsigned theLine,
- const std::string &theMessage );
+ const std::string& theMessage );
- const std::string &getFile() const { return _details->file; }
+ const std::string& getFile() const { return _details->file; }
unsigned getLine() const { return _details->line; }
- const std::string &getMessage() const { return _details->message; }
+ const std::string& getMessage() const { return _details->message; }
std::string toString() const;
@@ -299,14 +299,14 @@ namespace mongo {
class TestAssertion : private boost::noncopyable {
public:
- TestAssertion( const std::string &file, unsigned line );
+ TestAssertion( const std::string& file, unsigned line );
~TestAssertion();
- void fail( const std::string &message) const;
+ void fail( const std::string& message) const;
void failIf( bool flag, const std::string &message ) const {
if ( flag ) fail( message );
}
- void failUnless( bool flag, const std::string &message ) const {
+ void failUnless( bool flag, const std::string& message ) const {
failIf( !flag, message );
}
@@ -320,43 +320,43 @@ namespace mongo {
*/
class ComparisonAssertion : private TestAssertion {
public:
- ComparisonAssertion( const std::string &aexp , const std::string &bexp ,
- const std::string &file , unsigned line );
+ ComparisonAssertion( const std::string& aexp , const std::string& bexp ,
+ const std::string& file , unsigned line );
template<typename A,typename B>
- void assertEqual( const A &a , const B &b ) {
+ void assertEqual( const A& a , const B& b ) {
failUnless(a == b, getComparisonFailureMessage("==", a, b));
}
template<typename A,typename B>
- void assertNotEqual( const A &a , const B &b ) {
+ void assertNotEqual( const A& a , const B& b ) {
failUnless(a != b, getComparisonFailureMessage("!=", a, b));
}
template<typename A,typename B>
- void assertLessThan( const A &a , const B &b ) {
+ void assertLessThan( const A& a , const B& b ) {
failUnless(a < b, getComparisonFailureMessage("<", a, b));
}
template<typename A,typename B>
- void assertNotLessThan( const A &a , const B &b ) {
+ void assertNotLessThan( const A& a , const B& b ) {
failUnless(a >= b, getComparisonFailureMessage(">=", a, b));
}
template<typename A,typename B>
- void assertGreaterThan( const A &a , const B &b ) {
+ void assertGreaterThan( const A& a , const B& b ) {
failUnless(a > b, getComparisonFailureMessage(">", a, b));
}
template<typename A,typename B>
- void assertNotGreaterThan( const A &a , const B &b ) {
+ void assertNotGreaterThan( const A& a , const B& b ) {
failUnless(a <= b, getComparisonFailureMessage("<=", a, b));
}
private:
template< typename A, typename B>
std::string getComparisonFailureMessage(const std::string &theOperator,
- const A &a, const B &b);
+ const A& a, const B& b);
std::string _aexp;
std::string _bexp;
@@ -366,7 +366,7 @@ namespace mongo {
* Hack to support the runaway test observer in dbtests. This is a hook that
* unit test running harnesses (unittest_main and dbtests) must implement.
*/
- void onCurrentTestNameChange( const std::string &testName );
+ void onCurrentTestNameChange( const std::string& testName );
/**
* Return a list of suite names.