tests BUGFIX sort cb return value must be compared with 0
... instead of expecting only -1, 0, or 1.
Refs #2222
diff --git a/tests/utests/types/binary.c b/tests/utests/types/binary.c
index 4d0cfbc..efdc8f1 100644
--- a/tests/utests/types/binary.c
+++ b/tests/utests/types/binary.c
@@ -327,8 +327,8 @@
v2 = "YWhv"; /* aho */
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
- assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
- assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
+ assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
+ assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
type->free(UTEST_LYCTX, &val1);
type->free(UTEST_LYCTX, &val2);
}
diff --git a/tests/utests/types/enumeration.c b/tests/utests/types/enumeration.c
index 0d42c54..8ff1c8c 100644
--- a/tests/utests/types/enumeration.c
+++ b/tests/utests/types/enumeration.c
@@ -108,9 +108,9 @@
v2 = "black";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
- assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
+ assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
- assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
+ assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
type->free(UTEST_LYCTX, &val1);
type->free(UTEST_LYCTX, &val2);
}
diff --git a/tests/utests/types/leafref.c b/tests/utests/types/leafref.c
index 81e8ded..002763c 100644
--- a/tests/utests/types/leafref.c
+++ b/tests/utests/types/leafref.c
@@ -239,9 +239,9 @@
v2 = "str2";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
0, LY_VALUE_JSON, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
- assert_int_equal(-1, type->sort(UTEST_LYCTX, &val1, &val2));
+ assert_true(0 > type->sort(UTEST_LYCTX, &val1, &val2));
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
- assert_int_equal(1, type->sort(UTEST_LYCTX, &val2, &val1));
+ assert_true(0 < type->sort(UTEST_LYCTX, &val2, &val1));
type->free(UTEST_LYCTX, &val1);
type->free(UTEST_LYCTX, &val2);
}
diff --git a/tests/utests/types/union.c b/tests/utests/types/union.c
index 0d6ad21..50593dc 100644
--- a/tests/utests/types/union.c
+++ b/tests/utests/types/union.c
@@ -168,9 +168,9 @@
v2 = "-1";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
0, LY_VALUE_JSON, NULL, LYD_VALHINT_DECNUM, NULL, &val2, NULL, &err));
- assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
+ assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
- assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
+ assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
type->free(UTEST_LYCTX, &val1);
type->free(UTEST_LYCTX, &val2);
@@ -180,8 +180,8 @@
v2 = "-2";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
0, LY_VALUE_JSON, NULL, LYD_VALHINT_DECNUM, NULL, &val2, NULL, &err));
- assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
- assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
+ assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
+ assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
type->free(UTEST_LYCTX, &val1);
type->free(UTEST_LYCTX, &val2);
}
diff --git a/tests/utests/types/yang_types.c b/tests/utests/types/yang_types.c
index 42e1f32..f79238e 100644
--- a/tests/utests/types/yang_types.c
+++ b/tests/utests/types/yang_types.c
@@ -301,8 +301,8 @@
v2 = "2005-05-25T23:15:15.0001Z";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
- assert_int_equal(-1, type->sort(UTEST_LYCTX, &val1, &val2));
- assert_int_equal(1, type->sort(UTEST_LYCTX, &val2, &val1));
+ assert_true(0 > type->sort(UTEST_LYCTX, &val1, &val2));
+ assert_true(0 < type->sort(UTEST_LYCTX, &val2, &val1));
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
type->free(UTEST_LYCTX, &val1);
type->free(UTEST_LYCTX, &val2);