3

I'm developing a fairly simple C project for an embedded device. I'd like to employ xUnit testing. I've settled down with the Check framework (http://check.sourceforge.net/), but it seems it doesn't support function stubs. I remember using a very syntactically similar framework a few years ago that supported stubs, but i can't remember its name.

So, can anyone suggest an xUnit framework for C that supports stubs? A way to imitate stubs while using Check library would be OK, too.

sth
  • 222,467
  • 53
  • 283
  • 367
Roman Dmitrienko
  • 3,375
  • 3
  • 37
  • 48
  • Could you explain more precisely what do you mean by function stubs? – Péter Török Mar 01 '10 at 10:50
  • 1
    I want to be able to substitute certain function calls with my own ones. E.g., let's consider a case when i need to take a look at my program's behaviour when file() returns NULL. So, i want to be able to implement a file_fail() stub and then tell the framework to replace all file() calls with file_fail() ones. – Roman Dmitrienko Mar 02 '10 at 12:40

1 Answers1

2

Cgreen supports mock functions, is this what you want?

https://cgreen-devs.github.io/#_what_are_mock_functions

Mike Pelley
  • 2,939
  • 22
  • 23
Masse
  • 4,334
  • 3
  • 30
  • 41