You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* added additional asserts [int_not_eq, double_between] and updated tests to use
* add tests for all current minunit functions
* add > and < tests for ints and doubles
Copy file name to clipboardexpand all lines: .travis.yml
+1
Original file line number
Diff line number
Diff line change
@@ -92,6 +92,7 @@ script:
92
92
- ./dist/queue
93
93
- ./dist/stack
94
94
- ./dist/graph
95
+
- ./dist/minunit
95
96
- if [ $TRAVIS_OS_NAME == linux ]; then cppcheck --error-exitcode=1 --inline-suppr --enable=warning,performance,information,style --template='{file}:{line},{severity},{id},{message}' ./src/ ; fi
Copy file name to clipboardexpand all lines: README.md
+7
Original file line number
Diff line number
Diff line change
@@ -484,8 +484,15 @@ int main() {
484
484
* **mu_fail(message)**: Automatically fails the assertion and returns the provided message; useful for non-implemented features, etc.
485
485
* **mu_assert(test, message)**: Assert that the boolean expression `test` is true, otherwise fail and print the passed `message`.
486
486
* **mu_assert_int_eq(expected, result)**: Assert that the `expected` int is the same as the passed `result`.
487
+
* **mu_assert_int_not_eq(expected, result)**: Assert that the `result` does not equal `expected`; not this is useful for checking comparison functions, etc.
488
+
* **mu_assert_int_greater_than(val, result)**: Assert that `result` is greater than `val`.
489
+
* **mu_assert_int_less_than(val, result)**: Assert that `result` is less than `val`.
490
+
* **mu_assert_int_between(expected_lower, expected_upper, result)**: Assert that the `result` is between (inclusive) `expected_lower` and `expected_upper`; if upper and lower are reversed, then it is **not** between!
487
491
* **mu_assert_int_in(expected, array_length, result)**: Assert that the `result` is a member of the `expected` array; `array_length` is needed to know the number of elements in the array.
488
492
* **mu_assert_double_eq(expected, result)**: Assert that the double in `result` is the same as the `expected` double.
493
+
* **mu_assert_double_greater_than(val, result)**: Assert that `result` is greater than `val`.
494
+
* **mu_assert_double_less_than(val, result)**: Assert that `result` is less than `val`.
495
+
* **mu_assert_double_between(expected_lower, expected_upper, result)**: Assert that `result` is between (inclusive) `expected_lower` and `expected_upper`; if upper and lower are reversed, then it is **not** between!
489
496
* **mu_assert_string_eq(expected, result)**: Assert that the `result` string (char* or char[]) is the same as the `expected` string.
490
497
* **mu_assert_null(result)**: Assert that the passed `result` pointer is `NULL`.
491
498
* **mu_assert_not_null(result)**: Assert that the passed `result` pointer is not `NULL`.
snprintf(minunit_last_message, MINUNIT_MESSAGE_LEN, "%s failed:\n\t%s:%d: expected different results but both were %d", __func__, __FILE__, __LINE__, minunit_tmp_e);\
if (result < minunit_tmp_e || result > minunit_tmp_m) {\
242
+
snprintf(minunit_last_message, MINUNIT_MESSAGE_LEN, "%s failed:\n\t%s:%d: %d was not between (inclusive) %d and %d", __func__, __FILE__, __LINE__, minunit_tmp_e, minunit_tmp_r, minunit_tmp_m);\
if (result < minunit_tmp_e || result > minunit_tmp_m) {\
332
+
snprintf(minunit_last_message, MINUNIT_MESSAGE_LEN, "%s failed:\n\t%s:%d: %f was not between (inclusive) %f and %f", __func__, __FILE__, __LINE__, minunit_tmp_e, minunit_tmp_r, minunit_tmp_m);\
0 commit comments