Comment

Comment by vortico

Why not just 1 line? Of course, the application will halt after one test fails, but some people like it this way.

    #include <assert.h>
Usage:

    void test_foo() {
        assert(foo() == 4 /* foo should be 4 */);
    }
Output would be something like

    Assertion failed at "foo() == 4 /* foo should be 4 */"
If you run the application in a debugger like GDB, you can see the frame when the abort trap is called.
parent vortico 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton