
44 changed files with 337 additions and 2229 deletions
@ -0,0 +1,5 @@
|
||||
MODULE = embunit
|
||||
|
||||
INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit
|
||||
|
||||
include $(RIOTBASE)/Makefile.base |
@ -1,32 +0,0 @@
|
||||
CC = gcc
|
||||
CFLAGS = -O
|
||||
AR = ar
|
||||
ARFLAGS = ru
|
||||
RANLIB = ranlib
|
||||
RM = rm
|
||||
OUTPUT = ../lib/
|
||||
TARGET = libembUnit.a
|
||||
OBJS = AssertImpl.o RepeatedTest.o stdImpl.o TestCaller.o TestCase.o TestResult.o TestRunner.o TestSuite.o
|
||||
|
||||
all: $(TARGET) |
||||
|
||||
$(TARGET): $(OBJS) |
||||
$(AR) $(ARFLAGS) $(OUTPUT)$@ $(OBJS)
|
||||
$(RANLIB) $(OUTPUT)$@
|
||||
|
||||
.c.o: |
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $<
|
||||
|
||||
AssertImpl.o: AssertImpl.h stdImpl.h |
||||
RepeatedTest.o: RepeatedTest.h Test.h |
||||
stdImpl.o: stdImpl.h |
||||
TestCaller.o: TestCaller.h TestResult.h TestListener.h TestCase.h Test.h |
||||
TestCase.o: TestCase.h TestResult.h TestListener.h Test.h |
||||
TestResult.o: TestResult.h TestListener.h Test.h |
||||
TestRunner.o: TestRunner.h TestResult.h TestListener.h Test.h stdImpl.h config.h |
||||
TestSuite.o: TestSuite.h TestResult.h TestListener.h Test.h |
||||
|
||||
clean: |
||||
-$(RM) $(OBJS) $(TARGET)
|
||||
|
||||
.PHONY: clean all |
@ -1,20 +0,0 @@
|
||||
all: |
||||
-@mkdir lib
|
||||
-@cd ./embUnit ;$(MAKE)
|
||||
-@cd ./tests ;$(MAKE)
|
||||
-@cd ./samples ;$(MAKE)
|
||||
-@cd ./tools ;$(MAKE)
|
||||
|
||||
test: |
||||
-@./tests/embUnitTest
|
||||
|
||||
samples: |
||||
-@./samples/samples
|
||||
|
||||
clean: |
||||
-@cd ./embUnit ;$(MAKE) clean
|
||||
-@cd ./tests ;$(MAKE) clean
|
||||
-@cd ./samples ;$(MAKE) clean
|
||||
-@cd ./tools ;$(MAKE) clean
|
||||
|
||||
.PHONY: clean samples test all |
@ -1,132 +0,0 @@
|
||||
|
||||
|
||||
== Embedded Unit == |
||||
https://sourceforge.jp/projects/embunit/ |
||||
|
||||
------------------------------------------------------------------------------ |
||||
|
||||
Embedded UnitใฏC่จ่ชใไฝฟใฃใ็ตใฟ่พผใฟ็ณป้็บๅใใฎใในใใฆใใใใใฌใผใ ใฏใผใฏใง |
||||
ใใCๆจๆบใฉใคใใฉใชใไฝฟใใชใใฎใงๅฎ่ก่ณๆบใฎๅฐใชใใฟใผใฒใใ็ฐๅขใงๅไฝๅฏ่ฝใงใใ |
||||
ใพใใmalloc้ขๆฐใไฝฟ็จใใฆใใพใใใใในใฆใฎใชใใธใงใฏใใฏROM้ ๅใซ็ขบไฟใใใพ |
||||
ใใ |
||||
|
||||
------------------------------------------------------------------------------ |
||||
|
||||
1.ใใฃใฌใฏใใชใปใใกใคใซๆงๆ |
||||
[embUnit] |
||||
+- COPYING : ใฉใคใปใณใน |
||||
+- makefile : ใกใคใฏใใกใคใซ |
||||
+- readme.txt : ใใฎใใกใคใซ |
||||
+- [embUnit] : Embedded Unit ใฉใคใใฉใชใฝใผใน |
||||
+- [msvc] : MSVC++6.0 Project |
||||
+- [samples] : Embedded Unit ใตใณใใซใฝใผใน |
||||
+- [tests] : Embedded Unit ใในใใฝใผใน |
||||
+- [tools] : ใในใใณใผใใฎ้ๅฝข็ๆใใผใซ |
||||
|
||||
|
||||
2.ใฟใผใฒใใใทในใใ ใจ้็บ็ฐๅข |
||||
|
||||
Embedded Unitใฎๅฎ่ก็ฐๅขใจใใฆๆฌกใฎใใฎใๆณๅฎใใฆใใ |
||||
|
||||
ใป2KBไปฅไธใฎROM้ ๅใ128bไปฅไธใฎในใฟใใฏ้ ๅใไฝฟ็จๅฏ่ฝใช็ฐๅข |
||||
ใปๆจๆบCใฉใคใใฉใชใไฝฟ็จใงใใชใใใใใใชใ็ฐๅข |
||||
|
||||
ใพใใ้็บ็ฐๅขใจใใฆๆฌกใฎใใฎใๆณๅฎใใฆใใ |
||||
|
||||
ใปCใณใณใใคใฉใไฝฟใใ็ฐๅข |
||||
|
||||
่ฃ่ถณ |
||||
|
||||
Embedded Unitใฎ้็บใฏๆฌกใฎ็ฐๅขใง่กใใใฆใใ |
||||
|
||||
ใปMicrosoft Windows XP Professional |
||||
ใปVC++.NET or cygwin 1.3.22 + gcc 3.2 |
||||
ใปMicrosoft Windows 98 |
||||
ใปVC++6.0 |
||||
ใปApple Computer MacOS X 10.1.5 |
||||
ใปProject Builder 1.1.1 (gcc 2.95.2) |
||||
|
||||
|
||||
3.ใณใณใใคใซ |
||||
3.1.UNIX็ณป(cygwin) |
||||
- ๅฟ
่ฆใซๅฟใใฆembUnit/config.hใ็ทจ้,ไปฅไธใฎใณใใณใใๅฎ่ก. |
||||
|
||||
$ make |
||||
|
||||
- ใในใใใฌใผใ ่ช่บซใฎใในใใๅฎ่ก. |
||||
|
||||
$ make test |
||||
|
||||
- ใตใณใใซใๅฎ่ก. |
||||
|
||||
$ make samples |
||||
|
||||
3.2.MSVC++6.0 |
||||
- msvc/embUnit.dsw ใ้ใใฆๅใใญใธใงใฏใใใใซใใใฆใใ ใใ. |
||||
|
||||
3.3.MacOSX |
||||
- ๅฟ
่ฆใซๅฟใใฆembUnit/config.hใ็ทจ้,CCๅคๆฐใccใซ็ฝฎใๆใใณใใณใๅฎ่ก. |
||||
|
||||
$ make CC=cc |
||||
|
||||
|
||||
4.ใตใใผใใใๆฉ่ฝใฎๆฆ่ฆ |
||||
|
||||
ใปๆค่จผใใฏใญ |
||||
TEST_ASSERT_EQUAL_STRING๏ฝฅ๏ฝฅ๏ฝฅๆๅญๅใฎๆค่จผ |
||||
TEST_ASSERT_EQUAL_INT๏ฝฅ๏ฝฅ๏ฝฅintๅๅคๆฐใฎๆค่จผ |
||||
TEST_ASSERT_NULL๏ฝฅ๏ฝฅ๏ฝฅNULLใใคใณใฟใฎๆค่จผ |
||||
TEST_ASSERT_NOT_NULL๏ฝฅ๏ฝฅ๏ฝฅ้NULLใใคใณใฟใฎๆค่จผ |
||||
TEST_ASSERT_MESSAGE๏ฝฅ๏ฝฅ๏ฝฅๆค่จผใจใกใใปใผใธ |
||||
TEST_ASSERT๏ฝฅ๏ฝฅ๏ฝฅๆค่จผ |
||||
TEST_FAIL๏ฝฅ๏ฝฅ๏ฝฅๅคฑๆ |
||||
|
||||
ใปใใซใใผใใฏใญ |
||||
ใในใใ่จ่ฟฐใใใฎใซๅฟ
่ฆใชไฝๆฅญใใใซใใผใใฏใญใง็ฐก็ฅๅใใพใ๏ผ |
||||
|
||||
|
||||
5.ๅฐๆฅใตใใผใใใๆฉ่ฝใฎๆฆ่ฆ |
||||
|
||||
ใปCUITestRunner |
||||
ๅฏพ่ฉฑๅใฎTestRunnerใฎ้็บใไบๅฎใใฆใใพใ๏ผ |
||||
โปๆจๆบCใฉใคใใฉใชใไฝฟใใ็ฐๅขใๆณๅฎใใฆ้็บใ่กใใพใ๏ผ |
||||
ๅฏ่ฝใชใๆจๆบCใฉใคใใฉใชใไฝฟใใชใใใผใธใงใณใ้็บใใพใ๏ผ |
||||
|
||||
ใปGUITestRunner |
||||
GUIใๅฉ็จใใTestRunnerใงใ๏ผ |
||||
|
||||
ใปtextui |
||||
TextๅฝขๅผใXMLๅฝขๅผใCompilerๅฝขๅผใฎใในใ็ตๆใๅบๅใใTestRunnerใ้็บใ |
||||
ใพใ๏ผ |
||||
|
||||
|
||||
6.ๅถ้ไบ้
|
||||
|
||||
Embedded Unitใฏใในใ็ตๆใฎๅบๅใซๆจๆบใฉใคใใฉใชใฎprintf้ขๆฐใไฝฟ็จใใฆใใพ |
||||
ใ๏ผใใๆจๆบใฉใคใใฉใชใฎprintf้ขๆฐใไฝฟ็จใใใใชใๅ ดๅใฏใ |
||||
|
||||
void stdimpl_print(const char* string) |
||||
โปstdimpl_print้ขๆฐใฏๆๅญๅใฎ็ตใใใซๆน่กใๅบๅใใชใ้ขๆฐ |
||||
|
||||
ใจใใ้ขๆฐใๅฎ่ฃ
ใใใณใณใใคใซใชใใทใงใณใซ"-DNO_STDIO_PRINTF"ใ่ฟฝๅ ใใฆใ |
||||
ใ ใใ๏ผใใใใฏconfigใใใใฎไปฅไธใฎใณใกใณใใฏใใใฆใใ ใใ๏ผ |
||||
|
||||
/*#define NO_STDIO_PRINTF*/ |
||||
|
||||
|
||||
7.ใฉใคใปใณใน |
||||
|
||||
7.1.ใฉใคใปใณใน |
||||
Embedded Unitใฏ |
||||
MIT/X Consortium License |
||||
ใซๅพใใใฎใจใใพใ๏ผ |
||||
|
||||
7.2.ๆฅๆฌ่ช่จณ(ๅ่) |
||||
http://xjman.dsl.gr.jp/xf86_3/CPYRIGHT-2.html |
||||
|
||||
7.3.ใใพใใพใชใฉใคใปใณในใจใใใใซใคใใฆใฎ่งฃ่ชฌ |
||||
http://www.gnu.org/licenses/license-list.ja.html |
||||
|
||||
|
||||
------------------------------------------------------------------------------ |
||||
$Id: readme.txt,v 1.10 2003/09/16 11:41:48 arms22 Exp $ |
@ -1,13 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
|
||||
TestRef CounterTest_tests(void); |
||||
TestRef PersonTest_tests(void); |
||||
|
||||
int main (int argc, const char* argv[]) |
||||
{ |
||||
TestRunner_start(); |
||||
TestRunner_runTest(CounterTest_tests()); |
||||
TestRunner_runTest(PersonTest_tests()); |
||||
TestRunner_end(); |
||||
return 0; |
||||
} |
@ -1,50 +0,0 @@
|
||||
#include <stdlib.h> |
||||
#include "counter.h" |
||||
|
||||
CounterRef Counter_alloc(void) |
||||
{ |
||||
return (CounterRef)malloc(sizeof(Counter)); |
||||
} |
||||
|
||||
void Counter_dealloc(CounterRef self) |
||||
{ |
||||
free(self); |
||||
} |
||||
|
||||
CounterRef Counter_init(CounterRef self) |
||||
{ |
||||
self->value = 0; |
||||
return self; |
||||
} |
||||
|
||||
CounterRef Counter_counter(void) |
||||
{ |
||||
return Counter_init(Counter_alloc()); |
||||
} |
||||
|
||||
int Counter_value(CounterRef self) |
||||
{ |
||||
return self->value; |
||||
} |
||||
|
||||
void Counter_setValue(CounterRef self,int value) |
||||
{ |
||||
self->value = value; |
||||
} |
||||
|
||||
int Counter_inc(CounterRef self) |
||||
{ |
||||
self->value++; |
||||
return self->value; |
||||
} |
||||
|
||||
int Counter_dec(CounterRef self) |
||||
{ |
||||
self->value--; |
||||
return self->value; |
||||
} |
||||
|
||||
void Counter_clr(CounterRef self) |
||||
{ |
||||
self->value = 0; |
||||
} |
@ -1,21 +0,0 @@
|
||||
#ifndef __COUNTER_H__ |
||||
#define __COUNTER_H__ |
||||
|
||||
typedef struct __Counter Counter; |
||||
typedef struct __Counter* CounterRef; |
||||
|
||||
struct __Counter { |
||||
int value; |
||||
}; |
||||
|
||||
CounterRef Counter_alloc(void); |
||||
void Counter_dealloc(CounterRef); |
||||
CounterRef Counter_init(CounterRef); |
||||
CounterRef Counter_counter(void); |
||||
int Counter_value(CounterRef); |
||||
void Counter_setValue(CounterRef,int); |
||||
int Counter_inc(CounterRef); |
||||
int Counter_dec(CounterRef); |
||||
void Counter_clr(CounterRef); |
||||
|
||||
#endif/*__COUNTER_H__*/ |
@ -1,69 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
#include "counter.h" |
||||
|
||||
CounterRef counterRef; |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
counterRef = Counter_counter(); |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
Counter_dealloc(counterRef); |
||||
} |
||||
|
||||
static void testInit(void) |
||||
{ |
||||
TEST_ASSERT_EQUAL_INT(0, Counter_value(counterRef)); |
||||
} |
||||
|
||||
static void testSetValue(void) |
||||
{ |
||||
Counter_setValue(counterRef,1); |
||||
TEST_ASSERT_EQUAL_INT(1, Counter_value(counterRef)); |
||||
|
||||
Counter_setValue(counterRef,-1); |
||||
TEST_ASSERT_EQUAL_INT(-1, Counter_value(counterRef)); |
||||
} |
||||
|
||||
static void testInc(void) |
||||
{ |
||||
Counter_inc(counterRef); |
||||
TEST_ASSERT_EQUAL_INT(1, Counter_value(counterRef)); |
||||
|
||||
Counter_inc(counterRef); |
||||
TEST_ASSERT_EQUAL_INT(2, Counter_value(counterRef)); |
||||
} |
||||
|
||||
static void testDec(void) |
||||
{ |
||||
Counter_dec(counterRef); |
||||
TEST_ASSERT_EQUAL_INT(-1, Counter_value(counterRef)); |
||||
|
||||
Counter_dec(counterRef); |
||||
TEST_ASSERT_EQUAL_INT(-2, Counter_value(counterRef)); |
||||
} |
||||
|
||||
static void testClr(void) |
||||
{ |
||||
Counter_inc(counterRef); |
||||
TEST_ASSERT_EQUAL_INT(1, Counter_value(counterRef)); |
||||
|
||||
Counter_clr(counterRef); |
||||
TEST_ASSERT_EQUAL_INT(0, Counter_value(counterRef)); |
||||
} |
||||
|
||||
TestRef CounterTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("testInit",testInit), |
||||
new_TestFixture("testSetValue",testSetValue), |
||||
new_TestFixture("testInc",testInc), |
||||
new_TestFixture("testDec",testDec), |
||||
new_TestFixture("testClr",testClr), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(CounterTest,"CounterTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&CounterTest; |
||||
} |
@ -1,20 +0,0 @@
|
||||
CC = gcc
|
||||
CFLAGS = -O
|
||||
INCLUDES = ..
|
||||
LIBS = ../lib
|
||||
RM = rm
|
||||
TARGET = samples
|
||||
OBJS = AllTests.o counter.o counterTest.o person.o personTest.o
|
||||
|
||||
all: $(TARGET) |
||||
|
||||
$(TARGET): $(OBJS) |
||||
$(CC) -o $@ $(OBJS) -L$(LIBS) -lembUnit
|
||||
|
||||
.c.o: |
||||
$(CC) $(CFLAGS) -I$(INCLUDES) -c $<
|
||||
|
||||
clean: |
||||
-$(RM) $(TARGET) $(OBJS)
|
||||
|
||||
.PHONY: clean all |
@ -1,179 +0,0 @@
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include "person.h" |
||||
|
||||
PersonRef Person_alloc(void) |
||||
{ |
||||
return (PersonRef)malloc(sizeof(Person)); |
||||
} |
||||
|
||||
PersonRef Person_init(PersonRef self) |
||||
{ |
||||
return Person_initWithName(self, NULL); |
||||
} |
||||
|
||||
PersonRef Person_initWithName(PersonRef self,char *fullname) |
||||
{ |
||||
self->fullname = NULL; |
||||
self->firstname = NULL; |
||||
self->lastname = NULL; |
||||
Person_setFullName(self,fullname); |
||||
return self; |
||||
} |
||||
|
||||
PersonRef Person_personWithName(char *fullname) |
||||
{ |
||||
return Person_initWithName(Person_alloc(),fullname); |
||||
} |
||||
|
||||
void Person_dealloc(PersonRef self) |
||||
{ |
||||
if (self) { |
||||
free(self->fullname); |
||||
free(self->firstname); |
||||
free(self->lastname); |
||||
free(self); |
||||
} |
||||
} |
||||
|
||||
static void setfullname(PersonRef self,char *fullname) |
||||
{ |
||||
free(self->fullname); |
||||
self->fullname = NULL; |
||||
if (fullname) { |
||||
self->fullname = (char*)malloc(strlen(fullname)+1); |
||||
strcpy(self->fullname,fullname); |
||||
} |
||||
} |
||||
|
||||
static void setfirstname(PersonRef self,char *firstname) |
||||
{ |
||||
free(self->firstname); |
||||
self->firstname = NULL; |
||||
if (firstname) { |
||||
self->firstname = (char*)malloc(strlen(firstname)+1); |
||||
strcpy(self->firstname,firstname); |
||||
} |
||||
} |
||||
|
||||
static void setlastname(PersonRef self,char *lastname) |
||||
{ |
||||
free(self->lastname); |
||||
self->lastname = NULL; |
||||
if (lastname) { |
||||
self->lastname = (char*)malloc(strlen(lastname)+1); |
||||
strcpy(self->lastname,lastname); |
||||
} |
||||
} |
||||
|
||||
static void makefullname(PersonRef self) |
||||
{ |
||||
size_t fl,ll,fulllen,pos; |
||||
fl = ll = fulllen = pos = 0; |
||||
if (self->firstname) { |
||||
fl = strlen(self->firstname); |
||||
} |
||||
if (self->lastname) { |
||||
ll = strlen(self->lastname); |
||||
} |
||||
if (fl) { |
||||
fulllen = fl + 1; /* + space */ |
||||
} |
||||
if (ll) { |
||||
fulllen = fulllen + ll + 1; /* + null */ |
||||
} |
||||
if (fulllen) { |
||||
self->fullname = (char*)malloc(fulllen); |
||||
if (fl && ll) { |
||||
sprintf(self->fullname,"%s %s",self->firstname,self->lastname); |
||||
} else { |
||||
if (fl) { |
||||
strcpy(self->fullname,self->firstname); |
||||
} |
||||
if (ll) { |
||||
strcpy(self->fullname,self->lastname); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
static void makefirstname(PersonRef self) |
||||
{ |
||||
if (self->fullname) { |
||||
char *p; |
||||
int len; |
||||
p = strchr(self->fullname, ' '); |
||||
if (p) { |
||||
len = (int)(p - self->fullname); |
||||
p = (char*)malloc(len + 1); |
||||
strncpy(p,self->fullname,len); |
||||
p[len] = '\0'; |
||||
setfirstname(self,p); |
||||
free(p); |
||||
} else { |
||||
setfirstname(self,self->fullname); |
||||
} |
||||
} |
||||
} |
||||
|
||||
static void makelastname(PersonRef self) |
||||
{ |
||||
if (self->fullname) { |
||||
char *p = strchr(self->fullname, ' '); |
||||
if (p) { |
||||
setlastname(self,p+1); |
||||
} else { |
||||
setlastname(self,""); |
||||
} |
||||
} |
||||
} |
||||
|
||||
char* Person_fullName(PersonRef self) |
||||
{ |
||||
if (self->fullname == NULL) { |
||||
makefullname(self); |
||||
} |
||||
return self->fullname; |
||||
} |
||||
|
||||
char* Person_firstName(PersonRef self) |
||||
{ |
||||
if (self->firstname == NULL) { |
||||
makefirstname(self); |
||||
} |
||||
return self->firstname; |
||||
} |
||||
|
||||
char* Person_lastName(PersonRef self) |
||||
{ |
||||
if (self->lastname == NULL) { |
||||
makelastname(self); |
||||
} |
||||
return self->lastname; |
||||
} |
||||
|
||||
void Person_setFullName(PersonRef self,char *fullname) |
||||
{ |
||||
setfullname(self,fullname); |
||||
setfirstname(self,NULL); |
||||
setlastname(self,NULL); |
||||
} |
||||
|
||||
void Person_setFirstName(PersonRef self,char *firstname) |
||||
{ |
||||
if (self->lastname == NULL) { |
||||
makelastname(self); |
||||
} |
||||
setfirstname(self,firstname); |
||||
setfullname(self,NULL); |
||||
} |
||||
|
||||
void Person_setLastName(PersonRef self,char *lastname) |
||||
{ |
||||
if (self->firstname == NULL) { |
||||
makefirstname(self); |
||||
} |
||||
setlastname(self,lastname); |
||||
setfullname(self,NULL); |
||||
} |
@ -1,25 +0,0 @@
|
||||
#ifndef __PERSON_H__ |
||||
#define __PERSON_H__ |
||||
|
||||
typedef struct __Person Person; |
||||
typedef struct __Person* PersonRef; |
||||
|
||||
struct __Person { |
||||
char *fullname; |
||||
char *firstname; |
||||
char *lastname; |
||||
}; |
||||
|
||||
PersonRef Person_alloc(void); |
||||
PersonRef Person_init(PersonRef); |
||||
PersonRef Person_initWithName(PersonRef,char*); |
||||
PersonRef Person_personWithName(char*); |
||||
void Person_dealloc(PersonRef); |
||||
char* Person_fullName(PersonRef); |
||||
char* Person_firstName(PersonRef); |
||||
char* Person_lastName(PersonRef); |
||||
void Person_setFullName(PersonRef,char*); |
||||
void Person_setFirstName(PersonRef,char*); |
||||
void Person_setLastName(PersonRef,char*); |
||||
|
||||
#endif/*__PERSON_H__*/ |
@ -1,111 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
#include "person.h" |
||||
|
||||
PersonRef personRef; |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
personRef = Person_personWithName("test tarou"); |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
Person_dealloc(personRef); |
||||
} |
||||
|
||||
static void testfullname(void) |
||||
{ |
||||
TEST_ASSERT_EQUAL_STRING("test tarou", Person_fullName(personRef)); |
||||
} |
||||
|
||||
static void testfirstname(void) |
||||
{ |
||||
TEST_ASSERT_EQUAL_STRING("test", Person_firstName(personRef)); |
||||
} |
||||
|
||||
static void testlastname(void) |
||||
{ |
||||
TEST_ASSERT_EQUAL_STRING("tarou", Person_lastName(personRef)); |
||||
} |
||||
|
||||
static void testsetfullname(void) |
||||
{ |
||||
Person_setFullName(personRef, "sample hanako"); |
||||
|
||||
TEST_ASSERT_EQUAL_STRING("sample hanako", Person_fullName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("sample", Person_firstName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("hanako", Person_lastName(personRef)); |
||||
} |
||||
|
||||
static void testsetfirstname(void) |
||||
{ |
||||
Person_setFirstName(personRef, "sample"); |
||||
|
||||
TEST_ASSERT_EQUAL_STRING("sample tarou", Person_fullName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("sample", Person_firstName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("tarou", Person_lastName(personRef)); |
||||
} |
||||
|
||||
static void testsetlastname(void) |
||||
{ |
||||
Person_setLastName(personRef, "hanako"); |
||||
|
||||
TEST_ASSERT_EQUAL_STRING("test hanako", Person_fullName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("test", Person_firstName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("hanako", Person_lastName(personRef)); |
||||
} |
||||
|
||||
static void testnullcharfullname(void) |
||||
{ |
||||
Person_setFullName(personRef, ""); |
||||
|
||||
TEST_ASSERT_EQUAL_STRING("", Person_fullName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("", Person_firstName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("", Person_lastName(personRef)); |
||||
} |
||||
|
||||
static void testnullpointerfullname(void) |
||||
{ |
||||
Person_setFullName(personRef, NULL); |
||||
|
||||
TEST_ASSERT_NULL(Person_fullName(personRef)); |
||||
TEST_ASSERT_NULL(Person_firstName(personRef)); |
||||
TEST_ASSERT_NULL(Person_lastName(personRef)); |
||||
} |
||||
|
||||
static void testnosepfullname(void) |
||||
{ |
||||
Person_setFullName(personRef, "sample"); |
||||
|
||||
TEST_ASSERT_EQUAL_STRING("sample", Person_fullName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("sample", Person_firstName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("", Person_lastName(personRef)); |
||||
|
||||
Person_setLastName(personRef, "tarou"); |
||||
TEST_ASSERT_EQUAL_STRING("sample tarou", Person_fullName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("sample", Person_firstName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("tarou", Person_lastName(personRef)); |
||||
|
||||
Person_setFirstName(personRef, "test"); |
||||
TEST_ASSERT_EQUAL_STRING("test tarou", Person_fullName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("test", Person_firstName(personRef)); |
||||
TEST_ASSERT_EQUAL_STRING("tarou", Person_lastName(personRef)); |
||||
} |
||||
|
||||
TestRef PersonTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("testfullname",testfullname), |
||||
new_TestFixture("testfirstname",testfirstname), |
||||
new_TestFixture("testlastname",testlastname), |
||||
new_TestFixture("testsetfullname",testsetfullname), |
||||
new_TestFixture("testsetfirstname",testsetfirstname), |
||||
new_TestFixture("testsetlastname",testsetlastname), |
||||
new_TestFixture("testnullcharfullname",testnullcharfullname), |
||||
new_TestFixture("testnullpointerfullname",testnullpointerfullname), |
||||
new_TestFixture("testnosepfullname",testnosepfullname), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(PersonTest,"PersonTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&PersonTest; |
||||
} |
@ -1,21 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
|
||||
extern TestRef assertTest_tests(void); |
||||
extern TestRef stdImplTest_tests(void); |
||||
extern TestRef TestCaseTest_tests(void); |
||||
extern TestRef TestCallerTest_tests(void); |
||||
extern TestRef TestResultTest_tests(void); |
||||
extern TestRef RepeatedTestTest_tests(void); |
||||
|
||||
int main (int argc, const char* argv[]) |
||||
{ |
||||
TestRunner_start(); |
||||
TestRunner_runTest(assertTest_tests()); |
||||
TestRunner_runTest(stdImplTest_tests()); |
||||
TestRunner_runTest(TestCaseTest_tests()); |
||||
TestRunner_runTest(TestCallerTest_tests()); |
||||
TestRunner_runTest(TestResultTest_tests()); |
||||
TestRunner_runTest(RepeatedTestTest_tests()); |
||||
TestRunner_end(); |
||||
return 0; |
||||
} |
@ -1,12 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
#include "MockTestCase.h" |
||||
|
||||
static void runTest(void) |
||||
{ |
||||
} |
||||
|
||||
TestCaseRef MockTestCase_case(void) |
||||
{ |
||||
EMB_UNIT_TESTCASE(MockTestCase,"MockTestCase",NULL,NULL,runTest); |
||||
return (TestCaseRef)&MockTestCase; |
||||
} |
@ -1,6 +0,0 @@
|
||||
#ifndef __MOCKTESTCASE_H__ |
||||
#define __MOCKTESTCASE_H__ |
||||
|
||||
TestCaseRef MockTestCase_case(void); |
||||
|
||||
#endif/*__MOCKTESTCASE_H__*/ |
@ -1,57 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
#include "MockTestCase.h" |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
} |
||||
|
||||
static void testRepeatedOnce(void) |
||||
{ |
||||
RepeatedTest test = new_RepeatedTest(MockTestCase_case(),1); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
test.isa->run(&test,&result); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(1, test.isa->countTestCases(&test)); |
||||
} |
||||
|
||||
static void testRepeatedMoreThanOnce(void) |
||||
{ |
||||
RepeatedTest test = new_RepeatedTest(MockTestCase_case(),100); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
test.isa->run(&test,&result); |
||||
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(100, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(100, test.isa->countTestCases(&test)); |
||||
} |
||||
|
||||
static void testRepeatedZero(void) |
||||
{ |
||||
RepeatedTest test = new_RepeatedTest(MockTestCase_case(),0); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
test.isa->run(&test,&result); |
||||
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(0, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(0, test.isa->countTestCases(&test)); |
||||
} |
||||
|
||||
TestRef RepeatedTestTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("testRepeatedOnce",testRepeatedOnce), |
||||
new_TestFixture("testRepeatedMoreThanOnce",testRepeatedMoreThanOnce), |
||||
new_TestFixture("testRepeatedZero",testRepeatedZero), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(RepeatedTestTest,"RepeatedTestTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&RepeatedTestTest; |
||||
} |
@ -1,64 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
} |
||||
|
||||
static void testOneFixture(void) |
||||
{ |
||||
TestFixture fixtures[] = { |
||||
new_TestFixture(NULL,NULL), |
||||
}; |
||||
TestCaller caller = new_TestCaller(NULL,NULL,NULL,1,fixtures); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
caller.isa->run(&caller,&result); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(1, caller.isa->countTestCases(&caller)); |
||||
} |
||||
|
||||
static void testMoreThanOne(void) |
||||
{ |
||||
TestFixture fixtures[] = { |
||||
new_TestFixture(NULL,NULL), |
||||
new_TestFixture(NULL,NULL), |
||||
new_TestFixture(NULL,NULL), |
||||
new_TestFixture(NULL,NULL), |
||||
new_TestFixture(NULL,NULL), |
||||
}; |
||||
TestCaller caller = new_TestCaller(NULL,NULL,NULL,5,fixtures); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
caller.isa->run(&caller,&result); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(5, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(5, caller.isa->countTestCases(&caller)); |
||||
} |
||||
|
||||
static void testZeroFixture(void) |
||||
{ |
||||
TestCaller caller = new_TestCaller(NULL,NULL,NULL,0,NULL); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
caller.isa->run(&caller,&result); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(0, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(0, caller.isa->countTestCases(&caller)); |
||||
} |
||||
|
||||
TestRef TestCallerTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("testOneFixture",testOneFixture), |
||||
new_TestFixture("testMoreThanOne",testMoreThanOne), |
||||
new_TestFixture("testZeroFixture",testZeroFixture), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(TestCallerTest,"TestCallerTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&TestCallerTest; |
||||
} |
@ -1,66 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
#include "MockTestCase.h" |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
} |
||||
|
||||
static void testName(void) |
||||
{ |
||||
TestCaseRef mock = MockTestCase_case(); |
||||
TEST_ASSERT_EQUAL_STRING("MockTestCase", mock->isa->name(mock)); |
||||
} |
||||
|
||||
static void testCountTestCases(void) |
||||
{ |
||||
TestCaseRef mock = MockTestCase_case(); |
||||
TEST_ASSERT_EQUAL_INT(1, mock->isa->countTestCases(mock)); |
||||
} |
||||
|
||||
static void success_runTest(void) |
||||
{ |
||||
} |
||||
|
||||
static void testSuccess(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("success",NULL,NULL,success_runTest); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
tcase.isa->run(&tcase,&result); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(0, result.failureCount); |
||||
} |
||||
|
||||
static void failure_runTest(void) |
||||
{ |
||||
TEST_FAIL(""); |
||||
} |
||||
|
||||
static void testFailure(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("failure",NULL,NULL,failure_runTest); |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
tcase.isa->run(&tcase,&result); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(1, result.failureCount); |
||||
} |
||||
|
||||
TestRef TestCaseTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("testName",testName), |
||||
new_TestFixture("testCountTestCases",testCountTestCases), |
||||
new_TestFixture("testSuccess",testSuccess), |
||||
new_TestFixture("testFailure",testFailure), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(TestCaseTest,"TestCaseTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&TestCaseTest; |
||||
} |
@ -1,60 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
} |
||||
|
||||
static void testTestResult_result(void) |
||||
{ |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(0, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(0, result.failureCount); |
||||
} |
||||
|
||||
static void testTestResult_startTest(void) |
||||
{ |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
TestResult_startTest(&result,NULL); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(0, result.failureCount); |
||||
} |
||||
|
||||
static void testTestResult_endTest(void) |
||||
{ |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
TestResult_endTest(&result,NULL); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(0, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(0, result.failureCount); |
||||
} |
||||
|
||||
static void testTestResult_addFailure(void) |
||||
{ |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
TestResult_addFailure(&result,NULL,"",0,""); |
||||
|
||||
TEST_ASSERT_EQUAL_INT(0, result.runCount); |
||||
TEST_ASSERT_EQUAL_INT(1, result.failureCount); |
||||
} |
||||
|
||||
TestRef TestResultTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("testTestResult_result",testTestResult_result), |
||||
new_TestFixture("testTestResult_startTest",testTestResult_startTest), |
||||
new_TestFixture("testTestResult_endTest",testTestResult_endTest), |
||||
new_TestFixture("testTestResult_addFailure",testTestResult_addFailure), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(TestResultTest,"TestResultTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&TestResultTest; |
||||
} |
@ -1,103 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
} |
||||
|
||||
static void verify(TestCaseRef test) |
||||
{ |
||||
TestResult result = new_TestResult(NULL); |
||||
|
||||
test->isa->run(test,&result); |
||||
|
||||
if (result.failureCount == 0) { |
||||
TEST_FAIL("fail"); |
||||
} |
||||
} |
||||
|
||||
static void assert_equal_string_runTest(void) |
||||
{ |
||||
TEST_ASSERT_EQUAL_STRING("123","456"); |
||||
} |
||||
|
||||
static void assert_equal_int_runTest(void) |
||||
{ |
||||
TEST_ASSERT_EQUAL_INT(123,456); |
||||
} |
||||
|
||||
static void assert_null_runTest(void) |
||||
{ |
||||
char *p=""; |
||||
TEST_ASSERT_NULL(p); |
||||
} |
||||
|
||||
static void assert_not_null_runTest(void) |
||||
{ |
||||
char *p=NULL; |
||||
TEST_ASSERT_NOT_NULL(p); |
||||
} |
||||
|
||||
static void assert_message_runTest(void) |
||||
{ |
||||
TEST_ASSERT_MESSAGE(0,"0"); |
||||
} |
||||
|
||||
static void assert_runTest(void) |
||||
{ |
||||
TEST_ASSERT(0); |
||||
} |
||||
|
||||
static void testASSERT_EQUAL_STRING(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("assert_equal_string",NULL,NULL,assert_equal_string_runTest); |
||||
verify(&tcase); |
||||
} |
||||
|
||||
static void testASSERT_EQUAL_INT(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("assert_equal_int",NULL,NULL,assert_equal_int_runTest); |
||||
verify(&tcase); |
||||
} |
||||
|
||||
static void testASSERT_NULL(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("assert_null",NULL,NULL,assert_null_runTest); |
||||
verify(&tcase); |
||||
} |
||||
|
||||
static void testASSERT_NOT_NULL(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("assert_not_null",NULL,NULL,assert_not_null_runTest); |
||||
verify(&tcase); |
||||
} |
||||
|
||||
static void testASSERT_MESSAGE(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("assert_message",NULL,NULL,assert_message_runTest); |
||||
verify(&tcase); |
||||
} |
||||
|
||||
static void testASSERT(void) |
||||
{ |
||||
TestCase tcase = new_TestCase("assert",NULL,NULL,assert_runTest); |
||||
verify(&tcase); |
||||
} |
||||
|
||||
TestRef assertTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("testASSERT_EQUAL_STRING",testASSERT_EQUAL_STRING), |
||||
new_TestFixture("testASSERT_EQUAL_INT",testASSERT_EQUAL_INT), |
||||
new_TestFixture("testASSERT_NULL",testASSERT_NULL), |
||||
new_TestFixture("testASSERT_NOT_NULL",testASSERT_NOT_NULL), |
||||
new_TestFixture("testASSERT_MESSAGE",testASSERT_MESSAGE), |
||||
new_TestFixture("testASSERT",testASSERT), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(AssertTest,"AssertTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&AssertTest; |
||||
} |
@ -1,21 +0,0 @@
|
||||
CC = gcc
|
||||
CFLAGS = -O
|
||||
LDFLAGS =
|
||||
INCLUDES = ..
|
||||
LIBS = ../lib
|
||||
RM = rm
|
||||
TARGET = embUnitTest
|
||||
OBJS = AllTests.o RepeatedTestTest.o assertTest.o stdImplTest.o TestCallerTest.o TestCaseTest.o TestResultTest.o MockTestCase.o
|
||||
|
||||
all: $(TARGET) |
||||
|
||||
$(TARGET): $(OBJS) |
||||
$(CC) -o $@ $(OBJS) -L$(LIBS) -lembUnit
|
||||
|
||||
.c.o: |
||||
$(CC) $(CFLAGS) -I$(INCLUDES) -c $<
|
||||
|
||||
clean: |
||||
-$(RM) $(TARGET) $(OBJS)
|
||||
|
||||
.PHONY: clean all |
@ -1,114 +0,0 @@
|
||||
#include <embUnit/embUnit.h> |
||||
|
||||
static void setUp(void) |
||||
{ |
||||
} |
||||
|
||||
static void tearDown(void) |
||||
{ |
||||
} |
||||
|
||||
static void teststrcpy(void) |
||||
{ |
||||
char buf[32]; |
||||
char *p; |
||||
|
||||
p = stdimpl_strcpy(buf, "test"); |
||||
TEST_ASSERT_EQUAL_STRING("test", buf); |
||||
TEST_ASSERT( p == buf ); |
||||
} |
||||
|
||||
static void teststrcat(void) |
||||
{ |
||||
char buf[64]; |
||||
|
||||
stdimpl_strcpy(buf,"sample"); |
||||
stdimpl_strcat(buf," extra string"); |
||||
TEST_ASSERT_EQUAL_STRING("sample extra string", buf); |
||||
|
||||
stdimpl_strcpy(buf,""); |
||||
stdimpl_strcat(buf,"sample"); |
||||
TEST_ASSERT_EQUAL_STRING("sample", buf); |
||||
} |
||||
|
||||
static void teststrncat(void) |
||||
{ |
||||
char buf[64]; |
||||
|
||||
stdimpl_strcpy(buf,"sample"); |
||||
stdimpl_strncat(buf," extra string",13); |
||||
TEST_ASSERT_EQUAL_STRING("sample extra string", buf); |
||||
|
||||
stdimpl_strcpy(buf,"This is the initial string!"); |
||||
stdimpl_strncat(buf," extra text to add to the string", 19); |
||||
TEST_ASSERT_EQUAL_STRING("This is the initial string! extra text to add ", buf); |
||||
} |
||||
|
||||
static void teststrlen(void) |
||||
{ |
||||
TEST_ASSERT( stdimpl_strlen("test")==4 ); |
||||
TEST_ASSERT( stdimpl_strlen("")==0 ); |
||||
} |
||||
|
||||
static void teststrcmp(void) |
||||
{ |
||||
TEST_ASSERT( stdimpl_strcmp("aaa","aaa") == 0 ); |
||||
TEST_ASSERT( stdimpl_strcmp("aaa","bbb") != 0 ); |
||||
TEST_ASSERT( stdimpl_strcmp("aaa","AAA") != 0 ); |
||||
TEST_ASSERT( stdimpl_strcmp("Test","TestCase") != 0 ); |
||||
TEST_ASSERT( stdimpl_strcmp("TestCase","Test") != 0 ); |
||||
TEST_ASSERT( stdimpl_strcmp("","") == 0 ); |
||||
} |
||||
|
||||
static void testitoa(void) |
||||
{ |
||||
char buf[33]; |
||||
char *p; |
||||
|
||||
p = stdimpl_itoa(10, buf, 2); |
||||
TEST_ASSERT_EQUAL_STRING("1010", buf); |
||||
TEST_ASSERT(p == buf); |
||||
|
||||
p = stdimpl_itoa(10, buf, 8); |
||||
TEST_ASSERT_EQUAL_STRING("12", buf); |
||||
TEST_ASSERT(p == buf); |
||||
|
||||
p = stdimpl_itoa(10, buf, 10); |
||||
TEST_ASSERT_EQUAL_STRING("10", buf); |
||||
TEST_ASSERT(p == buf); |
||||
|
||||
p = stdimpl_itoa(10, buf, 16); |
||||
TEST_ASSERT_EQUAL_STRING("a", buf); |
||||
TEST_ASSERT(p == buf); |
||||
|
||||
p = stdimpl_itoa(-10, buf, 2); |
||||
TEST_ASSERT_EQUAL_STRING("11111111111111111111111111110110", buf); |
||||
TEST_ASSERT(p == buf); |
||||
|
||||
p = stdimpl_itoa(-10, buf, 8); |
||||
TEST_ASSERT_EQUAL_STRING("37777777766", buf); |
||||
TEST_ASSERT(p == buf); |
||||
|
||||
p = stdimpl_itoa(-10, buf, 10); |
||||
TEST_ASSERT_EQUAL_STRING("-10", buf); |
||||
TEST_ASSERT(p == buf); |
||||
|
||||
p = stdimpl_itoa(-10, buf, 16); |
||||
TEST_ASSERT_EQUAL_STRING("fffffff6", buf); |
||||
TEST_ASSERT(p == buf); |
||||
} |
||||
|
||||
TestRef stdImplTest_tests(void) |
||||
{ |
||||
EMB_UNIT_TESTFIXTURES(fixtures) { |
||||
new_TestFixture("teststrcpy",teststrcpy), |
||||
new_TestFixture("teststrcat",teststrcat), |
||||
new_TestFixture("teststrncat",teststrncat), |
||||
new_TestFixture("teststrlen",teststrlen), |
||||
new_TestFixture("teststrcmp",teststrcmp), |
||||
new_TestFixture("testitoa",testitoa), |
||||
}; |
||||
EMB_UNIT_TESTCALLER(StdImplTest,"stdImplTest",setUp,tearDown,fixtures); |
||||
|
||||
return (TestRef)&StdImplTest; |
||||
} |
@ -1,79 +1,92 @@
|
||||
/*
|
||||
* COPYRIGHT AND PERMISSION NOTICE |
||||
*
|
||||
* Copyright (c) 2003 Embedded Unit Project |
||||
*
|
||||
* All rights reserved. |
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons
|
||||
* to whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies
|
||||
* of the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation. |
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
* SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
||||
*
|
||||
* Except as contained in this notice, the name of a copyright holder
|
||||
* shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written
|
||||
* authorization of the copyright holder. |
||||
* |
||||
* $Id: CompilerOutputter.c,v 1.2 2003/09/06 13:28:27 arms22 Exp $ |
||||
*/ |
||||
#include <stdio.h> |
||||
#include "CompilerOutputter.h" |
||||
|
||||
static void CompilerOutputter_printHeader(OutputterRef self,TestRef test) |
||||
{ |
||||
} |
||||