@@ -21,8 +21,6 @@ use fixtures::{
2121use futures::future::FutureExt;
2222use ic_base_types::{CanisterId, NumBytes, PrincipalId};
2323use ic_crypto_sha2::Sha256;
24- use ic_nervous_system_canisters::cmc::CMC;
25- use ic_nervous_system_canisters::ledger::IcpLedger;
2624use ic_nervous_system_clients::canister_status::{CanisterStatusResultV2, CanisterStatusType};
2725use ic_nervous_system_common::{
2826 ledger, ledger::compute_neuron_staking_subaccount_bytes, NervousSystemError, E8,
@@ -14698,10 +14696,7 @@ fn test_short_proposal_title_is_invalid() {
1469814696
1469914697#[test]
1470014698fn test_long_proposal_title_is_invalid() {
14701- let mut long_title = String::new();
14702- for _ in 0..300 {
14703- long_title.push('Z');
14704- }
14699+ let long_title = "Z".repeat(300);
1470514700
1470614701 let result = validate_proposal_title(&Some(long_title));
1470714702 assert!(result.is_err());
@@ -15196,7 +15191,7 @@ fn randomly_pick_swap_start() {
1519615191
1519715192 // Generate "zillions" of outputs, and count their occurrences.
1519815193 let mut start_time_to_count = BTreeMap::new();
15199- const ITERATION_COUNT: u64 = 50_000 ;
15194+ const ITERATION_COUNT: u64 = 50 ;
1520015195 for _ in 0..ITERATION_COUNT {
1520115196 let GlobalTimeOfDay {
1520215197 seconds_after_utc_midnight,
@@ -15207,36 +15202,16 @@ fn randomly_pick_swap_start() {
1520715202 .or_insert(0) += 1;
1520815203 }
1520915204
15210- // Assert that we hit all possible values.
15211- let possible_values_count = ONE_DAY_SECONDS / 60 / 15;
15212- assert_eq!(start_time_to_count.len(), possible_values_count as usize);
15213-
15214- // Assert that values are multiples of of 15 minutes.
15205+ // Assert that values are multiples of 15 minutes and within a single 24 hour period.
1521515206 for seconds_after_utc_midnight in start_time_to_count.keys() {
1521615207 assert_eq!(
1521715208 seconds_after_utc_midnight % (15 * 60),
1521815209 0,
15219- "{}",
15210+ "A random start time was not at a 15 minute interval from midnight: {}",
1522015211 seconds_after_utc_midnight
1522115212 );
15222- }
1522315213
15224- // Assert that the distribution appears to be uniform.
15225- let min_occurrence_count = (0.8 * (ITERATION_COUNT / possible_values_count) as f64) as u64;
15226- let max_occurrence_count = (1.2 * (ITERATION_COUNT / possible_values_count) as f64) as u64;
15227- for occurrence_count in start_time_to_count.values() {
15228- assert!(
15229- *occurrence_count >= min_occurrence_count,
15230- "{} (vs. minimum = {})",
15231- occurrence_count,
15232- min_occurrence_count
15233- );
15234- assert!(
15235- *occurrence_count <= max_occurrence_count,
15236- "{} (vs. maximum = {})",
15237- occurrence_count,
15238- max_occurrence_count
15239- );
15214+ assert!(*seconds_after_utc_midnight < ONE_DAY_SECONDS);
1524015215 }
1524115216}
1524215217
0 commit comments