diff --git a/.run_status.toml b/.run_status.toml
index 0f10435..553a8af 100644
--- a/.run_status.toml
+++ b/.run_status.toml
@@ -1,8 +1,8 @@
[last_run_clean]
run_status = "Success"
-lines_parsed = 76
-coverage = 38.61
+lines_parsed = 83
+coverage = 51.17
[last_run_clean.run_duration]
secs = 24
-nanos = 391618885
+nanos = 975426411
diff --git a/badges/coverage.svg b/badges/coverage.svg
index 41d0854..8819e8f 100644
--- a/badges/coverage.svg
+++ b/badges/coverage.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__effect_application_to_symbol.snap b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__effect_application_to_symbol.snap
new file mode 100644
index 0000000..b6b1534
--- /dev/null
+++ b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__effect_application_to_symbol.snap
@@ -0,0 +1,8 @@
+---
+source: lib_efo/src/stats/implementations/test.rs
+expression: out
+---
+⟳:⟳
+⥯:⥯
+☈:☈
+✓:✓
diff --git a/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__entity_duration_to_symbol.snap b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__entity_duration_to_symbol.snap
new file mode 100644
index 0000000..7f56009
--- /dev/null
+++ b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__entity_duration_to_symbol.snap
@@ -0,0 +1,7 @@
+---
+source: lib_efo/src/stats/implementations/test.rs
+expression: out
+---
+∞
+⧗42
+✔
diff --git a/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__entity_type_to_shortest.snap b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__entity_type_to_shortest.snap
new file mode 100644
index 0000000..6a6a463
--- /dev/null
+++ b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__entity_type_to_shortest.snap
@@ -0,0 +1,10 @@
+---
+source: lib_efo/src/stats/implementations/test.rs
+expression: out
+---
+:[C]
+ :[P]
+ :[T]
+ :[M]
+ :[B]
+:[E]
diff --git a/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__liststats_aliases.snap b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__liststats_aliases.snap
new file mode 100644
index 0000000..df84eca
--- /dev/null
+++ b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__liststats_aliases.snap
@@ -0,0 +1,67 @@
+---
+source: lib_efo/src/stats/implementations/test.rs
+expression: output
+---
+demographics: :Dem:34
+demographics: :Dem:34
+demographics: :Dem:34
+demographics: :Dem:34
+population: :Pop:35
+population: :Pop:35
+population: :Pop:35
+growthrate: :Gro:36
+growthrate: :Gro:36
+growthrate: :Gro:36
+crime::Cri:37
+crime::Cri:37
+crime::Cri:37
+happiness: :Hap:38
+happiness: :Hap:38
+happiness: :Hap:38
+economy:💰:Eco:39
+economy:💰:Eco:39
+economy:💰:Eco:39
+food::Foo:40
+food::Foo:40
+food::Foo:40
+food::Foo:40
+food::Foo:40
+industry:🏭:Ind:41
+industry:🏭:Ind:41
+industry:🏭:Ind:41
+science: :Sci:42
+science: :Sci:42
+science: :Sci:42
+trade: :Tra:43
+trade: :Tra:43
+trade: :Tra:43
+military:🪖:Mil:44
+military:🪖:Mil:44
+military:🪖:Mil:44
+army: :Arm:45
+army: :Arm:45
+army: :Arm:45
+strength: :Str:46
+strength: :Str:46
+strength: :Str:46
+fortification:🔒:For:47
+fortification:🔒:For:47
+fortification:🔒:For:47
+threat:⚡:Thr:48
+threat:⚡:Thr:48
+threat:⚡:Thr:48
+infrastructure:🏗️ :Inf:49
+infrastructure:🏗️ :Inf:49
+infrastructure:🏗️ :Inf:49
+bureaucracy:🏛️ :Bur:50
+bureaucracy:🏛️ :Bur:50
+bureaucracy:🏛️ :Bur:50
+transportation: :Tra:51
+transportation: :Tra:51
+transportation: :Tra:51
+sprawl:🏙️:Spr:52
+sprawl:🏙️:Spr:52
+sprawl:🏙️:Spr:52
+health::Hea:53
+health::Hea:53
+health::Hea:53
diff --git a/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__position_to_symbol.snap b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__position_to_symbol.snap
new file mode 100644
index 0000000..4b83d95
--- /dev/null
+++ b/lib_efo/src/stats/implementations/snapshots/lib_efo__stats__implementations__test__position_to_symbol.snap
@@ -0,0 +1,6 @@
+---
+source: lib_efo/src/stats/implementations/test.rs
+expression: out
+---
+12,34( 12, 34)⚓
+0,0( 0, 0)⚓
diff --git a/lib_efo/src/stats/implementations/test.rs b/lib_efo/src/stats/implementations/test.rs
index 03716c3..c331dda 100644
--- a/lib_efo/src/stats/implementations/test.rs
+++ b/lib_efo/src/stats/implementations/test.rs
@@ -1,5 +1,9 @@
#![allow(clippy::unwrap_used)]
+use insta::assert_debug_snapshot;
+use insta::assert_snapshot;
+
use super::*;
+use crate::entity::Entity;
use crate::stats::GameStat;
use crate::stats::GenericStat;
use crate::stats::StatPair;
@@ -54,157 +58,217 @@ fn test_stat_pair_parsing() {
assert_pair_ok("Pop -5", ListStats::Population, -5);
assert_pair_ok("grow 0", ListStats::Growthrate, 0);
}
+
#[test]
-fn test_list_stats_all_aliases() {
- let stats = OverallStats::default();
- // Demographics
- assert_stat_ok("dem", ListStats::Demographics);
- assert_stat_ok("Demog", ListStats::Demographics);
- assert_stat_ok("DEMOGRAPHICS", ListStats::Demographics);
- assert_stat_ok("Demo", ListStats::Demographics);
- stats.get_field_from_str(ListStats::Demographics.into());
- // Population
- assert_stat_ok("pop", ListStats::Population);
- assert_stat_ok("Popul", ListStats::Population);
- assert_stat_ok("POPULATIONS", ListStats::Population);
- stats.get_field_from_str((ListStats::Population).into());
-
- // Growthrate
- assert_stat_ok("grow", ListStats::Growthrate);
- assert_stat_ok("GRW", ListStats::Growthrate);
- assert_stat_ok("Growth", ListStats::Growthrate);
- stats.get_field_from_str(ListStats::Growthrate.into());
-
- // Crime
- assert_stat_ok("cri", ListStats::Crime);
- assert_stat_ok("CRIM", ListStats::Crime);
- assert_stat_ok("Crimes", ListStats::Crime);
- stats.get_field_from_str(ListStats::Crime.into());
-
- // Happiness
- assert_stat_ok("hapn", ListStats::Happiness);
- assert_stat_ok("HAPPINES", ListStats::Happiness);
- assert_stat_ok("hap", ListStats::Happiness);
- stats.get_field_from_str(ListStats::Happiness.into());
-
- // Economy
- assert_stat_ok("eco", ListStats::Economy);
- assert_stat_ok("Economy", ListStats::Economy);
- assert_stat_ok("econ", ListStats::Economy);
- stats.get_field_from_str(ListStats::Economy.into());
-
- // Food
- assert_stat_ok("food", ListStats::Food);
- assert_stat_ok("fo", ListStats::Food);
- assert_stat_ok("agr", ListStats::Food);
- assert_stat_ok("agri", ListStats::Food);
- stats.get_field_from_str(ListStats::Food.into());
-
- // Industry
- assert_stat_ok("industry", ListStats::Industry);
- assert_stat_ok("Indus", ListStats::Industry);
- assert_stat_ok("ind", ListStats::Industry);
- stats.get_field_from_str(ListStats::Industry.into());
-
- // Science
- assert_stat_ok("science", ListStats::Science);
- assert_stat_ok("sci", ListStats::Science);
- assert_stat_ok("sc", ListStats::Science);
- stats.get_field_from_str(ListStats::Science.into());
-
- // Trade
- assert_stat_ok("trade", ListStats::Trade);
- assert_stat_ok("trd", ListStats::Trade);
- assert_stat_ok("tr", ListStats::Trade);
- stats.get_field_from_str(ListStats::Trade.into());
-
- // Social
- assert_stat_ok("social", ListStats::Social);
- assert_stat_ok("soc", ListStats::Social);
- assert_stat_ok("sl", ListStats::Social);
- stats.get_field_from_str(ListStats::Social.into());
-
- // Culture
- assert_stat_ok("culture", ListStats::Culture);
- assert_stat_ok("cul", ListStats::Culture);
- assert_stat_ok("cl", ListStats::Culture);
- stats.get_field_from_str(ListStats::Culture.into());
-
- // Education
- assert_stat_ok("education", ListStats::Education);
- assert_stat_ok("edu", ListStats::Education);
- assert_stat_ok("ed", ListStats::Education);
- stats.get_field_from_str(ListStats::Education.into());
-
- // Tourism
- assert_stat_ok("tourism", ListStats::Tourism);
- assert_stat_ok("tour", ListStats::Tourism);
- assert_stat_ok("tm", ListStats::Tourism);
- stats.get_field_from_str(ListStats::Tourism.into());
-
- // Influence
- assert_stat_ok("influence", ListStats::Influence);
- assert_stat_ok("infl", ListStats::Influence);
- assert_stat_ok("influ", ListStats::Influence);
- stats.get_field_from_str(ListStats::Influence.into());
-
- // Military
- assert_stat_ok("military", ListStats::Military);
- assert_stat_ok("mil", ListStats::Military);
- assert_stat_ok("mt", ListStats::Military);
- stats.get_field_from_str(ListStats::Military.into());
-
- // Army
- assert_stat_ok("army", ListStats::Army);
- assert_stat_ok("arm", ListStats::Army);
- assert_stat_ok("ar", ListStats::Army);
- stats.get_field_from_str(ListStats::Army.into());
-
- // Strength
- assert_stat_ok("strength", ListStats::Strength);
- assert_stat_ok("str", ListStats::Strength);
- assert_stat_ok("st", ListStats::Strength);
- stats.get_field_from_str(ListStats::Strength.into());
-
- // Fortification
- assert_stat_ok("fortification", ListStats::Fortification);
- assert_stat_ok("fort", ListStats::Fortification);
- assert_stat_ok("ft", ListStats::Fortification);
- stats.get_field_from_str(ListStats::Fortification.into());
-
- // Threat
- assert_stat_ok("threat", ListStats::Threat);
- assert_stat_ok("thr", ListStats::Threat);
- assert_stat_ok("th", ListStats::Threat);
- stats.get_field_from_str(ListStats::Threat.into());
-
- // Infrastructure
- assert_stat_ok("infrastructure", ListStats::Infrastructure);
- assert_stat_ok("infra", ListStats::Infrastructure);
- assert_stat_ok("infr", ListStats::Infrastructure);
- stats.get_field_from_str(ListStats::Infrastructure.into());
-
- // Bureaucracy
- assert_stat_ok("bureaucracy", ListStats::Bureaucracy);
- assert_stat_ok("bureau", ListStats::Bureaucracy);
- assert_stat_ok("bur", ListStats::Bureaucracy);
- stats.get_field_from_str(ListStats::Bureaucracy.into());
-
- // Transportation
- assert_stat_ok("transportation", ListStats::Transportation);
- assert_stat_ok("trans", ListStats::Transportation);
- assert_stat_ok("trns", ListStats::Transportation);
- stats.get_field_from_str(ListStats::Transportation.into());
-
- // Sprawl
- assert_stat_ok("sprawl", ListStats::Sprawl);
- assert_stat_ok("spr", ListStats::Sprawl);
- assert_stat_ok("spra", ListStats::Sprawl);
- stats.get_field_from_str(ListStats::Sprawl.into());
-
- // Health
- assert_stat_ok("health", ListStats::Health);
- assert_stat_ok("hlth", ListStats::Health);
- assert_stat_ok("hlt", ListStats::Health);
- stats.get_field_from_str(ListStats::Health.into());
+fn test_liststats_aliases() {
+ // Each tuple: (alias, expected enum variant)
+ let cases = vec![
+ // Demographics
+ ("dem", ListStats::Demographics),
+ ("DEMOg", ListStats::Demographics),
+ ("demoGRAphicS", ListStats::Demographics),
+ ("demo", ListStats::Demographics),
+ // Population
+ ("Pop", ListStats::Population),
+ ("POPUl", ListStats::Population),
+ ("populations", ListStats::Population),
+ // Growth rate
+ ("grow", ListStats::Growthrate),
+ ("grW", ListStats::Growthrate),
+ ("Growth", ListStats::Growthrate),
+ // Crime
+ ("CRI", ListStats::Crime),
+ ("crim", ListStats::Crime),
+ ("Crimes", ListStats::Crime),
+ // Happiness
+ ("hapN", ListStats::Happiness),
+ ("HAPPiNeS", ListStats::Happiness),
+ ("hap", ListStats::Happiness),
+ // Economy
+ ("eco", ListStats::Economy),
+ ("EconomY", ListStats::Economy),
+ ("econ", ListStats::Economy),
+ // Food
+ ("Food", ListStats::Food),
+ ("fo", ListStats::Food),
+ ("agr", ListStats::Food),
+ ("Agri", ListStats::Food),
+ ("Fod", ListStats::Food),
+ // Industry
+ ("industry", ListStats::Industry),
+ ("IndUs", ListStats::Industry),
+ ("ind", ListStats::Industry),
+ // Science
+ ("science", ListStats::Science),
+ ("SCI", ListStats::Science),
+ ("Sc", ListStats::Science),
+ // Trade
+ ("trade", ListStats::Trade),
+ ("TrD", ListStats::Trade),
+ ("tr", ListStats::Trade),
+ // // Social
+ // ("social", ListStats::Social),
+ // ("soc", ListStats::Social),
+ // ("sl", ListStats::Social),
+ // // Culture
+ // ("culture", ListStats::Culture),
+ // ("CUL", ListStats::Culture),
+ // ("cl", ListStats::Culture),
+ // // Education
+ // ("education", ListStats::Education),
+ // ("edu", ListStats::Education),
+ // ("ed", ListStats::Education),
+ // // Tourism
+ // ("tourism", ListStats::Tourism),
+ // ("tour", ListStats::Tourism),
+ // ("tm", ListStats::Tourism),
+ // // Influence
+ // ("influence", ListStats::Influence),
+ // ("infl", ListStats::Influence),
+ // ("influ", ListStats::Influence),
+ // Military
+ ("military", ListStats::Military),
+ ("mil", ListStats::Military),
+ ("mt", ListStats::Military),
+ // Army
+ ("army", ListStats::Army),
+ ("arm", ListStats::Army),
+ ("ar", ListStats::Army),
+ // Strength
+ ("strength", ListStats::Strength),
+ ("str", ListStats::Strength),
+ ("st", ListStats::Strength),
+ // Fortification
+ ("fortification", ListStats::Fortification),
+ ("fort", ListStats::Fortification),
+ ("ft", ListStats::Fortification),
+ // Threat
+ ("threat", ListStats::Threat),
+ ("thr", ListStats::Threat),
+ ("th", ListStats::Threat),
+ // Infrastructure
+ ("infrastructure", ListStats::Infrastructure),
+ ("infra", ListStats::Infrastructure),
+ ("infr", ListStats::Infrastructure),
+ // Bureaucracy
+ ("bureaucracy", ListStats::Bureaucracy),
+ ("bureau", ListStats::Bureaucracy),
+ ("bur", ListStats::Bureaucracy),
+ // Transportation
+ ("transportation", ListStats::Transportation),
+ ("trans", ListStats::Transportation),
+ ("trns", ListStats::Transportation),
+ // Sprawl
+ ("sprawl", ListStats::Sprawl),
+ ("spr", ListStats::Sprawl),
+ ("spra", ListStats::Sprawl),
+ // Health
+ ("health", ListStats::Health),
+ ("hlth", ListStats::Health),
+ ("hlt", ListStats::Health),
+ ];
+ let mut s = OverallStats::linear(33);
+ let mut output = String::new();
+ for (alias, expected_variant) in cases {
+ let val = alias.parse::().unwrap();
+ s.get_field_mut_from_str(val.into());
+ assert_eq!(
+ val, expected_variant,
+ "parsing `{}` should yield {:?}",
+ alias, expected_variant
+ );
+ output.push_str(&format!(
+ "{}:{}:{}:{}\n",
+ std::convert::Into::<&str>::into(val),
+ val.to_symbol(),
+ val.to_shortest(),
+ s.get_field(&val)
+ ));
+ {
+ s.get_field_mut(&val);
+ }
+ }
+ assert_snapshot!(output);
+}
+
+#[test]
+fn test_liststats_unknown_alias() {
+ // Pick a string that is not in the list of known aliases.
+ let unknown = "unknown_stat_123";
+
+ // Verify the error type and payload directly.
+ let err = unknown.parse::().unwrap_err();
+ match err {
+ EpochError::UnknownStatAcronim(msg) => {
+ assert_eq!(msg, unknown);
+ }
+ other => panic!("Expected UnknownStatAcronim, got {:?}", other),
+ }
+}
+
+#[test]
+fn test_entity_type_to_shortest() {
+ let out = [
+ EntityType::Character,
+ EntityType::Player,
+ EntityType::Town,
+ EntityType::Monster,
+ EntityType::Blocker,
+ EntityType::Event,
+ ]
+ .iter()
+ .map(|v| format!("{}:{}", v.to_symbol(), v.to_shortest()))
+ .collect::>()
+ .join("\n");
+ assert_snapshot!(out);
+}
+
+// ---------------------------------------------------------------------------
+// EntityType – already tested by your existing example
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// EffectApplication – one line per variant
+// ---------------------------------------------------------------------------
+#[test]
+fn test_effect_application_to_symbol() {
+ let out = [
+ EffectApplication::Recurring,
+ EffectApplication::WhenPresent,
+ EffectApplication::PermanentEffectToApply,
+ EffectApplication::PermanentEffectApplied,
+ ]
+ .iter()
+ .map(|v| format!("{}:{}", v.to_symbol(), v.to_shortest()))
+ .collect::>()
+ .join("\n");
+ assert_snapshot!(out);
+}
+
+// ---------------------------------------------------------------------------
+// Position – two variants, tested for both `to_symbol` and `to_shortest`
+// ---------------------------------------------------------------------------
+#[test]
+fn test_position_to_symbol() {
+ let out = [Position(12, 34), Position(0, 0)]
+ .iter()
+ .map(|p| format!("{}{}", p.to_shortest(), p.to_symbol()))
+ .collect::>()
+ .join("\n");
+ assert_snapshot!(out);
+}
+
+// ---------------------------------------------------------------------------
+// EntityDuration – one line per variant
+// ---------------------------------------------------------------------------
+#[test]
+fn test_entity_duration_to_symbol() {
+ let out = [
+ EntityDuration::Permanent,
+ EntityDuration::Duration(42),
+ EntityDuration::Done,
+ ]
+ .map(|v| v.to_symbol())
+ .join("\n");
+ assert_snapshot!(out);
}