diff options
author | Dmitri Pal <dpal@redhat.com> | 2009-07-02 10:24:52 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-07-02 11:35:29 -0400 |
commit | ef1f27f3a3eaa43b4dbd24cab361b9fe43cdce44 (patch) | |
tree | 9c800152ddaeb5bde8fb3c861e139bdd2efb26dc | |
parent | 6dc2131ab0a5225decdcdb8fff8706a340d9ed3b (diff) | |
download | sssd-ef1f27f3a3eaa43b4dbd24cab361b9fe43cdce44.tar.gz sssd-ef1f27f3a3eaa43b4dbd24cab361b9fe43cdce44.tar.bz2 sssd-ef1f27f3a3eaa43b4dbd24cab361b9fe43cdce44.zip |
New deletion unit test.
Adds a unit test for deletion and re-adding
of the elements to collection.
Small syntactical fix in "stack".
-rw-r--r-- | common/collection/collection_stack.c | 2 | ||||
-rw-r--r-- | common/collection/collection_ut.c | 36 |
2 files changed, 36 insertions, 2 deletions
diff --git a/common/collection/collection_stack.c b/common/collection/collection_stack.c index 347d9b6c..70211220 100644 --- a/common/collection/collection_stack.c +++ b/common/collection/collection_stack.c @@ -94,7 +94,7 @@ int push_binary_property(struct collection_item *stack, return EINVAL; } - error = add_binary_property(stack, NULL, property, binary_data, length) + error = add_binary_property(stack, NULL, property, binary_data, length); TRACE_FLOW_STRING("push_binary_property", "Exit."); return error; diff --git a/common/collection/collection_ut.c b/common/collection/collection_ut.c index 15cebdbf..c1a4fcf8 100644 --- a/common/collection/collection_ut.c +++ b/common/collection/collection_ut.c @@ -874,6 +874,39 @@ int insert_extract_test() return EOK; } +int delete_test() +{ + + struct collection_item *col; + int error = EOK; + + printf("\n\n==== DELETION TEST ====\n\n"); + + if ((error = create_collection(&col, "test", 0)) || + (error = add_int_property(col, NULL, "tt", 1)) || + (error = debug_collection(col, COL_TRAVERSE_DEFAULT)) || + (error = add_int_property(col, NULL, "test", 1)) || + (error = debug_collection(col, COL_TRAVERSE_DEFAULT)) || + (error = delete_property(col, "test", COL_TYPE_ANY, COL_TRAVERSE_DEFAULT)) || + (error = debug_collection(col, COL_TRAVERSE_DEFAULT)) || + (error = add_int_property(col, NULL, "test", 1)) || + (error = debug_collection(col, COL_TRAVERSE_DEFAULT)) || + (error = delete_property(col, "test", COL_TYPE_ANY, COL_TRAVERSE_DEFAULT)) || + (error = debug_collection(col, COL_TRAVERSE_DEFAULT)) || + (error = add_int_property(col, NULL, "test", 1))) { + printf("Error in delete test %d\n", error); + destroy_collection(col); + return error; + } + + debug_collection(col, COL_TRAVERSE_DEFAULT); + + printf("\n\n==== DELETION TEST END ====\n\n"); + + + destroy_collection(col); + return error; +} /* Main function of the unit test */ @@ -887,7 +920,8 @@ int main() (error = add_collection_test()) || (error = mixed_collection_test()) || (error = iterator_test()) || - (error = insert_extract_test())) { + (error = insert_extract_test()) || + (error = delete_test())) { printf("Failed!\n"); } else printf("Success!\n"); |