CUnit: fail with dynamically generated string

259 Views Asked by At

Background

CUnit provides the CU_FAIL function, which allows one to indicate the failure of a test with a chosen message. Calling CU_FAIL("failure message") would fail the enclosing test, printing a string which includes CU_FAIL("failure message").

Problem

I would like to indicate offending parameters in my failure message. If I dynamically set a variable char * message to a desired message such as "Expected i = 5, but i = 6." and then call CU_FAIL(message), then the test fails, but only the string CU_FAIL(message) is printed. The contents of message are not printed.

Question

How can I have CUnit fail a test while printing the contents of a dynamically generated string? I am using version 2.1-3.

1

There are 1 best solutions below

0
DBadura On

Currently is not possible. The project moved to gitlab and the there is related issue.