Skip to content

Commit 7f41cd6

Browse files
committed
Test added
1 parent 0c49211 commit 7f41cd6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/sorter.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <stdio.h>
2+
3+
#include "../include/obfus.h"
4+
5+
void main() {
6+
int arr[] = {
7+
1524, 5772, 9906, 9432, 5306, 5762, 4371, 9723, 9262, 9163, 548, 3736, 3436, 7444,
8+
9943, 811, 4215, 4729, 2628, 4105, 4037, 4083, 5397, 8664, 9460, 1784, 3785, 3067,
9+
9358, 7312, 8307, 1937, 4282, 3470, 5392, 9720, 4800, 4886, 8412, 7641, 9326, 3347,
10+
2090, 4488, 9799, 7541, 316, 9869, 2501, 4003, 9095, 784, 1351, 1507, 8407, 5526,
11+
9557, 5974, 9651, 5200, 4325, 2102, 9228, 6673, 4274, 7979, 5030, 2421, 3103, 9062,
12+
4841, 2096, 3501, 8380, 2422, 6122, 6033, 855, 6767, 4297, 8859, 7955, 176, 8883,
13+
5556, 4988, 6100, 6091, 9274, 8378, 7696, 8531, 3927, 8836, 6839, 3592, 2739, 3150,
14+
7955, 2887, 5002, 3536, 5918, 627, 5063, 6466, 7177, 5152, 5581, 4314, 1617, 8122,
15+
4920, 3178, 7696, 4357, 6206, 2738, 529, 6669, 5035, 7676, 1470, 616, 1784, 2596,
16+
6340, 1917, 7703, 7437, 9938, 7014, 8238, 5793, 758, 9369, 6611, 8693, 4445, 2894,
17+
7870, 9801, 2581, 3915, 938, 184, 8947, 329, 9964, 2499, 8741, 3345, 8551, 7111,
18+
3362, 1029, 3947};
19+
20+
int n = sizeof(arr) / sizeof(arr[0]);
21+
22+
int key, j;
23+
for (int i = 1; i < n; i++) {
24+
key = arr[i];
25+
j = i - 1;
26+
while (j >= 0 && arr[j] > key) {
27+
arr[j + 1] = arr[j];
28+
j = j - 1;
29+
}
30+
arr[j + 1] = key;
31+
}
32+
33+
for (int f = 0; f < n; f++) printf("%d ", arr[f]);
34+
printf("\n");
35+
}

0 commit comments

Comments
 (0)