1 /*
2 * Copyright (C) 2016-2021 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 * This code is a complete clean re-write of the stress tool by
19 * Colin Ian King <colin.king@canonical.com> and attempts to be
20 * backwardly compatible with the stress tool by Amos Waterland
21 * <apw@rossby.metr.ou.edu> but has more stress tests and more
22 * functionality.
23 *
24 */
25 #include <string.h>
26 #if defined(__APPLE__) || \
27 defined(__DragonFly__) || \
28 defined(__FreeBSD__) || \
29 defined(__NetBSD__) || \
30 defined(__OpenBSD__)
31 #include <stdlib.h>
32 #else
33 #include <bsd/stdlib.h>
34 #endif
35
intcmp(const void * p1,const void * p2)36 static int intcmp(const void *p1, const void *p2)
37 {
38 int *i1 = (int *)p1;
39 int *i2 = (int *)p2;
40
41 return *i1 - *i2;
42 }
43
main(void)44 int main(void)
45 {
46 int data[64];
47 int rc;
48
49 (void)memset(data, 0, sizeof(data));
50
51 rc = heapsort(data, 64, sizeof(*data), intcmp);
52 (void)rc;
53 rc = mergesort(data, 64, sizeof(*data), intcmp);
54 (void)rc;
55 rc = radixsort(NULL, 0, NULL, 0);
56 (void)rc;
57
58 return 0;
59 }
60