aboutsummaryrefslogtreecommitdiff
path: root/src/set/test_set_union_copy.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2015-10-03 22:36:37 +0000
committerFlorian Dold <florian.dold@gmail.com>2015-10-03 22:36:37 +0000
commit8c85bda93a8ece52f02af7f20fb797ad6ac79337 (patch)
tree9170d89d46bae30e60a3f45e852e0469700a7eab /src/set/test_set_union_copy.c
parent03b62462b4db11dbbb3e121cb6992c8d0fb9152a (diff)
downloadgnunet-8c85bda93a8ece52f02af7f20fb797ad6ac79337.tar.gz
gnunet-8c85bda93a8ece52f02af7f20fb797ad6ac79337.zip
- another fix to generation handling and lazy copying
Diffstat (limited to 'src/set/test_set_union_copy.c')
-rw-r--r--src/set/test_set_union_copy.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/set/test_set_union_copy.c b/src/set/test_set_union_copy.c
index bb8d57631..47520588a 100644
--- a/src/set/test_set_union_copy.c
+++ b/src/set/test_set_union_copy.c
@@ -157,7 +157,7 @@ void test_done (void *cls)
157 157
158void check_new_set_count (void *cls) 158void check_new_set_count (void *cls)
159{ 159{
160 check_count (set2, "new set", 2, &test_done, NULL); 160 check_count (set2, "new set", 4, &test_done, NULL);
161} 161}
162 162
163 163
@@ -166,8 +166,13 @@ void copy_done (void *cls, struct GNUNET_SET_Handle *new_set)
166 printf ("copy done\n"); 166 printf ("copy done\n");
167 set2 = new_set; 167 set2 = new_set;
168 remove_element_str (set2, "spam"); 168 remove_element_str (set2, "spam");
169 add_element_str (set2, "new1");
170 add_element_str (set2, "new2");
171 remove_element_str (set2, "new2");
172 remove_element_str (set2, "new3");
169 // Check that set1 didn't change. 173 // Check that set1 didn't change.
170 check_count (set1, "old set", 3, &check_new_set_count, NULL); 174 check_count (set1, "old set", 3,
175 &check_new_set_count, NULL);
171} 176}
172 177
173 178
@@ -203,8 +208,14 @@ run (void *cls,
203 set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION); 208 set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
204 add_element_str (set1, "foo"); 209 add_element_str (set1, "foo");
205 add_element_str (set1, "bar"); 210 add_element_str (set1, "bar");
211 /* duplicate -- ignored */
212 add_element_str (set1, "bar");
206 remove_element_str (set1, "foo"); 213 remove_element_str (set1, "foo");
214 /* non-existent -- ignored */
215 remove_element_str (set1, "nonexist1");
207 add_element_str (set1, "spam"); 216 add_element_str (set1, "spam");
217 /* duplicate -- ignored */
218 remove_element_str (set1, "foo");
208 add_element_str (set1, "eggs"); 219 add_element_str (set1, "eggs");
209 220
210 check_count (set1, "initial test", 3, &test_copy, NULL); 221 check_count (set1, "initial test", 3, &test_copy, NULL);
@@ -214,7 +225,7 @@ run (void *cls,
214int 225int
215main (int argc, char **argv) 226main (int argc, char **argv)
216{ 227{
217 if (0 != GNUNET_TESTING_peer_run ("test_set_api", 228 if (0 != GNUNET_TESTING_peer_run ("test_set_union_copy",
218 "test_set.conf", 229 "test_set.conf",
219 &run, NULL)) 230 &run, NULL))
220 { 231 {