2 * Unix SMB/CIFS implementation.
4 * Copyright (C) 2018 Andreas Schneider <asn@samba.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 static int cmp_integer(int *a
, int *b
, void *opaque
)
30 if (a
== NULL
|| b
== NULL
) {
45 static void test_ldb_qsort(void **state
)
47 int a
[6] = { 6, 3, 2, 7, 9, 4 };
49 ldb_qsort(a
, 6, sizeof(int), NULL
, (ldb_qsort_cmp_fn_t
)cmp_integer
);
51 assert_int_equal(a
[0], 2);
52 assert_int_equal(a
[1], 3);
53 assert_int_equal(a
[2], 4);
54 assert_int_equal(a
[3], 6);
55 assert_int_equal(a
[4], 7);
56 assert_int_equal(a
[5], 9);
60 const struct CMUnitTest tests
[] = {
61 cmocka_unit_test(test_ldb_qsort
),
64 cmocka_set_message_output(CM_OUTPUT_SUBUNIT
);
65 return cmocka_run_group_tests(tests
, NULL
, NULL
);