summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_test_general.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-05-28 17:47:33 +0100
committerTom Hacohen <tom@stosb.com>2015-05-28 17:47:59 +0100
commit52d998f475afd1a8cb18e5990aafd7f1c2b5c41e (patch)
treea392364afb9663810e94776ebde6dc99a52cf2f2 /src/tests/eo/suite/eo_test_general.c
parentd0b58aab54131eb71be6d3289fd11a78b8c9adf5 (diff)
Eo base: Remove the free_func parameter from key_data_set.
This was not really useful and against the Eolian guidelines. While I promised I won't break things until the 27th, I was ill (still am), so I'm giving myself a 1 day pass. :P
Diffstat (limited to '')
-rw-r--r--src/tests/eo/suite/eo_test_general.c42
1 files changed, 3 insertions, 39 deletions
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index 59cb4db92a..47064cf373 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -547,31 +547,21 @@ START_TEST(eo_weak_reference)
547} 547}
548END_TEST 548END_TEST
549 549
550static void
551_fake_free_func(void *data)
552{
553 if (!data)
554 return;
555
556 int *a = data;
557 ++*a;
558}
559
560START_TEST(eo_generic_data) 550START_TEST(eo_generic_data)
561{ 551{
562 eo_init(); 552 eo_init();
563 Eo *obj = eo_add(SIMPLE_CLASS, NULL); 553 Eo *obj = eo_add(SIMPLE_CLASS, NULL);
564 void *data = NULL; 554 void *data = NULL;
565 555
566 eo_do(obj, eo_key_data_set("test1", (void *) 1, NULL)); 556 eo_do(obj, eo_key_data_set("test1", (void *) 1));
567 eo_do(obj, data = eo_key_data_get("test1")); 557 eo_do(obj, data = eo_key_data_get("test1"));
568 fail_if(1 != (intptr_t) data); 558 fail_if(1 != (intptr_t) data);
569 eo_do(obj, eo_key_data_del("test1")); 559 eo_do(obj, eo_key_data_del("test1"));
570 eo_do(obj, data = eo_key_data_get("test1")); 560 eo_do(obj, data = eo_key_data_get("test1"));
571 fail_if(data); 561 fail_if(data);
572 562
573 eo_do(obj, eo_key_data_set("test1", (void *) 1, NULL)); 563 eo_do(obj, eo_key_data_set("test1", (void *) 1));
574 eo_do(obj, eo_key_data_set("test2", (void *) 2, NULL)); 564 eo_do(obj, eo_key_data_set("test2", (void *) 2));
575 eo_do(obj, data = eo_key_data_get("test1")); 565 eo_do(obj, data = eo_key_data_get("test1"));
576 fail_if(1 != (intptr_t) data); 566 fail_if(1 != (intptr_t) data);
577 eo_do(obj, data = eo_key_data_get("test2")); 567 eo_do(obj, data = eo_key_data_get("test2"));
@@ -589,33 +579,7 @@ START_TEST(eo_generic_data)
589 eo_do(obj, data = eo_key_data_get("test1")); 579 eo_do(obj, data = eo_key_data_get("test1"));
590 fail_if(data); 580 fail_if(data);
591 581
592 int a = 0;
593 eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
594 eo_do(obj, data = eo_key_data_get("test3"));
595 fail_if(&a != data);
596 eo_do(obj, eo_key_data_get("test3"));
597 eo_do(obj, eo_key_data_del("test3"));
598 fail_if(a != 1);
599
600 a = 0;
601 eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
602 eo_do(obj, eo_key_data_set("test3", NULL, _fake_free_func));
603 fail_if(a != 1);
604 a = 0;
605 data = (void *) 123;
606 eo_do(obj, eo_key_data_set(NULL, &a, _fake_free_func));
607 eo_do(obj, data = eo_key_data_get(NULL));
608 fail_if(data);
609 eo_do(obj, eo_key_data_del(NULL));
610
611 a = 0;
612 eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
613 eo_do(obj, eo_key_data_set("test3", NULL, NULL));
614 fail_if(a != 1);
615 eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
616
617 eo_unref(obj); 582 eo_unref(obj);
618 fail_if(a != 2);
619 583
620 eo_shutdown(); 584 eo_shutdown();
621} 585}