summaryrefslogtreecommitdiffstats
path: root/common/collection/collection_ut.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-07-15 15:17:53 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-07-16 16:29:52 -0400
commit08edf9d6445f3962bf31d5f3c9fa5c9cb363c30d (patch)
tree410a86adb5653204f0f8f476e377a8a89c803102 /common/collection/collection_ut.c
parent699f1a55fd6358f04ce90d44380f1a7cb75614b6 (diff)
downloadsssd-08edf9d6445f3962bf31d5f3c9fa5c9cb363c30d.tar.gz
sssd-08edf9d6445f3962bf31d5f3c9fa5c9cb363c30d.tar.xz
sssd-08edf9d6445f3962bf31d5f3c9fa5c9cb363c30d.zip
COLLECTION Add remove item functions
The remove functions extract and remove items, they act differently from the way the delete_property function works. The new functions allow deletion with the disposition while the delete_property only deletes specified property. The delete_property function is left as is since there are some use cases when it is more efficient to use it rather than new remove_item_xxx ones.
Diffstat (limited to 'common/collection/collection_ut.c')
-rw-r--r--common/collection/collection_ut.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/common/collection/collection_ut.c b/common/collection/collection_ut.c
index c50a83847..af7746c40 100644
--- a/common/collection/collection_ut.c
+++ b/common/collection/collection_ut.c
@@ -1194,7 +1194,7 @@ int delete_test(void)
struct collection_item *col;
int error = EOK;
- printf("\n\n==== DELETION TEST ====\n\n");
+ printf("\n\n==== DELETION TEST 1====\n\n");
if ((error = col_create_collection(&col, "test", 0)) ||
(error = col_add_int_property(col, NULL, "tt", 1)) ||
@@ -1214,11 +1214,35 @@ int delete_test(void)
}
col_debug_collection(col, COL_TRAVERSE_DEFAULT);
+ col_destroy_collection(col);
- printf("\n\n==== DELETION TEST END ====\n\n");
+ printf("\n\n==== DELETION TEST 1 END ====\n\n");
+ printf("\n\n==== DELETION TEST 2====\n\n");
+
+ if ((error = col_create_collection(&col, "test2", 0)) ||
+ (error = col_add_int_property(col, NULL, "tt", 1)) ||
+ (error = col_debug_collection(col, COL_TRAVERSE_DEFAULT)) ||
+ (error = col_add_int_property(col, NULL, "test", 1)) ||
+ (error = col_debug_collection(col, COL_TRAVERSE_DEFAULT)) ||
+ (error = col_remove_item(col, NULL, COL_DSP_END, NULL, 0, COL_TYPE_ANY)) ||
+ (error = col_debug_collection(col, COL_TRAVERSE_DEFAULT)) ||
+ (error = col_add_int_property(col, NULL, "test", 1)) ||
+ (error = col_debug_collection(col, COL_TRAVERSE_DEFAULT)) ||
+ (error = col_remove_item_from_current(col, COL_DSP_AFTER, "tt", 0, COL_TYPE_ANY)) ||
+ (error = col_debug_collection(col, COL_TRAVERSE_DEFAULT)) ||
+ (error = col_add_int_property(col, NULL, "test", 1))) {
+ printf("Error in delete test %d\n", error);
+ col_destroy_collection(col);
+ return error;
+ }
+
+ col_debug_collection(col, COL_TRAVERSE_DEFAULT);
+
+ printf("\n\n==== DELETION TEST 2 END ====\n\n");
col_destroy_collection(col);
+
return error;
}