[Assorted-commits] SF.net SVN: assorted:[1350] cpp-commons/trunk/src/commons/check.h
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-04-29 02:09:22
|
Revision: 1350 http://assorted.svn.sourceforge.net/assorted/?rev=1350&view=rev Author: yangzhang Date: 2009-04-29 02:09:13 +0000 (Wed, 29 Apr 2009) Log Message: ----------- added checkneq Modified Paths: -------------- cpp-commons/trunk/src/commons/check.h Modified: cpp-commons/trunk/src/commons/check.h =================================================================== --- cpp-commons/trunk/src/commons/check.h 2009-04-29 02:08:54 UTC (rev 1349) +++ cpp-commons/trunk/src/commons/check.h 2009-04-29 02:09:13 UTC (rev 1350) @@ -137,6 +137,16 @@ } template<typename T, typename U> inline void + _checkneq(T l, U r, const char *file, int line) + { + if (l == r) { + stringstream ss; + ss << "expecting " << l << " != " << r; + _check(false, file, line, "%s", ss.str().c_str()); + } + } + + template<typename T, typename U> inline void _checkeq(T l, U r, const char *file, int line) { if (l != r) { @@ -202,6 +212,12 @@ #define check0x(expr, msg...) _check0(expr, __FILE__, __LINE__, ## msg) /** + * Checks that the values are not equal. The exception will include both + * values, as formatted by ostream <<. + */ +#define checkneq(l, r, msg...) _checkneq(l, r, __FILE__, __LINE__, ## msg) + +/** * Checks that the values are equal. The exception will include both values, * as formatted by ostream <<. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |