]>
Commit | Line | Data |
---|---|---|
b4b594a3 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='basic tests for priority queue implementation' | |
4 | . ./test-lib.sh | |
5 | ||
6 | cat >expect <<'EOF' | |
7 | 1 | |
8 | 2 | |
9 | 3 | |
10 | 4 | |
11 | 5 | |
12 | 5 | |
13 | 6 | |
14 | 7 | |
15 | 8 | |
16 | 9 | |
17 | 10 | |
18 | EOF | |
19 | test_expect_success 'basic ordering' ' | |
15b75817 | 20 | test-tool prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual && |
b4b594a3 JH |
21 | test_cmp expect actual |
22 | ' | |
23 | ||
24 | cat >expect <<'EOF' | |
25 | 2 | |
26 | 3 | |
27 | 4 | |
28 | 1 | |
29 | 5 | |
30 | 6 | |
31 | EOF | |
32 | test_expect_success 'mixed put and get' ' | |
15b75817 | 33 | test-tool prio-queue 6 2 4 get 5 3 get get 1 dump >actual && |
b4b594a3 JH |
34 | test_cmp expect actual |
35 | ' | |
36 | ||
37 | cat >expect <<'EOF' | |
38 | 1 | |
39 | 2 | |
40 | NULL | |
41 | 1 | |
42 | 2 | |
43 | NULL | |
44 | EOF | |
45 | test_expect_success 'notice empty queue' ' | |
15b75817 | 46 | test-tool prio-queue 1 2 get get get 1 2 get get get >actual && |
b4b594a3 JH |
47 | test_cmp expect actual |
48 | ' | |
49 | ||
aca4240f DS |
50 | cat >expect <<'EOF' |
51 | 3 | |
52 | 2 | |
53 | 6 | |
54 | 4 | |
55 | 5 | |
56 | 1 | |
57 | 8 | |
58 | EOF | |
59 | test_expect_success 'stack order' ' | |
60 | test-tool prio-queue stack 8 1 5 4 6 2 3 dump >actual && | |
61 | test_cmp expect actual | |
62 | ' | |
63 | ||
b4b594a3 | 64 | test_done |