I am a professional web developer and therefore I'm used to using very high-level scripting languages and testing tools. I've recently been working, personally, more with C and writing many C programs for unix-based systems to do various tasks.
However, I still haven't gotten into a good groove for unit testing this code and I was wondering what tools C programmers use to create automated tests to verify code.
-
Are you testing strictly C code, or can you mix in some C++? If C++ is OK, cppunit is probably worth checking out. If you are testing a library, you can simply link you library into your unit test application. If you are testing an app, you will probably have to create a library, and then link it into both your app and the unit test app.
-
I had this question once and discovered CUnit. I only used it for a small project, but it seemed alright. Not nearly as convenient as JUnit or NUnit that I am used to though! For C++ projects I use cppunit which works quite well.
-
CUtest. It's really neat. Small, doesn't rely on a generator language, fast... what's not to like?
-
See also this question: http://stackoverflow.com/questions/65820/unit-testing-c-code.
Mitchell : This was the kind of question I was looking for but the search wasn't really finding it. Thanks! -
If you only want a quick'n'dirty test mechanism, have a look at the
assertmacro, part of ANSI C.
0 comments:
Post a Comment