@@ -14698,10 +14698,7 @@ fn test_short_proposal_title_is_invalid() {
1469814698
1469914699#[test]
1470014700fn test_long_proposal_title_is_invalid() {
14701- let mut long_title = String::new();
14702- for _ in 0..300 {
14703- long_title.push('Z');
14704- }
14701+ let long_title = "Z".repeat(300);
1470514702
1470614703 let result = validate_proposal_title(&Some(long_title));
1470714704 assert!(result.is_err());
@@ -15196,7 +15193,7 @@ fn randomly_pick_swap_start() {
1519615193
1519715194 // Generate "zillions" of outputs, and count their occurrences.
1519815195 let mut start_time_to_count = BTreeMap::new();
15199- const ITERATION_COUNT: u64 = 50_000 ;
15196+ const ITERATION_COUNT: u64 = 50 ;
1520015197 for _ in 0..ITERATION_COUNT {
1520115198 let GlobalTimeOfDay {
1520215199 seconds_after_utc_midnight,
@@ -15207,36 +15204,17 @@ fn randomly_pick_swap_start() {
1520715204 .or_insert(0) += 1;
1520815205 }
1520915206
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-
1521415207 // Assert that values are multiples of of 15 minutes.
1521515208 for seconds_after_utc_midnight in start_time_to_count.keys() {
1521615209 assert_eq!(
1521715210 seconds_after_utc_midnight % (15 * 60),
1521815211 0,
15219- "{}",
15212+ "A random start time was not at a 15 minute interval from midnight: {}",
1522015213 seconds_after_utc_midnight
1522115214 );
15222- }
1522315215
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- );
15216+ assert!(seconds_after_utc_midnight >= 0);
15217+ assert!(seconds_after_utc_midnight < ONE_DAY_SECONDS);
1524015218 }
1524115219}
1524215220
0 commit comments