Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit Testing Frameworks for C: Comparison

Tags:

c

tdd

I am a ruby programmer and I really like to do TDD. Right now, I am programming a little bit in C, but I like my tools and the way I program with ruby. So, I am searching for a framework to do unit tests in C. What do you can tell me about it?

I already found some options, like: cunit, cmockery, CuTest and others. The problem is, I don't know how to evaluate the best one. I am writing a simple compiler for my compilers college course.

Could you help me?

like image 398
Hugo Barauna Avatar asked Sep 23 '09 19:09

Hugo Barauna


1 Answers

You can use any C or C++ unit testing framework. Its easy enough to call C functions from C++.

My opinion is that you want to have as little output as possible from your tests. ie if everything is OK, it should print '100% passed'. Otherwise it should only print out details of test failures.

see xprogramming.com (original link broken; here it is on the way back machine), scroll down to the Unit Testing table and look for the C Language or C++ frameworks. The most 'standard' it seems is cppUnit.

like image 175
quamrana Avatar answered Oct 12 '22 20:10

quamrana