-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #36: The cUnit module test was updated:
- rename private test function - global counter of started modules was added to crypt module
- Loading branch information
1 parent
40386eb
commit ca40758
Showing
8 changed files
with
151 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* File: test_crypt.c | ||
* Author: Kirill Scherba <kirill@scherba.ru> | ||
* | ||
* Crypt module test | ||
* | ||
* Created on Aug 7, 2015, 9:31:12 PM | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <CUnit/Basic.h> | ||
|
||
#include "ev_mgr.h" | ||
#include "crypt.h" | ||
|
||
extern CU_pSuite pSuite; // Test global variable | ||
|
||
extern int num_crypt_module; // Teonet crypt module global variable | ||
|
||
/** | ||
* Test Initialize/Destroy Crypt module | ||
*/ | ||
void test_1_1() { | ||
|
||
ksnCryptClass *kcr; | ||
CU_ASSERT_PTR_NOT_NULL_FATAL((kcr = ksnCryptInit(NULL))); | ||
CU_ASSERT(num_crypt_module == 1); | ||
ksnCryptDestroy(kcr); | ||
CU_ASSERT(num_crypt_module == 0); | ||
} | ||
|
||
/** | ||
* Add Crypt suite tests | ||
* | ||
* @return | ||
*/ | ||
int add_suite_1_tests(void) { | ||
|
||
// Add the tests to the suite | ||
if ((NULL == CU_add_test(pSuite, "Initialize/Destroy Crypt module", test_1_1)) | ||
) { | ||
CU_cleanup_registry(); | ||
return CU_get_error(); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* File: test_net_rt_udp.c | ||
* Author: Kirill Scherba <kirill@scherba.ru> | ||
* | ||
* TR-UDP module test | ||
* | ||
* Created on Aug 7, 2015, 9:31:12 PM | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <CUnit/Basic.h> | ||
|
||
#include "ev_mgr.h" | ||
|
||
// Modules functions | ||
int add_suite_1_tests(void); | ||
int add_suite_2_tests(void); | ||
|
||
// Global variables | ||
CU_pSuite pSuite = NULL; | ||
|
||
|
||
/* | ||
* CUnit Test | ||
*/ | ||
|
||
int init_suite(void) { | ||
return 0; | ||
} | ||
|
||
int clean_suite(void) { | ||
return 0; | ||
} | ||
|
||
int main() { | ||
|
||
KSN_SET_TEST_MODE(1); | ||
|
||
// Initialize the CUnit test registry | ||
if (CUE_SUCCESS != CU_initialize_registry()) | ||
return CU_get_error(); | ||
|
||
// Add a suite to the registry | ||
pSuite = CU_add_suite("Teonet library Crypt module", init_suite, clean_suite); | ||
if (NULL == pSuite) { | ||
CU_cleanup_registry(); | ||
return CU_get_error(); | ||
} | ||
add_suite_1_tests(); | ||
|
||
// Add a suite to the registry | ||
pSuite = CU_add_suite("Teonet library TR-UDP module", init_suite, clean_suite); | ||
if (NULL == pSuite) { | ||
CU_cleanup_registry(); | ||
return CU_get_error(); | ||
} | ||
add_suite_2_tests(); | ||
|
||
/* Run all tests using the CUnit Basic interface */ | ||
CU_basic_set_mode(CU_BRM_VERBOSE); | ||
//CU_list_tests_to_file(); | ||
CU_basic_run_tests(); | ||
//CU_console_run_tests(); | ||
CU_cleanup_registry(); | ||
return CU_get_error(); | ||
} |