Asserts available and needed #2
miguelafsilva5
started this conversation in
General
Replies: 1 comment
-
@bao-project/project tagging for testing and visibility purposes |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
I've implemented the following asserts to be used in unit testing:
EXPECTED_EQUAL(x, y) -> Assert that 2 values are equal
EXPECTED_NOT_EQUAL(x, y) -> Assert that 2 values are different
EXPECTED_TRUE(x) -> Assert that the expression x is true (i.e. != 0)
EXPECTED_FALSE(x) -> Assert that the expression x is true (i.e. == 0)
EXPECTED_PTR_NULL(x) -> Assert that the pointer x is NULL
EXPECTED_PTR_NOT_NULL(x) -> Assert that the pointer x is NOT NULL
EXPECTED_ARRAY_EQUAL(ptr1, ptr2, count, type) -> Asserts that elements of both arrays with the same index are all equal
EXPECTED_ARRAY_EQUAL(ptr1, ptr2, count, type) -> Asserts that at least an element of one the arrays is different from the other array
I've opted to implement a both TRUE and FALSE asserts to encompass expressions like x>y, instead of creating a dedicated assert for each operator. I would like to know if that's ok for you, or would you rather have multiple asserts (for legibility purposes, for example)
Also, I would like to know if you need or envision needing other kinds of asserts. And if so, kindly mention them so they can be added in a near future.
Best regards,
Miguel Silva
Tagging @josecm for visibility.
Beta Was this translation helpful? Give feedback.
All reactions