eina: add tests for Eina_Value utility function eina_value_*_get.
authorCedric BAIL <cedric.bail@free.fr>
Thu, 3 Jan 2019 02:40:02 +0000 (18:40 -0800)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jan 2019 05:20:19 +0000 (14:20 +0900)
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7649

src/tests/eina/eina_test_value.c

index caa47b7..3ab9df1 100644 (file)
@@ -53,30 +53,45 @@ EFL_START_TEST(eina_value_test_simple)
    fail_unless(eina_value_set(value, 'x'));
    fail_unless(eina_value_get(value, &c));
    fail_unless(c == 'x');
+   fail_unless(eina_value_char_get(value, &c));
+   fail_if(eina_value_double_get(value, &d));
+   fail_unless(c == 'x');
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_SHORT));
    fail_unless(eina_value_set(value, 300));
    fail_unless(eina_value_get(value, &s));
    fail_unless(s == 300);
+   fail_unless(eina_value_short_get(value, &s));
+   fail_if(eina_value_char_get(value, &c));
+   fail_unless(s == 300);
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_INT));
    fail_unless(eina_value_set(value, -12345));
    fail_unless(eina_value_get(value, &i));
    fail_unless(i == -12345);
+   fail_unless(eina_value_int_get(value, &i));
+   fail_if(eina_value_short_get(value, &s));
+   fail_unless(i == -12345);
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_LONG));
    fail_unless(eina_value_set(value, 0xb33f));
    fail_unless(eina_value_get(value, &l));
    fail_unless(l == 0xb33f);
+   fail_unless(eina_value_long_get(value, &l));
+   fail_if(eina_value_int_get(value, &i));
+   fail_unless(l == 0xb33f);
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_INT64));
    fail_unless(eina_value_set(value, 0x0011223344556677));
    fail_unless(eina_value_get(value, &i64));
    fail_unless(i64 == 0x0011223344556677);
+   fail_unless(eina_value_int64_get(value, &i64));
+   fail_if(eina_value_long_get(value, &l));
+   fail_unless(i64 == 0x0011223344556677);
    eina_value_flush(value);
 
    /* unsigned: */
@@ -85,30 +100,45 @@ EFL_START_TEST(eina_value_test_simple)
    fail_unless(eina_value_set(value, 200));
    fail_unless(eina_value_get(value, &uc));
    fail_unless(uc == 200);
+   fail_unless(eina_value_uchar_get(value, &uc));
+   fail_if(eina_value_int64_get(value, &i64));
+   fail_unless(uc == 200);
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_USHORT));
    fail_unless(eina_value_set(value, 65535));
    fail_unless(eina_value_get(value, &us));
    fail_unless(us == 65535);
+   fail_unless(eina_value_ushort_get(value, &us));
+   fail_if(eina_value_uchar_get(value, &uc));
+   fail_unless(us == 65535);
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_UINT));
    fail_unless(eina_value_set(value, 4000000000U));
    fail_unless(eina_value_get(value, &ui));
    fail_unless(ui == 4000000000U);
+   fail_unless(eina_value_uint_get(value, &ui));
+   fail_if(eina_value_ushort_get(value, &us));
+   fail_unless(ui == 4000000000U);
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_ULONG));
    fail_unless(eina_value_set(value, 3000000001UL));
    fail_unless(eina_value_get(value, &ul));
    fail_unless(ul == 3000000001UL);
+   fail_unless(eina_value_ulong_get(value, &ul));
+   fail_if(eina_value_uint_get(value, &ui));
+   fail_unless(ul == 3000000001UL);
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_UINT64));
    fail_unless(eina_value_set(value, 0x1122334455667788));
    fail_unless(eina_value_get(value, &u64));
    fail_unless(u64 == 0x1122334455667788);
+   fail_unless(eina_value_uint64_get(value, &u64));
+   fail_if(eina_value_ulong_get(value, &ul));
+   fail_unless(u64 == 0x1122334455667788);
    eina_value_flush(value);
 
    /* floating point */
@@ -116,12 +146,18 @@ EFL_START_TEST(eina_value_test_simple)
    fail_unless(eina_value_set(value, 0.1234));
    fail_unless(eina_value_get(value, &f));
    fail_unless(CHECK_FP(0.1234, f));
+   fail_unless(eina_value_float_get(value, &f));
+   fail_if(eina_value_uint64_get(value, &u64));
+   fail_unless(CHECK_FP(0.1234, f));
    eina_value_flush(value);
 
    fail_unless(eina_value_setup(value, EINA_VALUE_TYPE_DOUBLE));
    fail_unless(eina_value_set(value, 34567.8));
    fail_unless(eina_value_get(value, &d));
    fail_unless(CHECK_FP(34567.8, d));
+   fail_unless(eina_value_double_get(value, &d));
+   fail_if(eina_value_float_get(value, &f));
+   fail_unless(CHECK_FP(34567.8, d));
    eina_value_flush(value);
 
    eina_value_free(value);