diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:22 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:22 -0800 |
commit | 00ed02aba4f5248954531cc4611397c341661c2a (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
parent | 225a86217dd274aea51b1e442568e7aec43a74e9 (diff) | |
download | embunit-00ed02aba4f5248954531cc4611397c341661c2a.tar.gz |
auto import from //depot/cupcake/@135843
-rw-r--r-- | Android.mk | 24 | ||||
-rw-r--r-- | MODULE_LICENSE_BSD_LIKE | 0 | ||||
-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 | ||||
-rw-r--r-- | src/AssertImpl.c | 100 | ||||
-rw-r--r-- | src/NOTICE | 24 | ||||
-rw-r--r-- | src/RepeatedTest.c | 61 | ||||
-rw-r--r-- | src/TestCaller.c | 67 | ||||
-rw-r--r-- | src/TestCase.c | 82 | ||||
-rw-r--r-- | src/TestResult.c | 67 | ||||
-rw-r--r-- | src/TestRunner.c | 111 | ||||
-rw-r--r-- | src/TestSuite.c | 73 | ||||
-rw-r--r-- | src/stdImpl.c | 141 |
24 files changed, 0 insertions, 1533 deletions
diff --git a/Android.mk b/Android.mk deleted file mode 100644 index ac4e9f5..0000000 --- a/Android.mk +++ /dev/null @@ -1,24 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -# embUnit test framework source files -LOCAL_SRC_FILES := \ - src/AssertImpl.c \ - src/RepeatedTest.c \ - src/stdImpl.c \ - src/TestCaller.c \ - src/TestCase.c \ - src/TestResult.c \ - src/TestRunner.c \ - src/TestSuite.c - -# Header files path -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/inc - -LOCAL_MODULE_TAGS := tests - -LOCAL_MODULE := libembunit - -include $(BUILD_SHARED_LIBRARY) diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE deleted file mode 100644 index e69de29..0000000 --- a/MODULE_LICENSE_BSD_LIKE +++ /dev/null diff --git a/inc/AssertImpl.h b/inc/AssertImpl.h deleted file mode 100644 index de76b21..0000000 --- a/inc/AssertImpl.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 deleted file mode 100644 index 533e1be..0000000 --- a/inc/HelperMacro.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 deleted file mode 100644 index c6b7335..0000000 --- a/inc/RepeatedTest.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 deleted file mode 100644 index 5705a1c..0000000 --- a/inc/Test.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 deleted file mode 100644 index 22166b8..0000000 --- a/inc/TestCaller.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 deleted file mode 100644 index bbbd59f..0000000 --- a/inc/TestCase.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 deleted file mode 100644 index 404a971..0000000 --- a/inc/TestListener.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7ebfb28..0000000 --- a/inc/TestResult.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 deleted file mode 100644 index f709f74..0000000 --- a/inc/TestRunner.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 deleted file mode 100644 index ae100ed..0000000 --- a/inc/TestSuite.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 deleted file mode 100644 index 2328d3a..0000000 --- a/inc/config.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 2cb4d47..0000000 --- a/inc/embUnit.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 deleted file mode 100644 index f6ce267..0000000 --- a/inc/stdImpl.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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__*/ diff --git a/src/AssertImpl.c b/src/AssertImpl.c deleted file mode 100644 index 4698d83..0000000 --- a/src/AssertImpl.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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.c,v 1.5 2004/02/10 16:15:25 arms22 Exp $ - */ -#include "config.h" -#include "stdImpl.h" -#include "AssertImpl.h" - -void assertImplementationInt(int expected,int actual, long line, const char *file) -{ - char buffer[32]; /*"exp -2147483647 was -2147483647"*/ - char numbuf[12]; /*32bit int decimal maximum column is 11 (-2147483647~2147483647)*/ - - stdimpl_strcpy(buffer, "exp "); - - { stdimpl_itoa(expected, numbuf, 10); - stdimpl_strncat(buffer, numbuf, 11); } - - stdimpl_strcat(buffer, " was "); - - { stdimpl_itoa(actual, numbuf, 10); - stdimpl_strncat(buffer, numbuf, 11); } - - addFailure(buffer, line, file); -} - -void assertImplementationCStr(const char *expected,const char *actual, long line, const char *file) -{ - char buffer[ASSERT_STRING_BUFFER_MAX]; - #define exp_act_limit ((ASSERT_STRING_BUFFER_MAX-11-1)/2)/* "exp'' was''" = 11 byte */ - int el; - int al; - - if (expected) { - el = stdimpl_strlen(expected); - } else { - el = 4; - expected = "null"; - } - - if (actual) { - al = stdimpl_strlen(actual); - } else { - al = 4; - actual = "null"; - } - if (el > exp_act_limit) { - if (al > exp_act_limit) { - al = exp_act_limit; - el = exp_act_limit; - } else { - int w = exp_act_limit + (exp_act_limit - al); - if (el > w) { - el = w; - } - } - } else { - int w = exp_act_limit + (exp_act_limit - el); - if (al > w) { - al = w; - } - } - stdimpl_strcpy(buffer, "exp \""); - stdimpl_strncat(buffer, expected, el); - stdimpl_strcat(buffer, "\" was \""); - stdimpl_strncat(buffer, actual, al); - stdimpl_strcat(buffer, "\""); - - addFailure(buffer, line, file); -} diff --git a/src/NOTICE b/src/NOTICE deleted file mode 100644 index 29defa8..0000000 --- a/src/NOTICE +++ /dev/null @@ -1,24 +0,0 @@ -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. diff --git a/src/RepeatedTest.c b/src/RepeatedTest.c deleted file mode 100644 index d8b09b8..0000000 --- a/src/RepeatedTest.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.c,v 1.5 2004/02/10 16:19:29 arms22 Exp $ - */ -#include "Test.h" -#include "RepeatedTest.h" - -char* RepeatedTest_name(RepeatedTest* self) -{ - return Test_name(self->test); -} - -void RepeatedTest_run(RepeatedTest* self,TestResult* result) -{ - int i; - Test* test = self->test; - for (i=0; i<self->timesRepeat; i++) { - Test_run(test, result); - } -} - -int RepeatedTest_countTestCases(RepeatedTest* self) -{ - return Test_countTestCases(self->test) * self->timesRepeat; -} - -const TestImplement RepeatedTestImplement = { - (TestNameFunction) RepeatedTest_name, - (TestRunFunction) RepeatedTest_run, - (TestCountTestCasesFunction)RepeatedTest_countTestCases, -}; diff --git a/src/TestCaller.c b/src/TestCaller.c deleted file mode 100644 index 5ecec9f..0000000 --- a/src/TestCaller.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.c,v 1.6 2004/02/10 16:19:29 arms22 Exp $ - */ -#include "Test.h" -#include "TestCase.h" -#include "TestCaller.h" - -char* TestCaller_name(TestCaller* self) -{ - return self->name; -} - -void TestCaller_run(TestCaller* self,TestResult* result) -{ - TestCase cs = new_TestCase(0,0,0,0); - int i; - cs.setUp= self->setUp; - cs.tearDown = self->tearDown; - for (i=0; i<self->numberOfFixtuers; i++) { - cs.name = self->fixtuers[i].name; - cs.runTest = self->fixtuers[i].test; - /*run test*/ - Test_run(&cs,result); - } -} - -int TestCaller_countTestCases(TestCaller* self) -{ - return self->numberOfFixtuers; -} - -const TestImplement TestCallerImplement = { - (TestNameFunction) TestCaller_name, - (TestRunFunction) TestCaller_run, - (TestCountTestCasesFunction)TestCaller_countTestCases, -}; diff --git a/src/TestCase.c b/src/TestCase.c deleted file mode 100644 index 6688ca6..0000000 --- a/src/TestCase.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.c,v 1.6 2004/02/10 16:19:29 arms22 Exp $ - */ -#include "Test.h" -#include "TestCase.h" -#include "TestResult.h" - -static TestResult* result_; -static TestCase* self_; - -char* TestCase_name(TestCase* self) -{ - return self->name; -} - -void TestCase_run(TestCase* self,TestResult* result) -{ - TestResult_startTest(result, (Test*)self); - if (self->setUp) { - self->setUp(); - } - if (self->runTest) { - TestResult* wr =result_; /*push*/ - TestCase* ws = self_; /*push*/ - result_ = result; - self_ = self; - self->runTest(); - result_ = wr; /*pop*/ - self_ = ws; /*pop*/ - } - if (self->tearDown) { - self->tearDown(); - } - TestResult_endTest(result, (Test*)self); -} - -int TestCase_countTestCases(TestCase* self) -{ - return 1; -} - -const TestImplement TestCaseImplement = { - (TestNameFunction) TestCase_name, - (TestRunFunction) TestCase_run, - (TestCountTestCasesFunction)TestCase_countTestCases, -}; - -void addFailure(const char *msg, long line, const char *file) -{ - TestResult_addFailure(result_, (Test*)self_, (char*)msg, line, (char*)file); -} diff --git a/src/TestResult.c b/src/TestResult.c deleted file mode 100644 index 6006df8..0000000 --- a/src/TestResult.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.c,v 1.4 2004/02/10 16:19:29 arms22 Exp $ - */ -#include "Test.h" -#include "TestListener.h" -#include "TestResult.h" - -void TestResult_init(TestResult* self,TestListner* listner) -{ - self->runCount = 0; - self->failureCount = 0; - self->listener = listner; -} - -void TestResult_startTest(TestResult* self,Test* test) -{ - self->runCount++; - if (self->listener) { - TestListner_startTest(self->listener, test); - } -} - -void TestResult_endTest(TestResult* self,Test* test) -{ - if (self->listener) { - TestListner_endTest(self->listener, test); - } -} - -void TestResult_addFailure(TestResult* self,Test* test,const char* msg,int line,const char* file) -{ - self->failureCount++; - if (self->listener) { - TestListner_addFailure(self->listener, test, msg, line, file); - } -} diff --git a/src/TestRunner.c b/src/TestRunner.c deleted file mode 100644 index a6388d0..0000000 --- a/src/TestRunner.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.c,v 1.6 2004/02/10 16:19:29 arms22 Exp $ - */ -#include "config.h" -#include "stdImpl.h" -#include "Test.h" -#include "TestListener.h" -#include "TestResult.h" -#include "TestRunner.h" - -static TestResult result_; -static Test* root_; - -static void TestRunner_startTest(TestListner* self,Test* test) -{ - stdimpl_print("."); -} - -static void TestRunner_endTest(TestListner* self,Test* test) -{ -} - -static void TestRunner_addFailure(TestListner* self,Test* test,char* msg,int line,char* file) -{ - stdimpl_print("\n"); - stdimpl_print(Test_name(root_)); - stdimpl_print("."); - stdimpl_print(Test_name(test)); - { - char buf[16]; - stdimpl_print(" ("); - stdimpl_print(file); - stdimpl_print(" "); - stdimpl_itoa(line, buf, 10); - stdimpl_print(buf); - stdimpl_print(") "); - } - stdimpl_print(msg); - stdimpl_print("\n"); -} - -static const TestListnerImplement TestRunnerImplement = { - (TestListnerStartTestCallBack) TestRunner_startTest, - (TestListnerEndTestCallBack) TestRunner_endTest, - (TestListnerAddFailureCallBack) TestRunner_addFailure, -}; - -static const TestListner testrunner_ = { - (TestListnerImplement*)&TestRunnerImplement, -}; - -void TestRunner_start(void) -{ - TestResult_init(&result_, (TestListner*)&testrunner_); -} - -void TestRunner_runTest(Test* test) -{ - root_ = test; - Test_run(test, &result_); -} - -void TestRunner_end(void) -{ - char buf[16]; - if (result_.failureCount) { - stdimpl_print("\nrun "); - stdimpl_itoa(result_.runCount, buf, 10); - stdimpl_print(buf); - stdimpl_print(" failures "); - stdimpl_itoa(result_.failureCount, buf, 10); - stdimpl_print(buf); - stdimpl_print("\n"); - } else { - stdimpl_print("\nOK ("); - stdimpl_itoa(result_.runCount, buf, 10); - stdimpl_print(buf); - stdimpl_print(" tests)\n"); - } -} diff --git a/src/TestSuite.c b/src/TestSuite.c deleted file mode 100644 index a8899e2..0000000 --- a/src/TestSuite.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.c,v 1.5 2004/02/10 16:19:29 arms22 Exp $ - */ -#include "Test.h" -#include "TestSuite.h" - -char* TestSuite_name(TestSuite* self) -{ - return self->name; -} - -void TestSuite_run(TestSuite* self,TestResult* result) -{ - int i; - Test* test; - if (self->tests) { - for (i=0; i<self->numberOfTests; i++) { - test = self->tests[i]; - Test_run(test, result); - } - } -} - -int TestSuite_countTestCases(TestSuite* self) -{ - int count = 0; - int i; - Test* test; - if (self->tests) { - for (i=0; i<self->numberOfTests; i++) { - test = self->tests[i]; - count += Test_countTestCases(test); - } - } - return count; -} - -const TestImplement TestSuiteImplement = { - (TestNameFunction) TestSuite_name, - (TestRunFunction) TestSuite_run, - (TestCountTestCasesFunction)TestSuite_countTestCases, -}; diff --git a/src/stdImpl.c b/src/stdImpl.c deleted file mode 100644 index 082ebc1..0000000 --- a/src/stdImpl.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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.c,v 1.3 2004/02/10 16:15:25 arms22 Exp $ - */ -#include "stdImpl.h" - -char* stdimpl_strcpy(char *dst, const char *src) -{ - char *start = dst; - char c; - do { - c = *src; - *dst = c; - src++; - dst++; - } while (c); - return start; -} - -char* stdimpl_strcat(char *dst, const char *src) -{ - char *start = dst; - char c; - do { - c = *dst; - dst++; - } while (c); - dst--; - do { - c = *src; - *dst = c; - src++; - dst++; - } while (c); - return start; -} - -char* stdimpl_strncat(char *dst, const char *src,unsigned int count) -{ - char *start = dst; - char c; - do { - c = *dst; - dst++; - } while (c); - dst--; - if (count) { - do { - c = *src; - *dst = c; - src++; - dst++; - count--; - } while (c && count); - *dst = '\0'; - } - return start; -} - -int stdimpl_strlen(const char *str) -{ - const char *estr = str; - char c; - do { - c = *estr; - estr++; - } while (c); - return ((int)(estr - str - 1)); -} - -int stdimpl_strcmp(const char *s1, const char *s2) -{ - char c1,c2; - do { - c1 = *s1++; - c2 = *s2++; - } while ((c1) && (c2) && (c1==c2)); - return c1 - c2; -} - -static char* _xtoa(unsigned long v,char *string, int r, int is_neg) -{ - char *start = string; - char buf[33],*p; - - p = buf; - - do { - *p++ = "0123456789abcdef"[(v % r) & 0xf]; - } while (v /= r); - - if (is_neg) { - *p++ = '-'; - } - - do { - *string++ = *--p; - } while (buf != p); - - *string = '\0'; - - return start; -} - -char* stdimpl_itoa(int v,char *string,int r) -{ - if ((r == 10) && (v < 0)) { - return _xtoa((unsigned long)(-v), string, r, 1); - } - return _xtoa((unsigned long)(v), string, r, 0); -} |