Skip to content

Commit

Permalink
src: add ASSERT_EQ style macros
Browse files Browse the repository at this point in the history
Add ASSERT counterparts to the CHECK_EQ/CHECK_NE/etc. family of macros.

PR-URL: #529
Reviewed-By: Trevor Norris <[email protected]>
  • Loading branch information
bnoordhuis committed Jan 20, 2015
1 parent ee9cd00 commit e95cfe1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ class ECDH : public BaseObject {
key_(key),
group_(EC_KEY_get0_group(key_)) {
MakeWeak<ECDH>(this);
ASSERT(group_ != nullptr);
ASSERT_NE(group_, nullptr);
}

static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
Expand Down
7 changes: 7 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ namespace node {
# define CHECK(expression) assert(expression)
#endif

#define ASSERT_EQ(a, b) ASSERT((a) == (b))
#define ASSERT_GE(a, b) ASSERT((a) >= (b))
#define ASSERT_GT(a, b) ASSERT((a) > (b))
#define ASSERT_LE(a, b) ASSERT((a) <= (b))
#define ASSERT_LT(a, b) ASSERT((a) < (b))
#define ASSERT_NE(a, b) ASSERT((a) != (b))

#define CHECK_EQ(a, b) CHECK((a) == (b))
#define CHECK_GE(a, b) CHECK((a) >= (b))
#define CHECK_GT(a, b) CHECK((a) > (b))
Expand Down

0 comments on commit e95cfe1

Please sign in to comment.