Skip to content

Commit e95cfe1

Browse files
committed
src: add ASSERT_EQ style macros
Add ASSERT counterparts to the CHECK_EQ/CHECK_NE/etc. family of macros. PR-URL: #529 Reviewed-By: Trevor Norris <[email protected]>
1 parent ee9cd00 commit e95cfe1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/node_crypto.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ class ECDH : public BaseObject {
639639
key_(key),
640640
group_(EC_KEY_get0_group(key_)) {
641641
MakeWeak<ECDH>(this);
642-
ASSERT(group_ != nullptr);
642+
ASSERT_NE(group_, nullptr);
643643
}
644644

645645
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);

src/util.h

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ namespace node {
2929
# define CHECK(expression) assert(expression)
3030
#endif
3131

32+
#define ASSERT_EQ(a, b) ASSERT((a) == (b))
33+
#define ASSERT_GE(a, b) ASSERT((a) >= (b))
34+
#define ASSERT_GT(a, b) ASSERT((a) > (b))
35+
#define ASSERT_LE(a, b) ASSERT((a) <= (b))
36+
#define ASSERT_LT(a, b) ASSERT((a) < (b))
37+
#define ASSERT_NE(a, b) ASSERT((a) != (b))
38+
3239
#define CHECK_EQ(a, b) CHECK((a) == (b))
3340
#define CHECK_GE(a, b) CHECK((a) >= (b))
3441
#define CHECK_GT(a, b) CHECK((a) > (b))

0 commit comments

Comments
 (0)