Skip to content

Improve assertions in tests #29

@Marcono1234

Description

@Marcono1234

Problem solved by the enhancement

Currently the tests use the standard assert macros, e.g. assert_eq. This make it difficult to see the difference in longer strings and their use of the terms 'left' and 'right' can be confusing when it is not immediately clear which is the 'expected' and which the 'actual' value1.

Additionally the handcrafted assertion helper functions and macros can produce confusing or verbose backtraces.

Enhancement description

Use a more powerful assertion library, see for example:

Blog posts:

But check their maintenance status and how widely they are used.

Also try to clean up and improve the helper assertion functions and macros used in the tests of this project.

Alternatives / workarounds

Just try to clean up and improve the assertion code and make sure that the 'left' and 'right' arguments consistently have the same meaning (either 'expected' or 'actual').

Footnotes

  1. Currently the code tries to have the 'expected' first and then the 'actual' (i.e. 'left=expected', 'right=actual'), but it might not be consistent. And in case of test failures this meaning is not obvious from the failure message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestinternalIssue or pull request which is internal and has no user-visible effect

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions