Skip to content

Commit

Permalink
Remove HexAssignments::test_best
Browse files Browse the repository at this point in the history
  • Loading branch information
kurotych committed May 24, 2024
1 parent 3054ebd commit 86d651b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
10 changes: 0 additions & 10 deletions hex_assignments/src/assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,3 @@ impl HexAssignmentsBuilder {
})
}
}

impl HexAssignments {
pub fn test_best() -> Self {
Self {
footfall: Assignment::A,
urbanized: Assignment::A,
landtype: Assignment::A,
}
}
}
29 changes: 19 additions & 10 deletions mobile_verifier/src/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,17 @@ mod test {
use super::*;
use chrono::NaiveDate;
use futures::stream::iter;
use hex_assignments::Assignment;
use hextree::Cell;

fn hex_assignments_mock() -> HexAssignments {
HexAssignments {
footfall: Assignment::A,
urbanized: Assignment::A,
landtype: Assignment::A,
}
}

/// Test to ensure that if there are multiple radios with different signal levels
/// in a given hex, that the one with the highest signal level is chosen.
#[tokio::test]
Expand Down Expand Up @@ -997,7 +1006,7 @@ mod test {
points: CoverageRewardPoints {
coverage_points: dec!(100),
boost_multiplier: NonZeroU32::new(1).unwrap(),
hex_assignments: HexAssignments::test_best(),
hex_assignments: hex_assignments_mock(),
rank: None
},
boosted_hex_info: BoostedHex {
Expand Down Expand Up @@ -1031,7 +1040,7 @@ mod test {
signal_power: 0,
coverage_claim_time,
inserted_at: DateTime::<Utc>::MIN_UTC,
assignments: HexAssignments::test_best(),
assignments: hex_assignments_mock(),
}
}

Expand Down Expand Up @@ -1113,7 +1122,7 @@ mod test {
points: CoverageRewardPoints {
coverage_points: dec!(100),
boost_multiplier: NonZeroU32::new(1).unwrap(),
hex_assignments: HexAssignments::test_best(),
hex_assignments: hex_assignments_mock(),
rank: None
},
boosted_hex_info: BoostedHex {
Expand Down Expand Up @@ -1157,7 +1166,7 @@ mod test {
coverage_points: dec!(4),
rank: Some(dec!(1.0)),
boost_multiplier: NonZeroU32::new(1).unwrap(),
hex_assignments: HexAssignments::test_best(),
hex_assignments: hex_assignments_mock(),
},
boosted_hex_info: BoostedHex {
location: Cell::from_raw(0x8a1fb46622dffff).expect("valid h3 cell"),
Expand All @@ -1171,7 +1180,7 @@ mod test {
coverage_points: dec!(4),
rank: Some(dec!(0.50)),
boost_multiplier: NonZeroU32::new(1).unwrap(),
hex_assignments: HexAssignments::test_best(),
hex_assignments: hex_assignments_mock(),
},
boosted_hex_info: BoostedHex {
location: Cell::from_raw(0x8a1fb46622dffff).expect("valid h3 cell"),
Expand All @@ -1185,7 +1194,7 @@ mod test {
coverage_points: dec!(4),
rank: Some(dec!(0.25)),
boost_multiplier: NonZeroU32::new(1).unwrap(),
hex_assignments: HexAssignments::test_best(),
hex_assignments: hex_assignments_mock(),
},
boosted_hex_info: BoostedHex {
location: Cell::from_raw(0x8a1fb46622dffff).expect("valid h3 cell"),
Expand Down Expand Up @@ -1456,7 +1465,7 @@ mod test {
signal_power: 0,
coverage_claim_time: coverage_claim_time.unwrap_or(DateTime::<Utc>::MIN_UTC),
inserted_at: DateTime::<Utc>::MIN_UTC,
assignments: HexAssignments::test_best(),
assignments: hex_assignments_mock(),
}
}

Expand All @@ -1474,7 +1483,7 @@ mod test {
signal_level: SignalLevel::High,
coverage_claim_time,
inserted_at: DateTime::<Utc>::MIN_UTC,
assignments: HexAssignments::test_best(),
assignments: hex_assignments_mock(),
}
}

Expand All @@ -1492,7 +1501,7 @@ mod test {
signal_level: SignalLevel::High,
coverage_claim_time,
inserted_at: DateTime::<Utc>::MIN_UTC,
assignments: HexAssignments::test_best(),
assignments: hex_assignments_mock(),
}
}

Expand All @@ -1510,7 +1519,7 @@ mod test {
signal_level,
coverage_claim_time,
inserted_at: DateTime::<Utc>::MIN_UTC,
assignments: HexAssignments::test_best(),
assignments: hex_assignments_mock(),
}
}
}
14 changes: 11 additions & 3 deletions mobile_verifier/src/reward_shares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ pub fn get_scheduled_tokens_for_oracles(duration: Duration) -> Decimal {
#[cfg(test)]
mod test {
use super::*;
use hex_assignments::assignment::HexAssignments;
use hex_assignments::{assignment::HexAssignments, Assignment};

use crate::{
cell_type::CellType,
Expand All @@ -719,6 +719,14 @@ mod test {
use std::collections::HashMap;
use uuid::Uuid;

fn hex_assignments_mock() -> HexAssignments {
HexAssignments {
footfall: Assignment::A,
urbanized: Assignment::A,
landtype: Assignment::A,
}
}

#[test]
fn ensure_correct_conversion_of_bytes_to_bones() {
assert_eq!(
Expand Down Expand Up @@ -1007,7 +1015,7 @@ mod test {
signal_power: 0,
coverage_claim_time: DateTime::<Utc>::MIN_UTC,
inserted_at: DateTime::<Utc>::MIN_UTC,
assignments: HexAssignments::test_best(),
assignments: hex_assignments_mock(),
}]
}

Expand Down Expand Up @@ -1890,7 +1898,7 @@ mod test {
coverage_points: CoverageRewardPoints {
boost_multiplier: NonZeroU32::new(1).unwrap(),
coverage_points: dec!(10.0),
hex_assignments: HexAssignments::test_best(),
hex_assignments: hex_assignments_mock(),
rank: None,
},
boosted_hex: BoostedHex {
Expand Down

0 comments on commit 86d651b

Please sign in to comment.