Hacker Newsnew | comments | show | ask | jobs | submit login
MinUnit - a minimal unit testing framework for C (jera.com)
4 points by wfn 745 days ago | 1 comment



The essence is here - pasting the (whole) source code:

    /* file: minunit.h */
    #define mu_assert(message, test) do { if (!(test)) return message; } while (0)
    #define mu_run_test(test) do { char *message = test(); tests_run++; \
                                   if (message) return message; } while (0)
    extern int tests_run;
> Conclusion

> People think that writing a unit testing framework has to be complex. In fact, you can write one in just a few lines of code, as this tech note shows. Of course, if you have access to a full-featured testing framework like JUnit, by all means use it. But if you don't, you can still use a simple framework like MinUnit, or whip up your own in a few hours. There's no excuse for not unit testing.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: