Skip to content

Commit b077a76

Browse files
committed
tests BUGFIX sort cb return value must be compared with 0
... instead of expecting only -1, 0, or 1. Refs #2222
1 parent 350ed0d commit b077a76

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

tests/utests/types/binary.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ test_plugin_sort(void **state)
327327
v2 = "YWhv"; /* aho */
328328
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
329329
0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
330-
assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
331-
assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
330+
assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
331+
assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
332332
type->free(UTEST_LYCTX, &val1);
333333
type->free(UTEST_LYCTX, &val2);
334334
}

tests/utests/types/enumeration.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ test_plugin_sort(void **state)
108108
v2 = "black";
109109
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
110110
0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
111-
assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
111+
assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
112112
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
113-
assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
113+
assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
114114
type->free(UTEST_LYCTX, &val1);
115115
type->free(UTEST_LYCTX, &val2);
116116
}

tests/utests/types/leafref.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ test_plugin_sort(void **state)
239239
v2 = "str2";
240240
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
241241
0, LY_VALUE_JSON, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
242-
assert_int_equal(-1, type->sort(UTEST_LYCTX, &val1, &val2));
242+
assert_true(0 > type->sort(UTEST_LYCTX, &val1, &val2));
243243
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
244-
assert_int_equal(1, type->sort(UTEST_LYCTX, &val2, &val1));
244+
assert_true(0 < type->sort(UTEST_LYCTX, &val2, &val1));
245245
type->free(UTEST_LYCTX, &val1);
246246
type->free(UTEST_LYCTX, &val2);
247247
}

tests/utests/types/union.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ test_plugin_sort(void **state)
168168
v2 = "-1";
169169
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
170170
0, LY_VALUE_JSON, NULL, LYD_VALHINT_DECNUM, NULL, &val2, NULL, &err));
171-
assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
171+
assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
172172
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
173-
assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
173+
assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
174174
type->free(UTEST_LYCTX, &val1);
175175
type->free(UTEST_LYCTX, &val2);
176176

@@ -180,8 +180,8 @@ test_plugin_sort(void **state)
180180
v2 = "-2";
181181
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
182182
0, LY_VALUE_JSON, NULL, LYD_VALHINT_DECNUM, NULL, &val2, NULL, &err));
183-
assert_int_equal(1, type->sort(UTEST_LYCTX, &val1, &val2));
184-
assert_int_equal(-1, type->sort(UTEST_LYCTX, &val2, &val1));
183+
assert_true(0 < type->sort(UTEST_LYCTX, &val1, &val2));
184+
assert_true(0 > type->sort(UTEST_LYCTX, &val2, &val1));
185185
type->free(UTEST_LYCTX, &val1);
186186
type->free(UTEST_LYCTX, &val2);
187187
}

tests/utests/types/yang_types.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ test_sort(void **state)
301301
v2 = "2005-05-25T23:15:15.0001Z";
302302
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, v2, strlen(v2),
303303
0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &val2, NULL, &err));
304-
assert_int_equal(-1, type->sort(UTEST_LYCTX, &val1, &val2));
305-
assert_int_equal(1, type->sort(UTEST_LYCTX, &val2, &val1));
304+
assert_true(0 > type->sort(UTEST_LYCTX, &val1, &val2));
305+
assert_true(0 < type->sort(UTEST_LYCTX, &val2, &val1));
306306
assert_int_equal(0, type->sort(UTEST_LYCTX, &val1, &val1));
307307
type->free(UTEST_LYCTX, &val1);
308308
type->free(UTEST_LYCTX, &val2);

0 commit comments

Comments
 (0)