Skip to content

Commit

Permalink
[v1.2.1] Merge branch 'bleeding'
Browse files Browse the repository at this point in the history
Changelog:

* Added a cr_ prefix to all assertion macros. Old macros are deprecated
  and will be removed in a future version.
  • Loading branch information
Snaipe committed Apr 26, 2015
2 parents 6b71e1c + 0f25296 commit 4a04a8a
Show file tree
Hide file tree
Showing 18 changed files with 274 additions and 185 deletions.
10 changes: 10 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bumpversion]
current_version = 1.2.1
commit = True

[bumpversion:file:configure.ac]

[bumpversion:file:doc/conf.py]

[bumpversion:file:appveyor.yml]

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
!*/

!.gitignore
!.bumpversion.cfg

!*.c
!*.h
Expand Down
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2015-04-26 Franklin "Snaipe" Mathieu <[email protected]>

* criterion: version 1.2.1
* Added a cr_ prefix to all assertion macros. Old macros are deprecated
and will be removed in a future version.

2015-04-15 Franklin "Snaipe" Mathieu <[email protected]>

* criterion: version 1.2.0
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.0.0_b{build}-{branch}
version: 1.2.1_b{build}-{branch}

os: Windows Server 2012

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ([2.60])

AC_INIT([criterion], [1.2.0], [], [criterion], [[email protected]])
AC_INIT([criterion], [1.2.1], [], [criterion], [[email protected]])
AC_CONFIG_SRCDIR([src/runner.c])

LT_PREREQ([2.2.4])
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# built documents.
#
# The short X.Y version.
version = '1.2.0'
version = '1.2.1'
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
54 changes: 27 additions & 27 deletions doc/starter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Asserting things

Assertions come in two kinds:

* ``assert*`` are assertions that are fatal to the current test if failed;
* ``cr_assert*`` are assertions that are fatal to the current test if failed;
in other words, if the condition evaluates to ``false``, the test is
marked as a failure and the execution of the function is aborted.
* ``expect*`` are, in the other hand, assertions that are not fatal to the
* ``cr_expect*`` are, in the other hand, assertions that are not fatal to the
test. Execution will continue even if the condition evaluates to
``false``, but the test will be marked as a failure.

``assert()`` and ``expect()`` are the most simple kinds of assertions
``cr_assert()`` and ``cr_expect()`` are the most simple kinds of assertions
criterion has to offer. They both take a mandatory condition as a first
parameter, and an optional failure message:

Expand All @@ -43,45 +43,45 @@ parameter, and an optional failure message:
#include <criterion/criterion.h>
Test(sample, test) {
expect(strlen("Test") == 4, "Expected \"Test\" to have a length of 4.");
expect(strlen("Hello") == 4, "This will always fail, why did I add this?");
assert(strlen("") == 0);
cr_expect(strlen("Test") == 4, "Expected \"Test\" to have a length of 4.");
cr_expect(strlen("Hello") == 4, "This will always fail, why did I add this?");
cr_assert(strlen("") == 0);
}
On top of those, more assertions are available for common operations:

* ``assert_null(Ptr, [Message])``: passes if Ptr is NULL.
* ``assert_eq(Actual, Expected, [Message])``: passes if Actual == Expected.
* ``assert_lt(Actual, Expected, [Message])``: passes if Actual < Expected.
* ``assert_leq(Actual, Expected, [Message])``: passes if Actual <= Expected.
* ``assert_gt(Actual, Expected, [Message])``: passes if Actual > Expected.
* ``assert_geq(Actual, Expected, [Message])``: passes if Actual >= Expected.
* ``assert_float_eq(Actual, Expected, Epsilon, [Message])``:
* ``cr_assert_null(Ptr, [Message])``: passes if Ptr is NULL.
* ``cr_assert_eq(Actual, Expected, [Message])``: passes if Actual == Expected.
* ``cr_assert_lt(Actual, Expected, [Message])``: passes if Actual < Expected.
* ``cr_assert_leq(Actual, Expected, [Message])``: passes if Actual <= Expected.
* ``cr_assert_gt(Actual, Expected, [Message])``: passes if Actual > Expected.
* ``cr_assert_geq(Actual, Expected, [Message])``: passes if Actual >= Expected.
* ``cr_assert_float_eq(Actual, Expected, Epsilon, [Message])``:
passes if Actual == Expected with an error of Epsilon.
* ``assert_arrays_eq(Actual, Expected, Size, [Message])``:
* ``cr_assert_arrays_eq(Actual, Expected, Size, [Message])``:
passes if all elements of Actual (from 0 to Size - 1) are equals to those
of Expected.
* ``assert_arrays_eq_cmp(Actual, Expected, Size, Cmp, [Message])``:
* ``cr_assert_arrays_eq_cmp(Actual, Expected, Size, Cmp, [Message])``:
Same as ``arrays_eq`` but equality is defined by the result of the binary
Cmp function.

Equality and lexical comparison assertions are also available for strings:

* ``assert_strings_eq(Actual, Expected, [Message])``
* ``assert_strings_lt(Actual, Expected, [Message])``
* ``assert_strings_leq(Actual, Expected, [Message])``
* ``assert_strings_gt(Actual, Expected, [Message])``
* ``assert_strings_geq(Actual, Expected, [Message])``
* ``cr_assert_strings_eq(Actual, Expected, [Message])``
* ``cr_assert_strings_lt(Actual, Expected, [Message])``
* ``cr_assert_strings_leq(Actual, Expected, [Message])``
* ``cr_assert_strings_gt(Actual, Expected, [Message])``
* ``cr_assert_strings_geq(Actual, Expected, [Message])``

And some assertions have a logical negative counterpart:

* ``assert_not(Condition, [Message])``
* ``assert_not_null(Ptr, [Message])``
* ``assert_neq(Actual, Unexpected, [Message])``
* ``assert_float_neq(Actual, Unexpected, Epsilon, [Message])``
* ``assert_strings_neq(Actual, Unexpected, [Message])``
* ``assert_arrays_neq(Actual, Unexpected, Size, [Message])``
* ``assert_arrays_neq_cmp(Actual, Unexpected, Size, Cmp, [Message])``
* ``cr_assert_not(Condition, [Message])``
* ``cr_assert_not_null(Ptr, [Message])``
* ``cr_assert_neq(Actual, Unexpected, [Message])``
* ``cr_assert_float_neq(Actual, Unexpected, Epsilon, [Message])``
* ``cr_assert_strings_neq(Actual, Unexpected, [Message])``
* ``cr_assert_arrays_neq(Actual, Unexpected, Size, [Message])``
* ``cr_assert_arrays_neq_cmp(Actual, Unexpected, Size, Cmp, [Message])``

Of course, every ``assert`` has an ``expect`` counterpart.

Expand Down
Loading

0 comments on commit 4a04a8a

Please sign in to comment.