summaryrefslogtreecommitdiff
path: root/src/tests/eina/eina_test_value.c
diff options
context:
space:
mode:
authorGuilherme Iscaro <iscaro@profusion.mobi>2017-08-17 14:36:47 -0300
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-23 18:32:13 -0300
commit6cbfe100d5f2d6771e9f68883a5c81ee8735e710 (patch)
tree475b0e418967ddc5f99807f91514abc01be6b1d0 /src/tests/eina/eina_test_value.c
parent3ed176370d077ede61c75d61e9f7ecf83d84cd11 (diff)
Eina_Value type EINA_value.
Diffstat (limited to 'src/tests/eina/eina_test_value.c')
-rw-r--r--src/tests/eina/eina_test_value.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_value.c b/src/tests/eina/eina_test_value.c
index df0771008c..9bdcc4c120 100644
--- a/src/tests/eina/eina_test_value.c
+++ b/src/tests/eina/eina_test_value.c
@@ -2873,6 +2873,73 @@ START_TEST(eina_value_test_optional_struct_members)
2873} 2873}
2874END_TEST 2874END_TEST
2875 2875
2876START_TEST(eina_value_test_value)
2877{
2878 Eina_Value composed, v;
2879 const int ivalue = 3500;
2880 int i;
2881 const char *str;
2882
2883 eina_init();
2884
2885 fail_if(!eina_value_setup(&composed, EINA_VALUE_TYPE_VALUE));
2886 fail_if(!eina_value_setup(&v, EINA_VALUE_TYPE_INT));
2887 fail_if(!eina_value_set(&v, ivalue));
2888 fail_if(!eina_value_set(&composed, v));
2889
2890 fail_if(!eina_value_get(&composed, &v));
2891 fail_if(!eina_value_get(&v, &i));
2892 fail_if(i != ivalue);
2893
2894 eina_value_flush(&v);
2895 fail_if(!eina_value_setup(&v, EINA_VALUE_TYPE_STRING));
2896 fail_if(!eina_value_convert(&composed, &v));
2897 fail_if(!eina_value_get(&v, &str));
2898 ck_assert_str_eq(str, "3500");
2899
2900 eina_value_flush(&v);
2901 fail_if(!eina_value_copy(&composed, &v));
2902 fail_if(eina_value_compare(&composed, &v));
2903
2904 eina_value_flush(&v);
2905 eina_value_flush(&composed);
2906 eina_shutdown();
2907}
2908END_TEST
2909
2910START_TEST(eina_value_test_value_string)
2911{
2912 Eina_Value composed, v, str_v;
2913 const char *msg = "A string", *str;
2914
2915 eina_init();
2916
2917 fail_if(!eina_value_setup(&composed, EINA_VALUE_TYPE_VALUE));
2918 fail_if(!eina_value_setup(&v, EINA_VALUE_TYPE_STRING));
2919 fail_if(!eina_value_set(&v, msg));
2920 fail_if(!eina_value_set(&composed, v));
2921
2922 eina_value_flush(&v);
2923 fail_if(!eina_value_copy(&composed, &v));
2924 fail_if(eina_value_compare(&composed, &v));
2925
2926 fail_if(!eina_value_get(&composed, &str_v));
2927 fail_if(!eina_value_get(&str_v, &str));
2928 ck_assert_str_eq(str, msg);
2929 eina_value_flush(&str_v);
2930
2931 str = NULL;
2932 fail_if(!eina_value_get(&v, &str_v));
2933 fail_if(!eina_value_get(&str_v, &str));
2934 ck_assert_str_eq(str, msg);
2935
2936 eina_value_flush(&str_v);
2937 eina_value_flush(&composed);
2938 eina_value_flush(&v);
2939 eina_shutdown();
2940}
2941END_TEST
2942
2876void 2943void
2877eina_test_value(TCase *tc) 2944eina_test_value(TCase *tc)
2878{ 2945{
@@ -2901,4 +2968,6 @@ eina_test_value(TCase *tc)
2901 tcase_add_test(tc, eina_value_test_optional_int); 2968 tcase_add_test(tc, eina_value_test_optional_int);
2902 tcase_add_test(tc, eina_value_test_optional_string); 2969 tcase_add_test(tc, eina_value_test_optional_string);
2903 tcase_add_test(tc, eina_value_test_optional_struct_members); 2970 tcase_add_test(tc, eina_value_test_optional_struct_members);
2971 tcase_add_test(tc, eina_value_test_value);
2972 tcase_add_test(tc, eina_value_test_value_string);
2904} 2973}