Adds coverage
Build Successful The build was successful
Gitea/epoch_forge/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2025-12-13 04:13:29 +01:00
parent a1bed93bb0
commit e109918280
13 changed files with 397 additions and 20 deletions

View File

@ -1,8 +1,8 @@
[last_run_clean]
run_status = "Success"
lines_parsed = 59
coverage = 14.8
lines_parsed = 76
coverage = 38.61
[last_run_clean.run_duration]
secs = 23
nanos = 833334374
secs = 24
nanos = 391618885

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="18" role="img" aria-label="test-coverage: 15%"><title>test-coverage: 15%</title><linearGradient id="bms-f12bf7bee0589b04" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-f12bf7bee0589b04"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-f12bf7bee0589b04)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#97ca00"/><rect width="122" height="18" fill="url(#bms-f12bf7bee0589b04)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="445" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="770">test-coverage</text><text x="445" y="130" transform="scale(.1)" fill="#fff" textLength="770">test-coverage</text><text aria-hidden="true" x="1035" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">15%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">15%</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="18" role="img" aria-label="test-coverage: 39%"><title>test-coverage: 39%</title><linearGradient id="bms-59b9855e9d3baaa7" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-59b9855e9d3baaa7"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-59b9855e9d3baaa7)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#97ca00"/><rect width="122" height="18" fill="url(#bms-59b9855e9d3baaa7)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="445" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="770">test-coverage</text><text x="445" y="130" transform="scale(.1)" fill="#fff" textLength="770">test-coverage</text><text aria-hidden="true" x="1035" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">39%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">39%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="82" height="18" role="img" aria-label="test: passing"><title>test: passing</title><linearGradient id="bms-5402c39dce014bd3" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-5402c39dce014bd3"><rect width="82" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-5402c39dce014bd3)"><rect width="31" height="18" fill="#555"/><rect x="31" width="51" height="18" fill="#97ca00"/><rect width="82" height="18" fill="url(#bms-5402c39dce014bd3)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="165" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">test</text><text x="165" y="130" transform="scale(.1)" fill="#fff" textLength="210">test</text><text aria-hidden="true" x="555" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">passing</text><text x="555" y="130" transform="scale(.1)" fill="#fff" textLength="410">passing</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="82" height="18" role="img" aria-label="test: passing"><title>test: passing</title><linearGradient id="bms-5402c39dce014bd3" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-5402c39dce014bd3"><rect width="82" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-5402c39dce014bd3)"><rect width="31" height="18" fill="#555"/><rect x="31" width="51" height="18" fill="#97ca00"/><rect width="82" height="18" fill="url(#bms-5402c39dce014bd3)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="165" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">test</text><text x="165" y="130" transform="scale(.1)" fill="#fff" textLength="210">test</text><text aria-hidden="true" x="555" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">passing</text><text x="555" y="130" transform="scale(.1)" fill="#fff" textLength="410">passing</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="78" height="18" role="img" aria-label="version: 0.1"><title>version: 0.1</title><linearGradient id="bms-e7c71dea3d331ef4" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-e7c71dea3d331ef4"><rect width="78" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-e7c71dea3d331ef4)"><rect width="51" height="18" fill="#555"/><rect x="51" width="27" height="18" fill="#fe7d37"/><rect width="78" height="18" fill="url(#bms-e7c71dea3d331ef4)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="265" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">version</text><text x="265" y="130" transform="scale(.1)" fill="#fff" textLength="410">version</text><text aria-hidden="true" x="635" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="170">0.1</text><text x="635" y="130" transform="scale(.1)" fill="#fff" textLength="170">0.1</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="78" height="18" role="img" aria-label="version: 0.1"><title>version: 0.1</title><linearGradient id="bms-e7c71dea3d331ef4" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-e7c71dea3d331ef4"><rect width="78" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-e7c71dea3d331ef4)"><rect width="51" height="18" fill="#555"/><rect x="51" width="27" height="18" fill="#fe7d37"/><rect width="78" height="18" fill="url(#bms-e7c71dea3d331ef4)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="265" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">version</text><text x="265" y="130" transform="scale(.1)" fill="#fff" textLength="410">version</text><text aria-hidden="true" x="635" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="170">0.1</text><text x="635" y="130" transform="scale(.1)" fill="#fff" textLength="170">0.1</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -371,10 +371,10 @@ impl Diffable for Entity {
stats: self.stats.clone() - other.stats.clone(),
temp_stats: self.temp_stats.delta(&other.temp_stats),
metadata: self.metadata.delta(&other.metadata),
entity_type: self.entity_type.clone(),
duration: self.duration.clone(),
effect_nature: self.effect_nature.clone(),
effect_bounds: self.effect_bounds.clone() - other.effect_bounds.clone(),
entity_type: other.entity_type.clone(),
duration: other.duration.clone(),
effect_nature: other.effect_nature.clone(),
effect_bounds: other.effect_bounds.clone(),
id: Uuid::new_v4(),
}
}

