mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
use templated assert
This commit is contained in:
parent
a54742b3de
commit
23936952c1
@ -324,30 +324,8 @@ namespace mongo {
|
||||
log() << _file << ":" << _line << " " << _aexp << " != " << _bexp << " ";
|
||||
}
|
||||
|
||||
void MyAsserts::ae( double a , double b ){
|
||||
void MyAsserts::_gotAssert(){
|
||||
Result::cur->_asserts++;
|
||||
if ( a == b )
|
||||
return;
|
||||
|
||||
printLocation();
|
||||
|
||||
MyAssertionException * e = getBase();
|
||||
e->ss << a << " != " << b << endl;
|
||||
log() << e->ss.str() << endl;
|
||||
throw e;
|
||||
}
|
||||
|
||||
void MyAsserts::ae( string a , string b ){
|
||||
Result::cur->_asserts++;
|
||||
if ( a == b )
|
||||
return;
|
||||
|
||||
printLocation();
|
||||
|
||||
MyAssertionException * e = getBase();
|
||||
e->ss << a << " != " << b << endl;
|
||||
log() << e->ss.str() << endl;
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -151,14 +151,27 @@ namespace mongo {
|
||||
: _aexp( aexp ) , _bexp( bexp ) , _file( file ) , _line( line ){
|
||||
|
||||
}
|
||||
|
||||
void ae( double a , double b );
|
||||
void ae( string a , string b );
|
||||
|
||||
template<typename A,typename B>
|
||||
void ae( A a , B b ){
|
||||
_gotAssert();
|
||||
if ( a == b )
|
||||
return;
|
||||
|
||||
printLocation();
|
||||
|
||||
MyAssertionException * e = getBase();
|
||||
e->ss << a << " != " << b << endl;
|
||||
log() << e->ss.str() << endl;
|
||||
throw e;
|
||||
}
|
||||
|
||||
void printLocation();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void _gotAssert();
|
||||
|
||||
MyAssertionException * getBase();
|
||||
|
||||
string _aexp;
|
||||
|
Loading…
Reference in New Issue
Block a user