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