summaryrefslogtreecommitdiff
path: root/src/tests/eina/eina_test_value.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-01-02 18:40:02 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-23 10:54:03 -0800
commitd4ab2119681fec87bf1f755d9a0e225b6dbcaa72 (patch)
treea8d7a0a179df9fc9033f877afd2b5f5a9a5fcf7b /src/tests/eina/eina_test_value.c
parent7b2ef21b909d5cf0066d4cdca4e640d1ce891688 (diff)
eina: add tests for Eina_Value utility function eina_value_*_get.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7649
Diffstat (limited to '')
-rw-r--r--src/tests/eina/eina_test_value.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_value.c b/src/tests/eina/eina_test_value.c
index caa47b7cee..3ab9df1827 100644
--- a/src/tests/eina/eina_test_value.c
+++ b/src/tests/eina/eina_test_value.c
@@ -53,30 +53,45 @@ EFL_START_TEST(eina_value_test_simple)
53 fail_unless(eina_value_set(value, 'x')); 53 fail_unless(eina_value_set(value, 'x'));
54 fail_unless(eina_value_get(value, &c)); 54 fail_unless(eina_value_get(value, &c));
55 fail_unless(c == 'x'); 55 fail_unless(c == 'x');
56 fail_unless(eina_value_char_get(value, &c));
57 fail_if(eina_value_double_get(value, &d));
58 fail_unless(c == 'x');
56 eina_value_flush(value); 59 eina_value_flush(value);
57 60
58 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_SHORT)); 61 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_SHORT));
59 fail_unless(eina_value_set(value, 300)); 62 fail_unless(eina_value_set(value, 300));
60 fail_unless(eina_value_get(value, &s)); 63 fail_unless(eina_value_get(value, &s));
61 fail_unless(s == 300); 64 fail_unless(s == 300);
65 fail_unless(eina_value_short_get(value, &s));
66 fail_if(eina_value_char_get(value, &c));
67 fail_unless(s == 300);
62 eina_value_flush(value); 68 eina_value_flush(value);
63 69
64 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_INT)); 70 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_INT));
65 fail_unless(eina_value_set(value, -12345)); 71 fail_unless(eina_value_set(value, -12345));
66 fail_unless(eina_value_get(value, &i)); 72 fail_unless(eina_value_get(value, &i));
67 fail_unless(i == -12345); 73 fail_unless(i == -12345);
74 fail_unless(eina_value_int_get(value, &i));
75 fail_if(eina_value_short_get(value, &s));
76 fail_unless(i == -12345);
68 eina_value_flush(value); 77 eina_value_flush(value);
69 78
70 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_LONG)); 79 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_LONG));
71 fail_unless(eina_value_set(value, 0xb33f)); 80 fail_unless(eina_value_set(value, 0xb33f));
72 fail_unless(eina_value_get(value, &l)); 81 fail_unless(eina_value_get(value, &l));
73 fail_unless(l == 0xb33f); 82 fail_unless(l == 0xb33f);
83 fail_unless(eina_value_long_get(value, &l));
84 fail_if(eina_value_int_get(value, &i));
85 fail_unless(l == 0xb33f);
74 eina_value_flush(value); 86 eina_value_flush(value);
75 87
76 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_INT64)); 88 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_INT64));
77 fail_unless(eina_value_set(value, 0x0011223344556677)); 89 fail_unless(eina_value_set(value, 0x0011223344556677));
78 fail_unless(eina_value_get(value, &i64)); 90 fail_unless(eina_value_get(value, &i64));
79 fail_unless(i64 == 0x0011223344556677); 91 fail_unless(i64 == 0x0011223344556677);
92 fail_unless(eina_value_int64_get(value, &i64));
93 fail_if(eina_value_long_get(value, &l));
94 fail_unless(i64 == 0x0011223344556677);
80 eina_value_flush(value); 95 eina_value_flush(value);
81 96
82 /* unsigned: */ 97 /* unsigned: */
@@ -85,30 +100,45 @@ EFL_START_TEST(eina_value_test_simple)
85 fail_unless(eina_value_set(value, 200)); 100 fail_unless(eina_value_set(value, 200));
86 fail_unless(eina_value_get(value, &uc)); 101 fail_unless(eina_value_get(value, &uc));
87 fail_unless(uc == 200); 102 fail_unless(uc == 200);
103 fail_unless(eina_value_uchar_get(value, &uc));
104 fail_if(eina_value_int64_get(value, &i64));
105 fail_unless(uc == 200);
88 eina_value_flush(value); 106 eina_value_flush(value);
89 107
90 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_USHORT)); 108 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_USHORT));
91 fail_unless(eina_value_set(value, 65535)); 109 fail_unless(eina_value_set(value, 65535));
92 fail_unless(eina_value_get(value, &us)); 110 fail_unless(eina_value_get(value, &us));
93 fail_unless(us == 65535); 111 fail_unless(us == 65535);
112 fail_unless(eina_value_ushort_get(value, &us));
113 fail_if(eina_value_uchar_get(value, &uc));
114 fail_unless(us == 65535);
94 eina_value_flush(value); 115 eina_value_flush(value);
95 116
96 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_UINT)); 117 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_UINT));
97 fail_unless(eina_value_set(value, 4000000000U)); 118 fail_unless(eina_value_set(value, 4000000000U));
98 fail_unless(eina_value_get(value, &ui)); 119 fail_unless(eina_value_get(value, &ui));
99 fail_unless(ui == 4000000000U); 120 fail_unless(ui == 4000000000U);
121 fail_unless(eina_value_uint_get(value, &ui));
122 fail_if(eina_value_ushort_get(value, &us));
123 fail_unless(ui == 4000000000U);
100 eina_value_flush(value); 124 eina_value_flush(value);
101 125
102 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_ULONG)); 126 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_ULONG));
103 fail_unless(eina_value_set(value, 3000000001UL)); 127 fail_unless(eina_value_set(value, 3000000001UL));
104 fail_unless(eina_value_get(value, &ul)); 128 fail_unless(eina_value_get(value, &ul));
105 fail_unless(ul == 3000000001UL); 129 fail_unless(ul == 3000000001UL);
130 fail_unless(eina_value_ulong_get(value, &ul));
131 fail_if(eina_value_uint_get(value, &ui));
132 fail_unless(ul == 3000000001UL);
106 eina_value_flush(value); 133 eina_value_flush(value);
107 134
108 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_UINT64)); 135 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_UINT64));
109 fail_unless(eina_value_set(value, 0x1122334455667788)); 136 fail_unless(eina_value_set(value, 0x1122334455667788));
110 fail_unless(eina_value_get(value, &u64)); 137 fail_unless(eina_value_get(value, &u64));
111 fail_unless(u64 == 0x1122334455667788); 138 fail_unless(u64 == 0x1122334455667788);
139 fail_unless(eina_value_uint64_get(value, &u64));
140 fail_if(eina_value_ulong_get(value, &ul));
141 fail_unless(u64 == 0x1122334455667788);
112 eina_value_flush(value); 142 eina_value_flush(value);
113 143
114 /* floating point */ 144 /* floating point */
@@ -116,12 +146,18 @@ EFL_START_TEST(eina_value_test_simple)
116 fail_unless(eina_value_set(value, 0.1234)); 146 fail_unless(eina_value_set(value, 0.1234));
117 fail_unless(eina_value_get(value, &f)); 147 fail_unless(eina_value_get(value, &f));
118 fail_unless(CHECK_FP(0.1234, f)); 148 fail_unless(CHECK_FP(0.1234, f));
149 fail_unless(eina_value_float_get(value, &f));
150 fail_if(eina_value_uint64_get(value, &u64));
151 fail_unless(CHECK_FP(0.1234, f));
119 eina_value_flush(value); 152 eina_value_flush(value);
120 153
121 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_DOUBLE)); 154 fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_DOUBLE));
122 fail_unless(eina_value_set(value, 34567.8)); 155 fail_unless(eina_value_set(value, 34567.8));
123 fail_unless(eina_value_get(value, &d)); 156 fail_unless(eina_value_get(value, &d));
124 fail_unless(CHECK_FP(34567.8, d)); 157 fail_unless(CHECK_FP(34567.8, d));
158 fail_unless(eina_value_double_get(value, &d));
159 fail_if(eina_value_float_get(value, &f));
160 fail_unless(CHECK_FP(34567.8, d));
125 eina_value_flush(value); 161 eina_value_flush(value);
126 162
127 eina_value_free(value); 163 eina_value_free(value);