MinUnit – A minimal unit testing framework for C (2002)
21–30 of 56 posts
Re: MinUnit – A minimal unit testing framework for C (2002)
#22Why not just 1 line? Of course, the application will halt after one test fails, but some people like it this way. #include 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.
I'm also tempted to say that if you need to use GDB to figure out where your tests have failed exactly your framework is not particularly user friendly. Normally when a test fails it should be pretty clear where it failed and why. The root cause of the issue might be further away of course but then again assertions won't help with that either.
Re: MinUnit – A minimal unit testing framework for C (2002)
#23Re: MinUnit – A minimal unit testing framework for C (2002)
#24Earlier quoted context omitted.
Really? Is it perhaps because of those libraries that do their best to make test call sites look like weird pseudo-English. Stuff like having a library function named it(): it(“should be confusing”, function() { ... })
It always really bothered me that there had to be so much syntactical sugar on top of testing frameworks. Unit testing should be written in exactly the syntax of the language you are working with. I don't want to have to carry that additional crap in my working memory while writing code. I can't stand having to look up Gherkin syntax just to write a few dumb tests. The only reason I see the usefulness of additional s…
YMMV, the BDD implementations I've seen so far did not convince me of its value to put it mildly.
Re: MinUnit – A minimal unit testing framework for C (2002)
#25I have a library [link redacted] that was originally designed to extend MinUnit. I love the idea of an all-in-one unit testing library without complicated set up.
I obviously vouched for the comment, but yeesh.
Re: MinUnit – A minimal unit testing framework for C (2002)
#26So, the revelation is that a unit test is an if statement, and if you wrap that into a macro you can call it a framework.
It’s sample data, verification, analysis, and reporting. The if statement is just the verification step.
Re: MinUnit – A minimal unit testing framework for C (2002)
#27Whats up with the do/while loops? Does that just make the return syntactically valid? Apologies, its been a while since I've touched C/C++
Re: MinUnit – A minimal unit testing framework for C (2002)
#28--
[0] http://www.throwtheswitch.org/unity/
[1] https://gitlab.com/oliver117/blut/blob/master/test/test_math...