-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit test cases for parodus certs
- Loading branch information
1 parent
72db2d1
commit 101a2ca
Showing
8 changed files
with
176 additions
and
8 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
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,66 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include <CUnit/Basic.h> | ||
#include "../src/rdkconfig_generic.h" | ||
|
||
void test_rdkconfig_get(void) | ||
{ | ||
uint8_t *temp=NULL; | ||
size_t tempSize=0; | ||
int result = rdkconfig_get(&temp, &tempSize,NULL); | ||
CU_ASSERT_EQUAL(result, RDKCONFIG_FAIL); | ||
result = rdkconfig_get(&temp, &tempSize,"/tmp/.cfgStaticxpki"); | ||
CU_ASSERT_EQUAL(result, RDKCONFIG_OK); | ||
} | ||
|
||
void test_rdkconfig_set(void) | ||
{ | ||
int result = rdkconfig_set(NULL,NULL,0); | ||
CU_ASSERT_EQUAL(result, RDKCONFIG_OK); | ||
} | ||
|
||
void test_rdkconfig_free(void) | ||
{ | ||
int result = rdkconfig_free(NULL,0); | ||
CU_ASSERT_EQUAL(result, RDKCONFIG_FAIL); | ||
char *ptr=NULL; | ||
ptr = strdup("hello"); | ||
result = rdkconfig_free(&ptr,5); | ||
CU_ASSERT_EQUAL(result, RDKCONFIG_OK); | ||
} | ||
|
||
void add_suites( CU_pSuite *suite ) | ||
{ | ||
*suite = CU_add_suite( "tests", NULL, NULL ); | ||
CU_add_test( *suite, "test rdkconfig_get", test_rdkconfig_get); | ||
CU_add_test( *suite, "test rdkconfig_set", test_rdkconfig_set); | ||
CU_add_test( *suite, "test rdkconfig_free", test_rdkconfig_free); | ||
} | ||
|
||
int main( int argc, char *argv[] ) | ||
{ | ||
unsigned rv = 1; | ||
CU_pSuite suite = NULL; | ||
|
||
(void ) argc; | ||
(void ) argv; | ||
|
||
if( CUE_SUCCESS == CU_initialize_registry() ) { | ||
add_suites( &suite ); | ||
|
||
if( NULL != suite ) { | ||
CU_basic_set_mode( CU_BRM_VERBOSE ); | ||
CU_basic_run_tests(); | ||
printf( "\n" ); | ||
CU_basic_show_failures( CU_get_failure_list() ); | ||
printf( "\n\n" ); | ||
rv = CU_get_number_of_tests_failed(); | ||
} | ||
|
||
CU_cleanup_registry(); | ||
|
||
} | ||
|
||
return rv; | ||
} |
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