update Readme
This commit is contained in:
13
README.md
13
README.md
@@ -1,6 +1,6 @@
|
|||||||
# KUnity
|
# KUnity
|
||||||
|
|
||||||
KUnity configure the c unit test framework Unity (http://www.throwtheswitch.org/unity) for running the test cases in kernel space. Testoutputs will be "shown"" by printk
|
KUnity configure the c unit test framework Unity (http://www.throwtheswitch.org/unity) so that it can use in kernel space. The test results will be "shown" by `printk`.
|
||||||
|
|
||||||
## Add KUnity to a kernel module
|
## Add KUnity to a kernel module
|
||||||
|
|
||||||
@@ -20,9 +20,8 @@ ccflags-y += -DUNITY_INCLUDE_CONFIG_H
|
|||||||
|
|
||||||
## Write and Running test cases
|
## Write and Running test cases
|
||||||
|
|
||||||
mainly in the same kind like desripted here KUnity and Unity header, but the test functions have to use the ```KUNITY_TEST``` makro.
|
Test can be written like Unity tests, but for the definition of the test function you have to use the ```KUNITY_TEST``` makro.
|
||||||
|
When a kunity test should run, its necessary to add the prefix ```kunity_test_``` to the test function name.
|
||||||
When a kunityy test should run, its nessarrry to add the prefix ```kunity_test_``` to the test function name
|
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#include <kunity.h>
|
#include <kunity.h>
|
||||||
@@ -32,8 +31,9 @@ KUNITY_TEST(first_simple_test)
|
|||||||
TEST_ASSERT_EQUAL(1, 0);
|
TEST_ASSERT_EQUAL(1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... more tests
|
// add more tests
|
||||||
|
|
||||||
|
// run tests
|
||||||
int module_init(void) {
|
int module_init(void) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
UNITY_BEGIN();
|
UNITY_BEGIN();
|
||||||
@@ -47,6 +47,5 @@ int module_init(void) {
|
|||||||
|
|
||||||
return -result;
|
return -result;
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
For test runnig it can also use the kunity_test_runner_module
|
For running tests it can also use the [KUnity-Test-Runner-Module](/kttd/KUnity-Test-Runner-Module)
|
||||||
|
|||||||
Reference in New Issue
Block a user