diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:04:17 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:04:17 -0800 |
commit | 225a86217dd274aea51b1e442568e7aec43a74e9 (patch) | |
tree | c9f262aab4d996452947fc9e8a1e4d452b9bf84d /inc | |
download | embunit-225a86217dd274aea51b1e442568e7aec43a74e9.tar.gz |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'inc')
-rw-r--r-- | inc/AssertImpl.h | 72 | ||||
-rw-r--r-- | inc/HelperMacro.h | 59 | ||||
-rw-r--r-- | inc/RepeatedTest.h | 56 | ||||
-rw-r--r-- | inc/Test.h | 65 | ||||
-rw-r--r-- | inc/TestCaller.h | 76 | ||||
-rw-r--r-- | inc/TestCase.h | 60 | ||||
-rw-r--r-- | inc/TestListener.h | 62 | ||||
-rw-r--r-- | inc/TestResult.h | 70 | ||||
-rw-r--r-- | inc/TestRunner.h | 50 | ||||
-rw-r--r-- | inc/TestSuite.h | 58 | ||||
-rw-r--r-- | inc/config.h | 48 | ||||
-rw-r--r-- | inc/embUnit.h | 50 | ||||
-rw-r--r-- | inc/stdImpl.h | 57 |
13 files changed, 783 insertions, 0 deletions
diff --git a/inc/AssertImpl.h b/inc/AssertImpl.h new file mode 100644 index 0000000..de76b21 --- /dev/null +++ b/inc/AssertImpl.h @@ -0,0 +1,72 @@ +/* + * 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: AssertImpl.h,v 1.6 2003/09/16 11:09:53 arms22 Exp $ + */ +#ifndef __ASSERTIMPL_H__ +#define __ASSERTIMPL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void addFailure(const char *msg, long line, const char *file); /*TestCase.c*/ + +void assertImplementationInt(int expected,int actual, long line, const char *file); +void assertImplementationCStr(const char *expected,const char *actual, long line, const char *file); + +#define TEST_ASSERT_EQUAL_STRING(expected,actual)\ + if (expected && actual && (stdimpl_strcmp(expected,actual)==0)) {} else {assertImplementationCStr(expected,actual,__LINE__,__FILE__);return;} + +#define TEST_ASSERT_EQUAL_INT(expected,actual)\ + if (expected == actual) {} else {assertImplementationInt(expected,actual,__LINE__,__FILE__);return;} + +#define TEST_ASSERT_NULL(pointer)\ + TEST_ASSERT_MESSAGE(pointer == NULL,#pointer " was not null.") + +#define TEST_ASSERT_NOT_NULL(pointer)\ + TEST_ASSERT_MESSAGE(pointer != NULL,#pointer " was null.") + +#define TEST_ASSERT_MESSAGE(condition, message)\ + if (condition) {} else {TEST_FAIL(message);} + +#define TEST_ASSERT(condition)\ + if (condition) {} else {TEST_FAIL(#condition);} + +#define TEST_FAIL(message)\ + if (0) {} else {addFailure(message,__LINE__,__FILE__);return;} + +#ifdef __cplusplus +} +#endif + +#endif/*__ASSERTIMPL_H__*/ diff --git a/inc/HelperMacro.h b/inc/HelperMacro.h new file mode 100644 index 0000000..533e1be --- /dev/null +++ b/inc/HelperMacro.h @@ -0,0 +1,59 @@ +/* + * 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: HelperMacro.h,v 1.3 2004/02/10 16:19:29 arms22 Exp $ + */ +#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_TESTSUITE(su,name,array) \ + static const TestSuite su = new_TestSuite(name,(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_TESTFIXTURES(fixtures) \ + static const TestFixture fixtures[] = + +#define EMB_UNIT_REPEATEDTEST(repeater,test,tmrp) \ + static const RepeatedTest repeater = new_RepeatedTest(test,tmrp) + +#endif/*__HELPERMACRO_H__*/ diff --git a/inc/RepeatedTest.h b/inc/RepeatedTest.h new file mode 100644 index 0000000..c6b7335 --- /dev/null +++ b/inc/RepeatedTest.h @@ -0,0 +1,56 @@ +/* + * 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: RepeatedTest.h,v 1.7 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __REPEATEDTEST_H__ +#define __REPEATEDTEST_H__ + +typedef struct __RepeatedTest RepeatedTest; +typedef struct __RepeatedTest* RepeatedTestRef; /*downward compatible*/ + +struct __RepeatedTest { + TestImplement* isa; + Test* test; + int timesRepeat; +}; + +extern const TestImplement RepeatedTestImplement; + +#define new_RepeatedTest(test,tmrp)\ + {\ + (TestImplement*)&RepeatedTestImplement,\ + (Test*)test,\ + tmrp,\ + } + +#endif/*__REPEATEDTEST_H__*/ diff --git a/inc/Test.h b/inc/Test.h new file mode 100644 index 0000000..5705a1c --- /dev/null +++ b/inc/Test.h @@ -0,0 +1,65 @@ +/* + * 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: Test.h,v 1.4 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __TEST_H__ +#define __TEST_H__ + +typedef struct __TestResult TestResult; +typedef struct __TestResult* TestResultRef;/*downward compatible*/ + +typedef struct __TestImplement TestImplement; +typedef struct __TestImplement* TestImplementRef;/*downward compatible*/ + +typedef char*(*TestNameFunction)(void*); +typedef void(*TestRunFunction)(void*,TestResult*); +typedef int(*TestCountTestCasesFunction)(void*); + +struct __TestImplement { + TestNameFunction name; + TestRunFunction run; + TestCountTestCasesFunction countTestCases; +}; + +typedef struct __Test Test; +typedef struct __Test* TestRef;/*downward compatible*/ + +struct __Test { + TestImplement* isa; +}; + +#define Test_name(s) ((Test*)s)->isa->name(s) +#define Test_run(s,r) ((Test*)s)->isa->run(s,r) +#define Test_countTestCases(s) ((Test*)s)->isa->countTestCases(s) + +#endif/*__TEST_H__*/ diff --git a/inc/TestCaller.h b/inc/TestCaller.h new file mode 100644 index 0000000..22166b8 --- /dev/null +++ b/inc/TestCaller.h @@ -0,0 +1,76 @@ +/* + * 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: TestCaller.h,v 1.7 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __TESTCALLER_H__ +#define __TESTCALLER_H__ + +typedef struct __TestFixture TestFixture; +typedef struct __TestFixture* TestFixtureRef;/*downward compatible*/ + +struct __TestFixture { + char *name; + void(*test)(void); +}; + +#define new_TestFixture(name,test)\ + {\ + name,\ + test,\ + } + +typedef struct __TestCaller TestCaller; +typedef struct __TestCaller* TestCallerRef;/*downward compatible*/ + +struct __TestCaller { + TestImplement* isa; + char *name; + void(*setUp)(void); + void(*tearDown)(void); + int numberOfFixtuers; + TestFixture *fixtuers; +}; + +extern const TestImplement TestCallerImplement; + +#define new_TestCaller(name,sup,tdw,numberOfFixtuers,fixtuers)\ + {\ + (TestImplement*)&TestCallerImplement,\ + name,\ + sup,\ + tdw,\ + numberOfFixtuers,\ + fixtuers,\ + } + +#endif/*__TESTCALLER_H__*/ diff --git a/inc/TestCase.h b/inc/TestCase.h new file mode 100644 index 0000000..bbbd59f --- /dev/null +++ b/inc/TestCase.h @@ -0,0 +1,60 @@ +/* + * 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: TestCase.h,v 1.7 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __TESTCASE_H__ +#define __TESTCASE_H__ + +typedef struct __TestCase TestCase; +typedef struct __TestCase* TestCaseRef;/*compatible embUnit1.0*/ + +struct __TestCase { + TestImplement* isa; + char *name; + void(*setUp)(void); + void(*tearDown)(void); + void(*runTest)(void); +}; + +extern const TestImplement TestCaseImplement; + +#define new_TestCase(name,setUp,tearDown,runTest)\ + {\ + (TestImplement*)&TestCaseImplement,\ + name,\ + setUp,\ + tearDown,\ + runTest,\ + } + +#endif/*__TESTCASE_H__*/ diff --git a/inc/TestListener.h b/inc/TestListener.h new file mode 100644 index 0000000..404a971 --- /dev/null +++ b/inc/TestListener.h @@ -0,0 +1,62 @@ +/* + * 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: TestListener.h,v 1.4 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __TESTLISTENER_H__ +#define __TESTLISTENER_H__ + +typedef struct __TestListnerImplement TestListnerImplement; +typedef struct __TestListnerImplement* TestListnerImplementRef;/*downward compatible*/ + +typedef void(*TestListnerStartTestCallBack)(void*,void*); +typedef void(*TestListnerEndTestCallBack)(void*,void*); +typedef void(*TestListnerAddFailureCallBack)(void*,void*,const char*,int,const char*); + +struct __TestListnerImplement { + TestListnerStartTestCallBack startTest; + TestListnerEndTestCallBack endTest; + TestListnerAddFailureCallBack addFailure; +}; + +/*typedef struct __TestListner TestListner;*/ /*->TestResult.h*/ +/*typedef struct __TestListner* TestListnerRef;*/ /*->TestResult.h*/ + +struct __TestListner { + TestListnerImplement* isa; +}; + +#define TestListner_startTest(s,t) ((TestListner*)s)->isa->startTest(s,t) +#define TestListner_endTest(s,t) ((TestListner*)s)->isa->endTest(s,t) +#define TestListner_addFailure(s,t,m,l,f) ((TestListner*)s)->isa->addFailure(s,t,m,l,f) + +#endif/*__TESTLISTENER_H__*/ diff --git a/inc/TestResult.h b/inc/TestResult.h new file mode 100644 index 0000000..7ebfb28 --- /dev/null +++ b/inc/TestResult.h @@ -0,0 +1,70 @@ +/* + * 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: TestResult.h,v 1.7 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __TESTRESULT_H__ +#define __TESTRESULT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/*typedef struct __TestResult TestResult;*//* -> Test.h*/ +/*typedef struct __TestResult* TestResultRef;*//* -> Test.h*/ + +typedef struct __TestListner TestListner; +typedef struct __TestListner* TestListnerRef;/*downward compatible*/ + +struct __TestResult { + unsigned short runCount; + unsigned short failureCount; + TestListner* listener; +}; + +#define new_TestResult(listener)\ + {\ + 0,\ + 0,\ + (TestListner*)listener,\ + } + +void TestResult_init(TestResult* self,TestListner* listner); +void TestResult_startTest(TestResult* self,Test* test); +void TestResult_endTest(TestResult* self,Test* test); +void TestResult_addFailure(TestResult* self,Test* test,const char* msg,int line,const char* file); + +#ifdef __cplusplus +} +#endif + +#endif/*__TESTRESULT_H__*/ diff --git a/inc/TestRunner.h b/inc/TestRunner.h new file mode 100644 index 0000000..f709f74 --- /dev/null +++ b/inc/TestRunner.h @@ -0,0 +1,50 @@ +/* + * 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: TestRunner.h,v 1.6 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __TESTRUNNER_H__ +#define __TESTRUNNER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void TestRunner_start(void); +void TestRunner_runTest(Test* test); +void TestRunner_end(void); + +#ifdef __cplusplus +} +#endif + +#endif/*__TESTRUNNER_H__*/ diff --git a/inc/TestSuite.h b/inc/TestSuite.h new file mode 100644 index 0000000..ae100ed --- /dev/null +++ b/inc/TestSuite.h @@ -0,0 +1,58 @@ +/* + * 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: TestSuite.h,v 1.7 2004/02/10 16:19:29 arms22 Exp $ + */ +#ifndef __TESTSUITE_H__ +#define __TESTSUITE_H__ + +typedef struct __TestSuite TestSuite; +typedef struct __TestSuite* TestSuiteRef;/*downward compatible*/ + +struct __TestSuite { + TestImplement* isa; + char *name; + int numberOfTests; + Test** tests; +}; + +extern const TestImplement TestSuiteImplement; + +#define new_TestSuite(name,tests,numberOfTests)\ + {\ + (TestImplement*)&TestSuiteImplement,\ + name,\ + numberOfTests,\ + tests,\ + } + +#endif/*__TESTSUITE_H__*/ diff --git a/inc/config.h b/inc/config.h new file mode 100644 index 0000000..2328d3a --- /dev/null +++ b/inc/config.h @@ -0,0 +1,48 @@ +/* + * 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: config.h,v 1.7 2004/02/10 16:17:07 arms22 Exp $ + */ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +/* #define NO_STDIO_PRINTF*/ + #ifdef NO_STDIO_PRINTF + extern void stdimpl_print(const char *string); + #else + #include<stdio.h> + #define stdimpl_print printf + #endif + + #define ASSERT_STRING_BUFFER_MAX 64 + +#endif/*__CONFIG_H__*/ diff --git a/inc/embUnit.h b/inc/embUnit.h new file mode 100644 index 0000000..2cb4d47 --- /dev/null +++ b/inc/embUnit.h @@ -0,0 +1,50 @@ +/* + * 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: embUnit.h,v 1.4 2004/02/10 16:16:19 arms22 Exp $ + */ +#ifndef __EMBUNIT_H__ +#define __EMBUNIT_H__ + +#include <Test.h> +#include <TestCase.h> +#include <TestListener.h> +#include <TestResult.h> +#include <TestSuite.h> +#include <TestRunner.h> +#include <TestCaller.h> +#include <RepeatedTest.h> +#include <stdImpl.h> +#include <AssertImpl.h> +#include <HelperMacro.h> + +#endif/*__EMBUNIT_H__*/ diff --git a/inc/stdImpl.h b/inc/stdImpl.h new file mode 100644 index 0000000..f6ce267 --- /dev/null +++ b/inc/stdImpl.h @@ -0,0 +1,57 @@ +/* + * 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: stdImpl.h,v 1.4 2004/02/10 16:15:25 arms22 Exp $ + */ +#ifndef __STDIMPL_H__ +#define __STDIMPL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif + +char* stdimpl_strcpy(char *s1, const char *s2); +char* stdimpl_strcat(char *dst, const char *src); +char* stdimpl_strncat(char *dst, const char *src,unsigned int count); +int stdimpl_strlen(const char *str); +int stdimpl_strcmp(const char *s1, const char *s2); +char* stdimpl_itoa(int v,char *string,int r); + +#ifdef __cplusplus +} +#endif + +#endif/*__STDIMPL_H__*/ |