View File

@ -1,6 +1,6 @@
---
source: lib_efo/src/entity/test.rs
expression: "format!(\"{:#?}\", delta2)"
expression: "format!(\"{:#?}{}\", delta2, delta2.full_stats_to_table().unwrap())"
---
Entity {
name: "Bob",
@ -157,6 +157,13 @@ Entity {
effect_nature: Recurring,
effect_bounds: EffectBounds {
min: 0,
max: 0,
max: 3,
},
}
}┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│ DEM │ POP │ GRW │ CRM │ HPY │ ECO │ FOD │ IND │ SCI │ TRD │ MIL │ ARM │ STR │ FRT │ THR │ IFR │ BUR │ TRP │ SPR │ HLT │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │ 0  │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘


View File

@ -0,0 +1,173 @@
---
source: lib_efo/src/entity/test.rs
expression: "format!(\"{:#?}{}\", delta3, delta3.full_stats_to_table().unwrap())"
---
Entity {
name: "Bob->Alice",
id: 00000000-0000-0000-0000-000000000000,
stats: OverallStats {
demographics: GenericStat(
42,
),
population: GenericStat(
42,
),
growth_rate: GenericStat(
42,
),
crime: GenericStat(
42,
),
happiness: GenericStat(
42,
),
economy: GenericStat(
42,
),
food: GenericStat(
42,
),
industry: GenericStat(
42,
),
science: GenericStat(
42,
),
trade: GenericStat(
42,
),
military: GenericStat(
42,
),
army: GenericStat(
42,
),
strength: GenericStat(
42,
),
fortification: GenericStat(
42,
),
threat: GenericStat(
42,
),
infrastructure: GenericStat(
42,
),
bureaucracy: GenericStat(
42,
),
transportation: GenericStat(
42,
),
sprawl: GenericStat(
42,
),
health: GenericStat(
42,
),
},
temp_stats: Some(
OverallStats {
demographics: GenericStat(
5,
),
population: GenericStat(
6,
),
growth_rate: GenericStat(
7,
),
crime: GenericStat(
8,
),
happiness: GenericStat(
9,
),
economy: GenericStat(
10,
),
food: GenericStat(
11,
),
industry: GenericStat(
12,
),
science: GenericStat(
13,
),
trade: GenericStat(
14,
),
military: GenericStat(
15,
),
army: GenericStat(
16,
),
strength: GenericStat(
17,
),
fortification: GenericStat(
18,
),
threat: GenericStat(
19,
),
infrastructure: GenericStat(
20,
),
bureaucracy: GenericStat(
21,
),
transportation: GenericStat(
22,
),
sprawl: GenericStat(
23,
),
health: GenericStat(
24,
),
},
),
metadata: MetaStats {
position: Position(
-11,
-662,
),
capital: Some(
TownId(
5000,
),
),
governor: Some(
CharacterId(
2000,
),
),
faction: Some(
FactionId(
44,
),
),
links: [],
prestige: GenericStat(
2,
),
},
entity_type: Monster,
duration: Permanent,
effect_nature: Recurring,
effect_bounds: EffectBounds {
min: 0,
max: 33,
},
}┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│ DEM │ POP │ GRW │ CRM │ HPY │ ECO │ FOD │ IND │ SCI │ TRD │ MIL │ ARM │ STR │ FRT │ THR │ IFR │ BUR │ TRP │ SPR │ HLT │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │ 42  │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ 5  │ 6  │ 7  │ 8  │ 9  │ 10  │ 11  │ 12  │ 13  │ 14  │ 15  │ 16  │ 17  │ 18  │ 19  │ 20  │ 21  │ 22  │ 23  │ 24  │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘


View File

@ -1,6 +1,6 @@
---
source: lib_efo/src/entity/test.rs
expression: "format!(\"{:#?}\", delta)"
expression: "format!(\"{:#?}{}\", &delta, delta.full_stats_to_table().unwrap())"
---
Entity {
name: "Alice->Bob",
@ -156,11 +156,18 @@ Entity {
-2,
),
},
entity_type: Monster,
entity_type: Town,
duration: Permanent,
effect_nature: Recurring,
effect_bounds: EffectBounds {
min: 0,
max: 30,
max: 3,
},
}
}┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│ DEM │ POP │ GRW │ CRM │ HPY │ ECO │ FOD │ IND │ SCI │ TRD │ MIL │ ARM │ STR │ FRT │ THR │ IFR │ BUR │ TRP │ SPR │ HLT │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │ -42 │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ 5  │ 6  │ 7  │ 8  │ 9  │ 10  │ 11  │ 12  │ 13  │ 14  │ 15  │ 16  │ 17  │ 18  │ 19  │ 20  │ 21  │ 22  │ 23  │ 24  │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘


View File

