5 ms·
Speck – A small unit testing framework for C
- desiderantes 11y agoSo you write it as Speck, but you pronounce it as bacon? Nice.
- gamegoblin 11y agoI suspect that that's a joke. The author is German and "Speck" is the German word for "bacon".
- davidw 11y agohttps://en.m.wikipedia.org/wiki/Tyrolean_Speck https://en.m.wikipedia.org/wiki/Tyrolean_Speck
- andrey-g 11y agoHave you heard the good word of Unity[0]? [0]: https://github.com/ThrowTheSwitch/Unity https://github.com/ThrowTheSwitch/Unity
- apfohl 11y agoYes, indeed. http://embedded.fm/episodes/103 http://embedded.fm/episodes/103
- crystalmeph 11y agoI use minunit, http://www.jera.com/techinfo/jtns/jtn002.html http://www.jera.com/techinfo/jtns/jtn002.html, in my embedded projects. The tricky part when unit testing embedded stuff is separating stuff that works on "pure data" from stuff that has a dependency on the hardware. For example, if a function uses a hardware sensor input to calculate a value, you either have to encapsulate that input into a function you can mock, or pass it as a parameter and avoid mocking altogether. The good news is that forces you to use a more well-separated design, eg with separate .c modules to read discrete and analog values, so it ends up being more maintainable.
- TickleSteve 11y agoThe way I tend to approach testing (I develop embedded s/w) is to use host-based unit testing on the majority of the code . Any h/w layers (read drivers) can only really be tested via system-level testing. It is more critical to have system-level testing on any real-time time-sensitive software; you can't really separate the behaviour of the s/w from the behaviour of the h/w. ...so, while nice to have another framework, most unit testing for embedded code can be performed on the host (i.e Linux or Windows).
- 78666cdc 11y agoWhat is the target user base?
- fijal 11y agoIt's maybe worth noting that we (pypy team) had a huge success testing C code just with cffi, writing tests in python. It gives you the ability to write C, but with all the flexibility of python for testing and some debugging (sometimes you obviously have to use gdb)
- DanWaterworth 11y agoWhen I was writing lots of C, I found that unit testing wasn't able to test for the things that I really wanted. Looking back, I think adding -fsanitize=undefined or similar to the compiler options for my test suite would have gotten me much closer to where I'd liked to have been.
- kasbah 11y agoI normally use Minunit which is 3 lines of source code. http://www.jera.com/techinfo/jtns/jtn002.html http://www.jera.com/techinfo/jtns/jtn002.html
- 2bluesc 11y agoI was looking for a small unit test framework for a micro controller (think Cortex-M0/3/4). I looked at Unity, minunit, and cmocka. All depend on dynamic allocation and that was a deal breaker. I gave up hunting and created nanotest[0] to target and encourage embedded unit testing. Nanotest runs on desktop dev machines, cloud CI, and minimal ARM environments. [0] http://github.com/kylemanna/nanotest http://github.com/kylemanna/nanotest