Skip to content

Commit

Permalink
Added a testcase for 3 repeated iobjs
Browse files Browse the repository at this point in the history
  • Loading branch information
YM162 committed Jun 1, 2024
1 parent f422074 commit 3f7f8af
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Binary file not shown.
9 changes: 9 additions & 0 deletions gulagcleaner_rs/src/models/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ pub fn find_iobj_pairs(first_page: &[(u32, u16)], second_page: &[(u32, u16)]) ->
let c: Vec<&&(u32, u16)> = unique_first_page
.intersection(&unique_second_page)
.collect();
if c.len() == 3 {
//We return the first two in the order they appear in the first page
let first_index = first_page.iter().position(|&r| r == **c[0]).unwrap();
let second_index = first_page.iter().position(|&r| r == **c[1]).unwrap();
let third_index = first_page.iter().position(|&r| r == **c[2]).unwrap();
let mut indexes = [first_index, second_index, third_index];
indexes.sort();
return (indexes[0], indexes[1]);
}
if c.len() != 2 {
return (0, 0);
}
Expand Down
8 changes: 8 additions & 0 deletions gulagcleaner_rs/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ fn test_wuolah_pdf() {
});
}

#[test]
fn test_010624_wuolah_pdf() {
run_test_for_config(&TestConfig {
input_path: "example_docs/wuolah-010624-example.pdf",
output_filename: "wuolah_010624_clean.pdf",
});
}

#[test]
fn test_studocu_pdf() {
run_test_for_config(&TestConfig {
Expand Down

0 comments on commit 3f7f8af

Please sign in to comment.