Skip to content

Commit

Permalink
Adapt embunit for RIOT
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Lenders committed Apr 10, 2014
1 parent ca75e01 commit 0c6b5ba
Show file tree
Hide file tree
Showing 44 changed files with 337 additions and 2,229 deletions.
9 changes: 9 additions & 0 deletions Makefile
@@ -1,5 +1,14 @@
DIRS = $(RIOTCPU)/$(CPU) core drivers sys

ifneq (,$(filter embunit,$(USEMODULE)))
DIRS += tests/unittests/embunit/embUnit
endif

ifneq (,$(filter embunit_textui,$(USEMODULE)))
DIRS += tests/unittests/embunit/textui
endif


.PHONY: all clean doc

all:
Expand Down
12 changes: 6 additions & 6 deletions tests/unittests/embunit/embUnit/HelperMacro.h
Expand Up @@ -35,20 +35,20 @@
#ifndef __HELPERMACRO_H__
#define __HELPERMACRO_H__

#define EMB_UNIT_TESTCASE(ca,name,sup,tdw,run) \
static const TestCase ca = new_TestCase(name,sup,tdw,run)
#define EMB_UNIT_TESTCASE(ca,sup,tdw,run) \
static const TestCase ca = new_TestCase(#ca,sup,tdw,run)

#define EMB_UNIT_TESTSUITE(su,name,array) \
static const TestSuite su = new_TestSuite(name,(Test**)array,sizeof(array)/sizeof(array[0]))
#define EMB_UNIT_TESTSUITE(su,array) \
static const TestSuite su = new_TestSuite(#su,(Test**)array,sizeof(array)/sizeof(array[0]))

#define EMB_UNIT_TESTREFS(tests) \
static Test* const tests[] =

#define EMB_UNIT_ADD_TESTREF(testref) \
(Test*) testref

#define EMB_UNIT_TESTCALLER(caller,name,sup,tdw,fixtures) \
static const TestCaller caller = new_TestCaller(name,sup,tdw,sizeof(fixtures)/sizeof(fixtures[0]),(TestFixture*)fixtures)
#define EMB_UNIT_TESTCALLER(caller,sup,tdw,fixtures) \
static const TestCaller caller = new_TestCaller(#caller,sup,tdw,sizeof(fixtures)/sizeof(fixtures[0]),(TestFixture*)fixtures)

#define EMB_UNIT_TESTFIXTURES(fixtures) \
static const TestFixture fixtures[] =
Expand Down
5 changes: 5 additions & 0 deletions tests/unittests/embunit/embUnit/Makefile
@@ -0,0 +1,5 @@
MODULE = embunit

INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit

include $(RIOTBASE)/Makefile.base
6 changes: 1 addition & 5 deletions tests/unittests/embunit/embUnit/TestCaller.h
Expand Up @@ -43,11 +43,7 @@ struct __TestFixture {
void(*test)(void);
};

#define new_TestFixture(name,test)\
{\
name,\
test,\
}
#define new_TestFixture(test) { #test, test }

typedef struct __TestCaller TestCaller;
typedef struct __TestCaller* TestCallerRef;/*downward compatible*/
Expand Down
1 change: 1 addition & 0 deletions tests/unittests/embunit/embUnit/TestCase.c
Expand Up @@ -67,6 +67,7 @@ void TestCase_run(TestCase* self,TestResult* result)

int TestCase_countTestCases(TestCase* self)
{
(void)self;
return 1;
}

Expand Down
5 changes: 5 additions & 0 deletions tests/unittests/embunit/embUnit/TestRunner.c
Expand Up @@ -44,15 +44,20 @@ static Test* root_;

static void TestRunner_startTest(TestListner* self,Test* test)
{
(void)self;
(void)test;
stdimpl_print(".");
}

static void TestRunner_endTest(TestListner* self,Test* test)
{
(void)self;
(void)test;
}

static void TestRunner_addFailure(TestListner* self,Test* test,char* msg,int line,char* file)
{
(void)self;
stdimpl_print("\n");
stdimpl_print(Test_name(root_));
stdimpl_print(".");
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/embunit/embUnit/config.h
Expand Up @@ -40,7 +40,7 @@
extern void stdimpl_print(const char *string);
#else
#include<stdio.h>
#define stdimpl_print printf
#define stdimpl_print(s) printf("%s", s);
#endif

#define ASSERT_STRING_BUFFER_MAX 64
Expand Down
32 changes: 0 additions & 32 deletions tests/unittests/embunit/embUnit/makefile

This file was deleted.

20 changes: 0 additions & 20 deletions tests/unittests/embunit/makefile

This file was deleted.

132 changes: 0 additions & 132 deletions tests/unittests/embunit/readme.txt

This file was deleted.

13 changes: 0 additions & 13 deletions tests/unittests/embunit/samples/AllTests.c

This file was deleted.

50 changes: 0 additions & 50 deletions tests/unittests/embunit/samples/counter.c

This file was deleted.

21 changes: 0 additions & 21 deletions tests/unittests/embunit/samples/counter.h

This file was deleted.

0 comments on commit 0c6b5ba

Please sign in to comment.