@ -0,0 +1,68 @@
---
source: lib_efo/src/entity/test.rs
expression: "format!(\"{:#?}\", delta2)"
---
Some(
OverallStats {
demographics: GenericStat(
23,
),
population: GenericStat(
24,
),
growth_rate: GenericStat(
25,
),
crime: GenericStat(
26,
),
happiness: GenericStat(
27,
),
economy: GenericStat(
28,
),
food: GenericStat(
29,
),
industry: GenericStat(
30,
),
science: GenericStat(
31,
),
trade: GenericStat(
32,
),
military: GenericStat(
33,
),
army: GenericStat(
34,
),
strength: GenericStat(
35,
),
fortification: GenericStat(
36,
),
threat: GenericStat(
37,
),
infrastructure: GenericStat(
38,
),
bureaucracy: GenericStat(
39,
),
transportation: GenericStat(
40,
),
sprawl: GenericStat(
41,
),
health: GenericStat(
42,
),
},
)

View File

@ -0,0 +1,68 @@
---
source: lib_efo/src/entity/test.rs
expression: "format!(\"{:#?}\", delta3)"
---
Some(
OverallStats {
demographics: GenericStat(
33,
),
population: GenericStat(
34,
),
growth_rate: GenericStat(
35,
),
crime: GenericStat(
36,
),
happiness: GenericStat(
37,
),
economy: GenericStat(
38,
),
food: GenericStat(
39,
),
industry: GenericStat(
40,
),
science: GenericStat(
41,
),
trade: GenericStat(
42,
),
military: GenericStat(
43,
),
army: GenericStat(
44,
),
strength: GenericStat(
45,
),
fortification: GenericStat(
46,
),
threat: GenericStat(
47,
),
infrastructure: GenericStat(
48,
),
bureaucracy: GenericStat(
49,
),
transportation: GenericStat(
50,
),
sprawl: GenericStat(
51,
),
health: GenericStat(
52,
),
},
)

View File

@ -0,0 +1,5 @@
---
source: lib_efo/src/entity/test.rs
expression: "format!(\"{:#?}\", delta4)"
---
None

View File

@ -403,10 +403,25 @@ fn snapshot_entity_delta() {
// Compute the delta
let mut delta = e1.delta(&e2);
let mut delta2 = e2.delta(&e2);
let mut delta3 = e2.delta(&e1);
delta.id = Uuid::nil();
delta2.id = Uuid::nil();
assert_snapshot!(format!("{:#?}", delta));
assert_snapshot!(format!("{:#?}", delta2));
delta3.id = Uuid::nil();
assert_snapshot!(format!(
"{:#?}{}",
&delta,
delta.full_stats_to_table().unwrap()
));
assert_snapshot!(format!(
"{:#?}{}",
delta2,
delta2.full_stats_to_table().unwrap()
));
assert_snapshot!(format!(
"{:#?}{}",
delta3,
delta3.full_stats_to_table().unwrap()
));
}
#[test]
@ -421,8 +436,14 @@ fn snapshot_option_stats_delta() {
// `delta` is commutative for the purpose of the snapshot
let delta = opt_a.delta(&opt_b);
let delta2 = None.delta(&opt_b);
let delta3 = opt_a.delta(&None);
let delta4 = None::<OverallStats>.delta(&None);
assert_snapshot!(format!("{:#?}", delta));
assert_snapshot!(format!("{:#?}", delta2));
assert_snapshot!(format!("{:#?}", delta3));
assert_snapshot!(format!("{:#?}", delta4));
}
#[test]
@ -507,3 +528,14 @@ fn snapshot_modify_effect_bounds() {
assert_snapshot!(format!("{:#?}", e));
}
#[test]
fn test_rng() {
Entity::create_rng(&EntityType::Character, &crate::utils::RngLevel::Zero).unwrap();
Entity::create_rng(&EntityType::Player, &crate::utils::RngLevel::Low).unwrap();
Entity::create_rng(&EntityType::Town, &crate::utils::RngLevel::Med).unwrap();
Entity::create_rng(&EntityType::Monster, &crate::utils::RngLevel::High).unwrap();
Entity::create_rng(&EntityType::Blocker, &crate::utils::RngLevel::Legendary).unwrap();
Entity::create_rng(&EntityType::Event, &crate::utils::RngLevel::Mixed).unwrap();
Entity::create_rng(&EntityType::Event, &crate::utils::RngLevel::Flawed).unwrap();
}

View File

@ -368,4 +368,21 @@ mod tests {
println!("{values:#?}");
// panic!()
}
#[test]
fn test_most_naming() {
let _ = NAMING.generate_character_name();
let _ = NAMING.generate_town_name();
let _ = NAMING.random_event_idea().expect("Couldn't generate event");
let _ = NAMING.random_event_name();
let _ = NAMING.generate_blocker_name();
let _ = NAMING.generate_calamity_name();
let _ = NAMING.generate_long_character_name();
let _ = NAMING.generate_exotic_character_name();
}
#[test]
fn event_description() {
let event = NAMING.random_event_idea().expect("Generating event");
let _ = event.oneline_display();
}
}