0

I am getting started with Test Driven Development for embedded C, and I started to read the book: 'Test-Driven development for embedded C', in which they recommend two development system test environments: Unity and CppUTest.

Thus, I decided to download the code of both and also, downloaded and installed Cygwin, in order to compile the stuff. However, once I download everything, I get really lost, since there is not good documentation of this kind:

" 1- First go to XXX. 2- Run XXX. 3- Copy XXX file into XXX folder. 4- And voila, all set"

The only thing I find when I download CppUTest and Unity is a ton of folders with makefiles and stuff and some READMEs that for me are like written in Chinese. The furthest I got was to compile the CppUTest and run its tests, and that is it.

So, here is my question. Imagine that I already have my Module.c, Module.h and ModuleTest.cpp. What do I have to do to compile it and run the test?

I wonder if you have experience with this tools and can give me some tips and advices.

Thank you and best regards.

Jorge S
  • 81
  • 1
  • 9
  • `http://cpputest.github.io/manual.html` seems clear to me. But I miss why you think `embedded C` and `cygwin` should be related. – matzeri Jul 14 '16 at 11:54
  • Well I need Cygwin to follow the examples in the book. I didn't go much further in the book, but I guess that you can 'simulate' hardware in some way (for example, if you have to write to an array of leds, you just need the address where they are located, but the program doesn't actually care if this address is actually connected to hardware or not, so you could just have virtual leds). Also, I followed that tutorial, but didn't get anything. So, lets assume I have my module.c, module.h and test_module.c, what do I have to do to run the test? – Jorge S Jul 14 '16 at 14:46

1 Answers1

0

Please in the future follow the rule: one problem and one specific question. Vague question will hardly receive good answer.

Considering cpputest, this work:

$ tar -xf cpputest-3.8.tar.gz
$ cd cpputest-3.8
$ ./configure
$ make 
$ make check

That is also basically what is written in README.md

matzeri
  • 8,062
  • 2
  • 15
  • 16
  • Hello Matzeri, you are right and I modified the title and the text body to make my question more clear. I hope it is more understandable now. Regarding your answer, I already managed to do that (compiling CppUTest), but my problem is how to run the first test of one of my modules. As i just edited in my question, lets assume I have my module.c, module.h and ModuleTest.cpp, what do I have to do to run the test? – Jorge S Jul 14 '16 at 20:13
  • I agree that cpputest documentations sucks. Try https://www.odd-e.com/material/2009/JAOO_TDD_C_Tutorial/TDD_in_C_JAOO_tutorial.pdf – matzeri Jul 14 '16 at 21:06