--
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this group and stop receiving emails from it, send an email to throwtheswitc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/throwtheswitch/f505d996-b998-4f61-b596-a7ccfdce1bbco%40googlegroups.com.
#include "mock_FreeRTOS.h"
#include "mock_task.h"
#include "mock_queue.h"
#include "mock_semphr.h"Test 'test_apps.c'
------------------
Generating include list for board.h...
Generating include list for FreeRTOS.h...
Generating include list for task.h...
./test/build/temp/_task.h:71:3: error: #error "include FreeRTOS.h must appear in source files before include task.h"
#error "include FreeRTOS.h must appear in source files before include task.h"
:defines:
:test_preprocess:
- INC_FREERTOS_H
Each test file becomes its own executable in Ceedling. It knows what needs to be built and linked together by looking at your #includes in that test.So, if you have a single function AddTwoNumbers and it's in math.c, then test_math.c will have your tests for it. That file might look something like this:#include "unity.h"#include "math.c"void setUp(void) {}void tearDown(void) {}void test_AddTwoNumbers_SHOULD_AddTwoNumbersTogether(void){TEST_ASSERT_EQUAL_INT( 15, AddTwoNumbers(7, 8) );}That becomes a single executable and doesn't need anything else in your system to work.Another unit test might make calls to functions in other files. That's where mocks come in. Again, it's going to build just the unit under test, the test itself, and a MOCK version of the dependencies, to avoid pulling in your entire system. That's a much bigger topic for another day. :)I hope that helps.Mark
On Tue, Jun 16, 2020 at 10:30 AM <rouxfe...@gmail.com> wrote:
--Hi,I'm also relatively new to ceedling. I've doing some testing with example projects, but now I'm trying to apply testing to an existing LPC1769 project. And as I can't get it working, a basic question raised: if I need to test only one function, for example, AddTwoNumbers(int a, int b) in math.c, ceedling needs to compile the entire project? or only needs to compile that file?thanks a lot!
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this group and stop receiving emails from it, send an email to throwth...@googlegroups.com.