mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
Fix: rust binding bench count error
This commit is contained in:
parent
d3592eb7cd
commit
379ab6ce73
@ -20,6 +20,7 @@ macro_rules! perform_check {
|
||||
|
||||
let mid_ip = (start_ip >> 1) + (end_ip >> 1);
|
||||
|
||||
let mut checked = 0;
|
||||
let checks = [
|
||||
start_ip,
|
||||
(start_ip >> 1) + (mid_ip >> 1),
|
||||
@ -28,15 +29,16 @@ macro_rules! perform_check {
|
||||
end_ip,
|
||||
];
|
||||
for ip in checks.iter() {
|
||||
if *ip > start_ip || *ip < end_ip {
|
||||
if *ip < start_ip || *ip > end_ip {
|
||||
// IP not in start - end ip
|
||||
// This happens when start ip equals end ip
|
||||
continue;
|
||||
}
|
||||
let result = $searcher.search(*ip).unwrap();
|
||||
assert_eq!(result.as_str(), $check);
|
||||
checked += 1;
|
||||
}
|
||||
checks.len()
|
||||
checked
|
||||
}};
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user