Skip to content

Commit dfda7fc

Browse files
Add test involving Passthrough leaper
1 parent e7195a7 commit dfda7fc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/test.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,29 @@ fn leapjoin_from_extend() {
193193

194194
assert_eq!(variable.elements, vec![(2, 2), (2, 4)]);
195195
}
196+
197+
#[test]
198+
fn passthrough_leaper() {
199+
let mut iteration = Iteration::new();
200+
201+
let variable = iteration.variable::<(u32, u32)>("variable");
202+
variable.extend((0..10).map(|i| (i, i)));
203+
204+
while iteration.changed() {
205+
variable.from_leapjoin(
206+
&variable,
207+
(
208+
crate::passthrough(), // Without this, the test would fail at runtime.
209+
crate::PrefixFilter::from(|&(i, _)| i <= 20),
210+
),
211+
|&(i, j), ()| (2*i, 2*j),
212+
);
213+
}
214+
215+
let variable = variable.complete();
216+
217+
let mut expected: Vec<_> = (0..10).map(|i| (i, i)).collect();
218+
expected.extend((10..20).filter_map(|i| (i%2 == 0).then(|| (i, i))));
219+
expected.extend((20..=40).filter_map(|i| (i%4 == 0).then(|| (i, i))));
220+
assert_eq!(&*variable, &expected);
221+
}

0 commit comments

Comments
 (0)