Debian Codegraph @

src/gallop/tests.rs

raw symbols SCIP
1 use superrust-analyzer cargo timsort 0.1.3 gallop/::Moderust-analyzer cargo timsort 0.1.3 gallop/Mode#;
2 use craterust-analyzer cargo timsort 0.1.3 crate/::{neverrust-analyzer cargo timsort 0.1.3 never()., ord_t_comparatorrust-analyzer cargo timsort 0.1.3 ord_t_comparator().};
3
4 macro_rules! test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both! {
5 ($v:ident, $($x:expr);*) => {{
6 let $v = Mode::Forward;
7 $($x;)*
8 let $v = Mode::Reverse;
9 $($x;)*
10 }}
11 }
12
13 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
14 fn gallop_emptyrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_empty().() {
15 let list: &[usize] = &[];
16 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
17 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&0, list, mode), 0);
18 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&0, list, mode), 0)
19 }
20 }
21
22 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
23 fn gallop_single_greaterrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_single_greater().() {
24 let list: &[usize] = &[1];
25 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
26 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&0, list, mode), 0);
27 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&0, list, mode), 0)
28 }
29 }
30
31 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
32 fn gallop_single_equalrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_single_equal().() {
33 let list: &[usize] = &[1];
34 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
35 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&1, list, mode), 0);
36 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&1, list, mode), 1)
37 }
38 }
39
40 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
41 fn gallop_single_lessrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_single_less().() {
42 let list: &[usize] = &[1];
43 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
44 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&2, list, mode), 1);
45 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&2, list, mode), 1)
46 }
47 }
48
49 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
50 fn gallop_start_lessrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_start_less().() {
51 let list: &[usize] = &[1, 2, 3];
52 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
53 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&0, list, mode), 0);
54 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&0, list, mode), 0)
55 }
56 }
57
58 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
59 fn gallop_start_equalrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_start_equal().() {
60 let list: &[usize] = &[1, 2, 3];
61 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
62 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&1, list, mode), 0);
63 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&1, list, mode), 1)
64 }
65 }
66
67 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
68 fn gallop_middle_equalrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_middle_equal().() {
69 let list: &[usize] = &[1, 2, 3];
70 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
71 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&2, list, mode), 1);
72 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&2, list, mode), 2)
73 }
74 }
75
76 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
77 fn gallop_end_equalrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_end_equal().() {
78 let list: &[usize] = &[1, 2, 3];
79 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
80 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&3, list, mode), 2);
81 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&3, list, mode), 3)
82 }
83 }
84
85 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
86 fn gallop_end_greaterrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_end_greater().() {
87 let list: &[usize] = &[1, 2, 3];
88 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
89 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&4, list, mode), 3);
90 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&4, list, mode), 3)
91 }
92 }
93
94 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
95 fn gallop_end_middle_beforerust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_end_middle_before().() {
96 let list: &[usize] = &[1, 3, 5];
97 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
98 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&2, list, mode), 1);
99 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&2, list, mode), 1)
100 }
101 }
102
103 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
104 fn gallop_end_middle_afterrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_end_middle_after().() {
105 let list: &[usize] = &[1, 3, 5];
106 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
107 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&4, list, mode), 2);
108 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&4, list, mode), 2)
109 }
110 }
111
112 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
113 fn gallop_large_start_beforerust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_start_before().() {
114 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
115 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
116 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&0, list, mode), 0);
117 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&0, list, mode), 0)
118 }
119 }
120
121 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
122 fn gallop_large_start_equalrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_start_equal().() {
123 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
124 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
125 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&1, list, mode), 0);
126 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&1, list, mode), 1)
127 }
128 }
129
130 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
131 fn gallop_large_start_afterrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_start_after().() {
132 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
133 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
134 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&2, list, mode), 1);
135 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&2, list, mode), 1)
136 }
137 }
138
139 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
140 fn gallop_large_center_equalrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_center_equal().() {
141 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
142 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
143 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&21, list, mode), 5);
144 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&21, list, mode), 6)
145 }
146 }
147
148 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
149 fn gallop_large_center_lessrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_center_less().() {
150 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
151 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
152 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&20, list, mode), 5);
153 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&20, list, mode), 5)
154 }
155 }
156
157 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
158 fn gallop_large_end_lessrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_end_less().() {
159 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
160 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
161 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&100, list, mode), 13);
162 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&100, list, mode), 13)
163 }
164 }
165
166 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
167 fn gallop_large_end_equalrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_end_equal().() {
168 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
169 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
170 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&101, list, mode), 13);
171 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&101, list, mode), 14)
172 }
173 }
174
175 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
176 fn gallop_large_end_greaterrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_large_end_greater().() {
177 let list: &[usize] = &[1, 3, 5, 7, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101];
178 test_bothrust-analyzer cargo timsort 0.1.3 gallop/tests/test_both!! {mode,
179 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().(&102, list, mode), 14);
180 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().(&102, list, mode), 14)
181 }
182 }
183
184 fn gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_left().<T: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#>(key: &T, list: &[T], mode: Moderust-analyzer cargo timsort 0.1.3 gallop/Mode#) -> usize {
185 superrust-analyzer cargo timsort 0.1.3 gallop/::gallop_leftrust-analyzer cargo timsort 0.1.3 gallop/gallop_left().(key, list, mode, &ord_t_comparatorrust-analyzer cargo timsort 0.1.3 ord_t_comparator().()).unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(neverrust-analyzer cargo timsort 0.1.3 never().)
186 }
187
188 fn gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/tests/gallop_right().<T: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#>(key: &T, list: &[T], mode: Moderust-analyzer cargo timsort 0.1.3 gallop/Mode#) -> usize {
189 superrust-analyzer cargo timsort 0.1.3 gallop/::gallop_rightrust-analyzer cargo timsort 0.1.3 gallop/gallop_right().(key, list, mode, &ord_t_comparatorrust-analyzer cargo timsort 0.1.3 ord_t_comparator().()).unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(neverrust-analyzer cargo timsort 0.1.3 never().)
190 }