summaryrefslogtreecommitdiff
path: root/src/tests/eina/eina_test_value.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-01-03 10:17:45 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-23 10:54:07 -0800
commite863a3d28a3bfcc227145a231c73355808e48bf7 (patch)
treebd68246e9fa2cbdc5089e682e6d61adca61b85aa /src/tests/eina/eina_test_value.c
parent1150cce0bf306958ab2b7ae560f26700fd35f38c (diff)
eina: add tests for the new Eina_Value convert functions.
Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D7651
Diffstat (limited to '')
-rw-r--r--src/tests/eina/eina_test_value.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_value.c b/src/tests/eina/eina_test_value.c
index 3ab9df1827..a9e6e47de2 100644
--- a/src/tests/eina/eina_test_value.c
+++ b/src/tests/eina/eina_test_value.c
@@ -55,6 +55,8 @@ EFL_START_TEST(eina_value_test_simple)
55 fail_unless(c == 'x'); 55 fail_unless(c == 'x');
56 fail_unless(eina_value_char_get(value, &c)); 56 fail_unless(eina_value_char_get(value, &c));
57 fail_if(eina_value_double_get(value, &d)); 57 fail_if(eina_value_double_get(value, &d));
58 fail_unless(eina_value_int64_convert(value, &i64));
59 fail_unless(i64 == 'x');
58 fail_unless(c == 'x'); 60 fail_unless(c == 'x');
59 eina_value_flush(value); 61 eina_value_flush(value);
60 62
@@ -64,6 +66,8 @@ EFL_START_TEST(eina_value_test_simple)
64 fail_unless(s == 300); 66 fail_unless(s == 300);
65 fail_unless(eina_value_short_get(value, &s)); 67 fail_unless(eina_value_short_get(value, &s));
66 fail_if(eina_value_char_get(value, &c)); 68 fail_if(eina_value_char_get(value, &c));
69 fail_unless(eina_value_int_convert(value, &i));
70 fail_unless(i == 300);
67 fail_unless(s == 300); 71 fail_unless(s == 300);
68 eina_value_flush(value); 72 eina_value_flush(value);
69 73
@@ -73,6 +77,8 @@ EFL_START_TEST(eina_value_test_simple)
73 fail_unless(i == -12345); 77 fail_unless(i == -12345);
74 fail_unless(eina_value_int_get(value, &i)); 78 fail_unless(eina_value_int_get(value, &i));
75 fail_if(eina_value_short_get(value, &s)); 79 fail_if(eina_value_short_get(value, &s));
80 fail_unless(eina_value_long_convert(value, &l));
81 fail_unless(l == -12345);
76 fail_unless(i == -12345); 82 fail_unless(i == -12345);
77 eina_value_flush(value); 83 eina_value_flush(value);
78 84
@@ -82,6 +88,8 @@ EFL_START_TEST(eina_value_test_simple)
82 fail_unless(l == 0xb33f); 88 fail_unless(l == 0xb33f);
83 fail_unless(eina_value_long_get(value, &l)); 89 fail_unless(eina_value_long_get(value, &l));
84 fail_if(eina_value_int_get(value, &i)); 90 fail_if(eina_value_int_get(value, &i));
91 fail_unless(eina_value_int_convert(value, &i));
92 fail_unless(i == 0xb33f);
85 fail_unless(l == 0xb33f); 93 fail_unless(l == 0xb33f);
86 eina_value_flush(value); 94 eina_value_flush(value);
87 95
@@ -91,6 +99,8 @@ EFL_START_TEST(eina_value_test_simple)
91 fail_unless(i64 == 0x0011223344556677); 99 fail_unless(i64 == 0x0011223344556677);
92 fail_unless(eina_value_int64_get(value, &i64)); 100 fail_unless(eina_value_int64_get(value, &i64));
93 fail_if(eina_value_long_get(value, &l)); 101 fail_if(eina_value_long_get(value, &l));
102 fail_unless(eina_value_long_convert(value, &l));
103 fail_unless(l == 0x0011223344556677);
94 fail_unless(i64 == 0x0011223344556677); 104 fail_unless(i64 == 0x0011223344556677);
95 eina_value_flush(value); 105 eina_value_flush(value);
96 106
@@ -102,6 +112,8 @@ EFL_START_TEST(eina_value_test_simple)
102 fail_unless(uc == 200); 112 fail_unless(uc == 200);
103 fail_unless(eina_value_uchar_get(value, &uc)); 113 fail_unless(eina_value_uchar_get(value, &uc));
104 fail_if(eina_value_int64_get(value, &i64)); 114 fail_if(eina_value_int64_get(value, &i64));
115 fail_unless(eina_value_uint64_convert(value, &u64));
116 fail_unless(u64 == 200);
105 fail_unless(uc == 200); 117 fail_unless(uc == 200);
106 eina_value_flush(value); 118 eina_value_flush(value);
107 119
@@ -111,6 +123,8 @@ EFL_START_TEST(eina_value_test_simple)
111 fail_unless(us == 65535); 123 fail_unless(us == 65535);
112 fail_unless(eina_value_ushort_get(value, &us)); 124 fail_unless(eina_value_ushort_get(value, &us));
113 fail_if(eina_value_uchar_get(value, &uc)); 125 fail_if(eina_value_uchar_get(value, &uc));
126 fail_unless(eina_value_uint_convert(value, &ui));
127 fail_unless(ui == 65535);
114 fail_unless(us == 65535); 128 fail_unless(us == 65535);
115 eina_value_flush(value); 129 eina_value_flush(value);
116 130
@@ -120,6 +134,8 @@ EFL_START_TEST(eina_value_test_simple)
120 fail_unless(ui == 4000000000U); 134 fail_unless(ui == 4000000000U);
121 fail_unless(eina_value_uint_get(value, &ui)); 135 fail_unless(eina_value_uint_get(value, &ui));
122 fail_if(eina_value_ushort_get(value, &us)); 136 fail_if(eina_value_ushort_get(value, &us));
137 fail_unless(eina_value_ulong_convert(value, &ul));
138 fail_unless(ul == 4000000000U);
123 fail_unless(ui == 4000000000U); 139 fail_unless(ui == 4000000000U);
124 eina_value_flush(value); 140 eina_value_flush(value);
125 141
@@ -129,6 +145,8 @@ EFL_START_TEST(eina_value_test_simple)
129 fail_unless(ul == 3000000001UL); 145 fail_unless(ul == 3000000001UL);
130 fail_unless(eina_value_ulong_get(value, &ul)); 146 fail_unless(eina_value_ulong_get(value, &ul));
131 fail_if(eina_value_uint_get(value, &ui)); 147 fail_if(eina_value_uint_get(value, &ui));
148 fail_unless(eina_value_uint64_convert(value, &u64));
149 fail_unless(u64 == 3000000001UL);
132 fail_unless(ul == 3000000001UL); 150 fail_unless(ul == 3000000001UL);
133 eina_value_flush(value); 151 eina_value_flush(value);
134 152
@@ -138,6 +156,8 @@ EFL_START_TEST(eina_value_test_simple)
138 fail_unless(u64 == 0x1122334455667788); 156 fail_unless(u64 == 0x1122334455667788);
139 fail_unless(eina_value_uint64_get(value, &u64)); 157 fail_unless(eina_value_uint64_get(value, &u64));
140 fail_if(eina_value_ulong_get(value, &ul)); 158 fail_if(eina_value_ulong_get(value, &ul));
159 fail_unless(eina_value_ulong_convert(value, &ul));
160 fail_unless(ul == 0x1122334455667788);
141 fail_unless(u64 == 0x1122334455667788); 161 fail_unless(u64 == 0x1122334455667788);
142 eina_value_flush(value); 162 eina_value_flush(value);
143 163
@@ -148,6 +168,8 @@ EFL_START_TEST(eina_value_test_simple)
148 fail_unless(CHECK_FP(0.1234, f)); 168 fail_unless(CHECK_FP(0.1234, f));
149 fail_unless(eina_value_float_get(value, &f)); 169 fail_unless(eina_value_float_get(value, &f));
150 fail_if(eina_value_uint64_get(value, &u64)); 170 fail_if(eina_value_uint64_get(value, &u64));
171 fail_unless(eina_value_double_convert(value, &d));
172 fail_unless(CHECK_FP(0.1234, d));
151 fail_unless(CHECK_FP(0.1234, f)); 173 fail_unless(CHECK_FP(0.1234, f));
152 eina_value_flush(value); 174 eina_value_flush(value);
153 175
@@ -157,7 +179,9 @@ EFL_START_TEST(eina_value_test_simple)
157 fail_unless(CHECK_FP(34567.8, d)); 179 fail_unless(CHECK_FP(34567.8, d));
158 fail_unless(eina_value_double_get(value, &d)); 180 fail_unless(eina_value_double_get(value, &d));
159 fail_if(eina_value_float_get(value, &f)); 181 fail_if(eina_value_float_get(value, &f));
182 fail_unless(eina_value_float_convert(value, &f));
160 fail_unless(CHECK_FP(34567.8, d)); 183 fail_unless(CHECK_FP(34567.8, d));
184 fail_unless(CHECK_FP(34567.8, f));
161 eina_value_flush(value); 185 eina_value_flush(value);
162 186
163 eina_value_free(value); 187 eina_value_free(value);