diff --git a/crates/game-service/tests/achievements_and_levels.rs b/crates/game-service/tests/achievements_and_levels.rs index f10a0df..868556e 100644 --- a/crates/game-service/tests/achievements_and_levels.rs +++ b/crates/game-service/tests/achievements_and_levels.rs @@ -34,7 +34,7 @@ fn adding_exp_rolls_over_into_levels() { assert_eq!(home.avatar().exp_points, 5); } #[test] -fn a_completed_findcard_achievement_can_be_claimed() { +fn findcard_achievement_claim() { tables(); let tabs = LogicDataTables::instance(); let achievements = tabs.table(table::ACHIEVEMENTS).unwrap(); diff --git a/crates/game-service/tests/combat_timer_phase.rs b/crates/game-service/tests/combat_timer_phase.rs index 143d047..6309366 100644 --- a/crates/game-service/tests/combat_timer_phase.rs +++ b/crates/game-service/tests/combat_timer_phase.rs @@ -19,7 +19,7 @@ fn avatar(low: i32) -> LogicClientAvatar { } } #[test] -fn a_ranged_shooter_updates_twice_on_the_tick_it_fires() { +fn shooter_double_update_on_fire() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -90,11 +90,11 @@ fn a_ranged_shooter_updates_twice_on_the_tick_it_fires() { assert_eq!( load_timer, ARCHER_LOAD_TIME - logic::battle::TICK_MILLISECONDS, - "t={tick}: the shooter did not take its second update on the firing tick" + "t={tick}" ); } assert!( shots > 1, - "the archer fired {shots} times, too few to prove anything" + "shots={shots}" ); } diff --git a/crates/game-service/tests/deploy_birth_tick.rs b/crates/game-service/tests/deploy_birth_tick.rs index bf0104b..58ca8ed 100644 --- a/crates/game-service/tests/deploy_birth_tick.rs +++ b/crates/game-service/tests/deploy_birth_tick.rs @@ -20,7 +20,7 @@ fn avatar(low: i32) -> LogicClientAvatar { } } #[test] -fn a_card_lands_one_tick_after_the_command_fires() { +fn card_lands_after_fire() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -65,7 +65,7 @@ fn a_card_lands_one_tick_after_the_command_fires() { ); } #[test] -fn a_state_request_waits_for_the_cards_in_the_air() { +fn state_request_waits_in_flight() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -114,7 +114,7 @@ fn a_state_request_waits_for_the_cards_in_the_air() { 100, ), ); - assert!(second > first, "the second card must land after the first"); + assert!(second > first, "second lands after first"); let mut refused = Vec::new(); for tick in 16..(second + 4) { if session.state_on_request().is_none() { @@ -144,5 +144,5 @@ fn a_state_request_waits_for_the_cards_in_the_air() { } session.advance_to(session.tick() + 1); } - assert!(paid, "the owed state was never sent after the cards landed"); + assert!(paid, "owed state never sent"); } diff --git a/crates/game-service/tests/level_scaling.rs b/crates/game-service/tests/level_scaling.rs index c937c33..b8e764b 100644 --- a/crates/game-service/tests/level_scaling.rs +++ b/crates/game-service/tests/level_scaling.rs @@ -8,7 +8,7 @@ fn tables() { )); } #[test] -fn a_single_valued_column_is_scaled_not_indexed() { +fn single_value_scaled() { tables(); let spear = LogicDataRef::by_name(table::PROJECTILES, "SpearGoblinProjectile") .as_projectile() @@ -18,7 +18,7 @@ fn a_single_valued_column_is_scaled_not_indexed() { assert_eq!(spear.damage(6), 42, "the bot's deck level"); } #[test] -fn a_tower_scales_at_its_own_percentage() { +fn tower_scale_percent() { tables(); let princess = LogicDataRef::by_name(table::BUILDINGS, "PrincessTower") .as_character() @@ -34,7 +34,7 @@ fn a_tower_scales_at_its_own_percentage() { assert_eq!(king.hitpoints(1), king_base * 108 / 100); } #[test] -fn an_ordinary_card_scales_at_the_card_percentage() { +fn card_scale_percent() { tables(); let knight = LogicDataRef::by_name(table::CHARACTERS_COMBINED, "Knight") .as_character() diff --git a/crates/game-service/tests/projectile_references.rs b/crates/game-service/tests/projectile_references.rs index 9489041..73ea32f 100644 --- a/crates/game-service/tests/projectile_references.rs +++ b/crates/game-service/tests/projectile_references.rs @@ -19,7 +19,7 @@ fn avatar(low: i32) -> LogicClientAvatar { } } #[test] -fn a_projectile_drops_its_reference_to_an_object_that_died() { +fn projectile_drops_dead_ref() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -61,7 +61,7 @@ fn a_projectile_drops_its_reference_to_an_object_that_died() { } if !alive.contains(&reference) { stale.push(format!( - "t={tick}: projectile {:?} still points {name} at {:?}, which is off the board", + "t={tick}: stale {name} ref {:?} -> {:?}", entry.global_id.0, reference.0 )); } @@ -70,7 +70,7 @@ fn a_projectile_drops_its_reference_to_an_object_that_died() { } assert!( projectiles_seen > 0, - "no projectile was ever in the air, so the test proved nothing" + "no projectiles seen" ); assert!( stale.is_empty(), @@ -79,7 +79,7 @@ fn a_projectile_drops_its_reference_to_an_object_that_died() { ); } #[test] -fn pending_physical_damage_matches_the_shots_in_the_air() { +fn pending_damage_matches_shots() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -136,7 +136,7 @@ fn pending_physical_damage_matches_the_shots_in_the_air() { }; assert!( held >= 0, - "t={tick}: {:?} holds a NEGATIVE pending of {held}, which aborts the client", + "t={tick}: {:?} negative pending {held}", entry.global_id.0 ); let want = owed @@ -146,7 +146,7 @@ fn pending_physical_damage_matches_the_shots_in_the_air() { .unwrap_or(0); assert_eq!( held, want, - "t={tick}: {:?} holds {held} pending but the shots in the air owe {want}", + "t={tick}: {:?} pending {held} != {want}", entry.global_id.0 ); if held > 0 { @@ -156,6 +156,6 @@ fn pending_physical_damage_matches_the_shots_in_the_air() { } assert!( ever_positive, - "no shot ever registered pending damage, so the test proved nothing" + "no pending damage seen" ); } diff --git a/crates/game-service/tests/walk_to_tower.rs b/crates/game-service/tests/walk_to_tower.rs index 05959fc..1c464e4 100644 --- a/crates/game-service/tests/walk_to_tower.rs +++ b/crates/game-service/tests/walk_to_tower.rs @@ -20,7 +20,7 @@ fn avatar(low: i32) -> LogicClientAvatar { } } #[test] -fn a_ranged_troop_fires_and_the_snapshot_reads_back() { +fn ranged_fire_roundtrips() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -54,7 +54,7 @@ fn a_ranged_troop_fires_and_the_snapshot_reads_back() { } } #[test] -fn a_troop_walks_at_the_enemy_towers_and_stops_in_range() { +fn troop_walks_and_stops() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -119,7 +119,7 @@ fn a_troop_walks_at_the_enemy_towers_and_stops_in_range() { ); } #[test] -fn the_bot_deploys_in_front_of_its_own_towers() { +fn bot_deploys_at_towers() { let root = assets(); if let Ok(tables) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(tables)); @@ -187,7 +187,7 @@ fn the_bot_deploys_in_front_of_its_own_towers() { .any(|entry| entry.global_id == *leader); assert!( alive, - "t={tick}: side {side}'s leader {leader:?} is no longer in the battle" + "t={tick}: leader {leader:?} gone" ); } if session.is_finished() || session.towers_standing().0 == 0 { @@ -216,10 +216,10 @@ fn the_bot_deploys_in_front_of_its_own_towers() { } } } - assert!(plays > 0, "the bot never played a card"); + assert!(plays > 0, "bot never played"); } #[test] -fn a_bot_troop_walks_at_the_player_towers() { +fn bot_troop_walks() { let root = assets(); if let Ok(tables) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(tables)); @@ -267,7 +267,7 @@ fn a_bot_troop_walks_at_the_player_towers() { println!("bot troop finished at {end:?}"); assert!( end.1 < 23500, - "the bot troop walked away from the player towers to {end:?}" + "bot troop at {end:?}" ); } #[test] @@ -302,12 +302,12 @@ fn both_leaders_resolve_to_a_summoner() { .find(|entry| entry.global_id == *leader); assert!( found.is_some(), - "side {side}'s leader {leader:?} matches no object in the battle" + "leader {leader:?} not found" ); } } #[test] -fn a_finished_battle_stops_ticking() { +fn finished_battle_stops() { let root = assets(); if let Ok(tables) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(tables)); @@ -327,7 +327,7 @@ fn a_finished_battle_stops_ticking() { for _ in 0..400 { session.advance_to(session.tick() + MAX_CATCH_UP_TICKS); } - assert!(session.is_finished(), "the battle never reached its end"); + assert!(session.is_finished(), "battle never ended"); let settled = session.tick(); session.advance_to(settled + 10_000); assert_eq!( @@ -337,7 +337,7 @@ fn a_finished_battle_stops_ticking() { ); } #[test] -fn a_dormant_king_clears_its_combat_bit_and_towers_do_not() { +fn dormant_king_combat_bit() { let root = assets(); if let Ok(t) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(t)); @@ -362,7 +362,7 @@ fn a_dormant_king_clears_its_combat_bit_and_towers_do_not() { let mask = entry.body.base().component_mask; match &entry.body { logic::battle::LogicObjectBody::Summoner(_) => { - assert_eq!(mask, 12, "a dormant king should clear its combat bit"); + assert_eq!(mask, 12, "combat bit not cleared"); kings += 1; } logic::battle::LogicObjectBody::Character(_) => { @@ -380,11 +380,11 @@ fn a_dormant_king_clears_its_combat_bit_and_towers_do_not() { let b = mode.calculate_checksum().unwrap(); mode.time.tick = 200; let c = mode.calculate_checksum().unwrap(); - assert_eq!(b, c, "hashing the same idle state twice must agree"); + assert_eq!(b, c, "idle hash mismatch"); let _ = a; } #[test] -fn a_deployed_troop_counts_down_and_holds_still_until_ready() { +fn deploy_countdown_holds() { let root = assets(); if let Ok(t) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(t)); @@ -459,7 +459,7 @@ fn a_deployed_troop_counts_down_and_holds_still_until_ready() { assert_ne!(moved, spawn_pos, "a deployed troop moves"); } #[test] -fn a_troop_in_range_damages_the_tower_with_the_client_hit_model() { +fn in_range_damage() { let root = assets(); if let Ok(t) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(t)); @@ -527,7 +527,7 @@ fn a_troop_in_range_damages_the_tower_with_the_client_hit_model() { ); } #[test] -fn the_session_emits_a_heartbeat_every_turn() { +fn heartbeat_every_turn() { let root = assets(); if let Ok(t) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(t)); @@ -629,11 +629,11 @@ fn playing_a_card_cycles_the_summoner_hand() { assert_ne!(hand2[0], -1, "the slot refilled from the draw pile"); assert_ne!( hand2[0], played, - "with a different card than the one played" + "wrong card" ); } #[test] -fn a_multi_unit_card_spreads_its_units() { +fn multi_unit_spread() { let root = assets(); if let Ok(t) = LogicDataTables::load_from_dir(&root) { LogicDataTables::install(Arc::new(t)); @@ -658,7 +658,7 @@ fn a_multi_unit_card_spreads_its_units() { } } #[test] -fn a_snapshot_carrying_a_command_still_reads_back() { +fn snapshot_with_command_roundtrips() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -706,7 +706,7 @@ fn a_snapshot_carrying_a_command_still_reads_back() { } } #[test] -fn the_search_moves_a_drop_the_way_the_client_does() { +fn deploy_search_matches_client() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -757,7 +757,7 @@ fn the_search_moves_a_drop_the_way_the_client_does() { } } #[test] -fn a_drop_the_client_refuses_spawns_nothing() { +fn refused_drop_spawns_nothing() { let root = assets(); let tables = LogicDataTables::load_from_dir(&root).expect("tables"); LogicDataTables::install(Arc::new(tables)); @@ -814,7 +814,7 @@ fn mana_already_committed_cannot_be_spent_twice() { let mut session = game_service::battle_session::BattleSession::new(mode, Vec::new()); session.advance_to(120); let available = session.simulated_mana(0); - assert!(available > 0, "the player should have mana by tick 120"); + assert!(available > 0, "no mana by t120"); let entries = builder.summon( &LogicDataRef::spell("Knight"), LogicVector2::new(9500, 14500), diff --git a/crates/logic/src/battle/logic_component.rs b/crates/logic/src/battle/logic_component.rs index 87ed29a..ffb9eed 100644 --- a/crates/logic/src/battle/logic_component.rs +++ b/crates/logic/src/battle/logic_component.rs @@ -232,7 +232,7 @@ impl LogicCharacterBuffComponent { mod buff_component_tests { use super::LogicCharacterBuffComponent; #[test] - fn an_unbuffed_component_reports_full_size_and_damage() { + fn unbuffed_defaults() { let component = LogicCharacterBuffComponent::empty(5); assert_eq!(component.size_multiplier, 100); assert_eq!(component.damage_multiplier, 100); diff --git a/crates/logic/src/data/scaled.rs b/crates/logic/src/data/scaled.rs index 5165d92..a619133 100644 --- a/crates/logic/src/data/scaled.rs +++ b/crates/logic/src/data/scaled.rs @@ -47,7 +47,7 @@ pub fn level_scale(percent: i32, level: i32) -> i32 { mod tests { use super::level_scale; #[test] - fn the_ten_percent_ladder_matches_the_measured_damage() { + fn ten_percent_ladder() { assert_eq!(level_scale(10, 0), 100); assert_eq!(level_scale(10, 1), 110); assert_eq!(level_scale(10, 2), 121); @@ -56,7 +56,7 @@ mod tests { assert_eq!(24 * level_scale(10, 2) / 100, 29); } #[test] - fn a_level_below_one_never_enters_the_loop() { + fn level_below_one() { assert_eq!(level_scale(10, -3), 100); assert_eq!(level_scale(9, 0), 100); } diff --git a/crates/logic/src/logic_math.rs b/crates/logic/src/logic_math.rs index 9a5e857..8c576c3 100644 --- a/crates/logic/src/logic_math.rs +++ b/crates/logic/src/logic_math.rs @@ -229,7 +229,7 @@ mod trig_tests { assert_eq!(get_angle(0, 5000), 90); } #[test] - fn a_single_unit_has_no_offset_and_pairs_split() { + fn single_and_pair_offsets() { assert_eq!(spawn_offset(0, 1, 300, false), (0, 0)); let a = spawn_offset(0, 2, 300, false); let b = spawn_offset(1, 2, 300, false); @@ -239,15 +239,15 @@ mod trig_tests { assert_ne!(a.0, 0); } #[test] - fn a_three_unit_card_starts_its_ring_on_the_y_axis() { + fn three_unit_ring_start() { let ring: Vec<_> = (0..3).map(|i| spawn_offset(i, 3, 500, true)).collect(); assert_eq!( ring[0].0, 0, - "the first of three is not on the y axis: {ring:?}" + "{ring:?}" ); assert!( ring[0].1 > 0, - "the first of three points the wrong way: {ring:?}" + "{ring:?}" ); assert_eq!(ring[1].0, -ring[2].0, "the pair is not symmetric: {ring:?}"); assert_eq!(ring[1].1, ring[2].1, "the pair is not level: {ring:?}"); diff --git a/crates/logic/src/messages/sector_heartbeat.rs b/crates/logic/src/messages/sector_heartbeat.rs index 4fe42ea..a6ef36c 100644 --- a/crates/logic/src/messages/sector_heartbeat.rs +++ b/crates/logic/src/messages/sector_heartbeat.rs @@ -48,7 +48,7 @@ mod tests { use super::*; use titan::ByteStreamReader; #[test] - fn an_empty_turn_keeps_the_two_vint_form() { + fn empty_turn_two_vints() { let message = SectorHeartbeatMessage::new(19, -1234); let mut reader = ByteStreamReader::new(&message.body); assert_eq!(reader.read_vint().unwrap(), 19); diff --git a/crates/logic/tests/client_path_replay.rs b/crates/logic/tests/client_path_replay.rs index 86831aa..86a4eaa 100644 --- a/crates/logic/tests/client_path_replay.rs +++ b/crates/logic/tests/client_path_replay.rs @@ -25,18 +25,18 @@ fn we_reproduce_the_clients_route_node_for_node() { assert_eq!( find_path(&tm, start, (27, 48), 2, false), expected, - "start {start:?} should walk the client's route" + "start {start:?}" ); } } #[test] -fn the_route_bulges_because_the_lane_pinches_not_because_of_a_tie() { +fn route_follows_lane_pinch() { let tm = arena(); assert_eq!(tm.lane_bits(27, 31), 0); assert_eq!(tm.lane_bits(28, 31), 2); let path = find_path(&tm, (27, 29), (27, 48), 2, false); assert!( !path.contains(&(31 * 36 + 27)), - "the route must not step on the off-lane tile (27,31)" + "off-lane tile (27,31)" ); } diff --git a/crates/logic/tests/lane_assignment.rs b/crates/logic/tests/lane_assignment.rs index de89629..e63da20 100644 --- a/crates/logic/tests/lane_assignment.rs +++ b/crates/logic/tests/lane_assignment.rs @@ -7,12 +7,12 @@ fn arena() -> LogicTilemap { .expect("the goblin arena tilemap") } #[test] -fn the_arena_is_36_by_64_subtiles() { +fn arena_dimensions() { let tm = arena(); assert_eq!((tm.width(), tm.height()), (36, 64)); } #[test] -fn the_map_rows_are_all_full_width() { +fn map_rows_full_width() { let tm = arena(); assert_eq!(tm.tiles.len(), 64); for (y, row) in tm.tiles.iter().enumerate() { @@ -20,7 +20,7 @@ fn the_map_rows_are_all_full_width() { } } #[test] -fn the_arena_has_its_river_and_both_lanes() { +fn river_and_lanes() { let tm = arena(); let tiles = || (0..tm.height()).flat_map(|y| (0..tm.width()).map(move |x| (x, y))); assert_eq!( @@ -30,7 +30,7 @@ fn the_arena_has_its_river_and_both_lanes() { assert_eq!(tiles().filter(|(x, y)| tm.is_water(*x, *y)).count(), 112); } #[test] -fn the_right_lane_pinches_to_two_columns_at_the_bridge() { +fn right_lane_pinch() { let tm = arena(); for y in [31, 32] { assert_eq!( @@ -61,21 +61,21 @@ fn the_right_lane_pinches_to_two_columns_at_the_bridge() { } } #[test] -fn a_drop_by_the_right_bridge_takes_the_right_lane() { +fn right_bridge_right_lane() { let tm = arena(); assert_eq!(get_lane_id(&tm, 12500, 14500), 2); assert_eq!(get_lane_id(&tm, 10000, 14500), 2); assert_eq!(get_lane_id(&tm, 11000, 14500), 2); } #[test] -fn a_drop_by_the_left_bridge_takes_the_left_lane() { +fn left_bridge_left_lane() { let tm = arena(); for (x, y) in [(6923, 8500), (7788, 8999), (7788, 8001)] { assert_eq!(get_lane_id(&tm, x, y), 1, "({x},{y}) is on the left"); } } #[test] -fn the_single_spawn_path_clamps_before_it_reads_the_lane() { +fn spawn_clamps_before_lane() { let tm = arena(); assert_eq!( spawn_lane_of(&tm, -5000, 14500), diff --git a/crates/service-rpc/tests/error_channel.rs b/crates/service-rpc/tests/error_channel.rs index f2882c1..d7d504f 100644 --- a/crates/service-rpc/tests/error_channel.rs +++ b/crates/service-rpc/tests/error_channel.rs @@ -20,7 +20,7 @@ impl RpcService for Doubler { } #[tokio::test] -async fn a_service_error_reaches_the_caller_and_keeps_the_connection() { +async fn error_reaches_caller() { let listener = TcpListener::bind("127.0.0.1:0").await.expect("bind"); let endpoint = listener.local_addr().expect("addr").to_string(); tokio::spawn(async move {