More coverage
This commit is contained in:
parent
a155e53b30
commit
51bbf45b57
|
|
@ -29,3 +29,5 @@ cache.out
|
|||
tarpaulin-report.html
|
||||
*.bkp
|
||||
coverage/
|
||||
testdata/
|
||||
snapshots/
|
||||
|
|
|
|||
|
|
@ -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: 28%"><title>test-coverage: 28%</title><linearGradient id="bms-6ed4d3a1c27a31b3" 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-6ed4d3a1c27a31b3"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-6ed4d3a1c27a31b3)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#e05d44"/><rect width="122" height="18" fill="url(#bms-6ed4d3a1c27a31b3)"/></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">28%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">28%</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: 34%"><title>test-coverage: 34%</title><linearGradient id="bms-748b3214a2ea76fd" 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-748b3214a2ea76fd"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-748b3214a2ea76fd)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#e05d44"/><rect width="122" height="18" fill="url(#bms-748b3214a2ea76fd)"/></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">34%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">34%</text></g></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
|
@ -8,7 +8,7 @@ more_fields = {path ="../more_fields"}
|
|||
comfy-table = "7.1.4"
|
||||
csv = "1.3.1"
|
||||
probability = "0.20.3"
|
||||
rusqlite = { version = "0.33.0" } # , features = ["bundled"]
|
||||
rusqlite = { version = "0.33.0" , features = ["bundled"]}
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
serde_rusqlite = "0.37.0"
|
||||
serde_json = { version = "1.0.138", features = ["alloc"] }
|
||||
|
|
@ -24,10 +24,9 @@ regex = "1.11.1"
|
|||
pretty_assertions = "^1.4"
|
||||
logos = "^0.15"
|
||||
clap = { version = "4.5.30", features = ["derive"] }
|
||||
insta = { version = "1.42.2", features = ["yaml"] }
|
||||
|
||||
[[bench]]
|
||||
name = "iter_creation"
|
||||
harness = false
|
||||
|
||||
# [lints.rust]
|
||||
# unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ pub struct RefinedEquipement {
|
|||
}
|
||||
|
||||
/// The complete equipement list, refined with all advanced stats
|
||||
#[derive(Serialize)]
|
||||
pub struct RefinedEquipementList {
|
||||
/// Inner list of Refined Equipements
|
||||
// TODO[!]: The use of pub stays for the usage of the example showcasing the macro in export
|
||||
|
|
@ -414,3 +415,49 @@ macro_rules! sort_by_size_then {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{AdvancedStats, RefinedEquipementList};
|
||||
use crate::{
|
||||
interfaces::{RecipeCollection, ToAnalysis},
|
||||
weaponry_structs::{
|
||||
Equipement, InitialEquipementList, equipement_structs::InnerEquipementStats,
|
||||
},
|
||||
};
|
||||
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn test_export_tex() {
|
||||
todo!()
|
||||
}
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn test_export_csv() {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_analysis() {
|
||||
let ls = RefinedEquipementList::default();
|
||||
let mut ls = ls.inner_filter(|c| c.inner.rarity == 0);
|
||||
ls.inner_sort(|l, r| l.inner.rarity.cmp(&r.inner.rarity));
|
||||
let _ = std::fs::create_dir("testdata");
|
||||
let _ = std::fs::remove_file("testdata/testgraph.html");
|
||||
let _ = std::fs::remove_file("testdata/testgraph_plots.html");
|
||||
assert!(ls.write_html("testgraph").is_ok());
|
||||
}
|
||||
#[test]
|
||||
fn test_scenario() {
|
||||
let ls = RefinedEquipementList::default();
|
||||
let _chart = ls.make_cross_plots_graph();
|
||||
let _chart2 = ls.make_regular_graph();
|
||||
}
|
||||
#[test]
|
||||
fn test_impls() {
|
||||
let a = AdvancedStats::from(&InnerEquipementStats::random_new());
|
||||
let _ = serde_json::to_string(&a);
|
||||
let ls = InitialEquipementList::from_vectored(vec![Equipement::default()]);
|
||||
let _ = RefinedEquipementList::from(ls);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ pub struct IndividualElementsScenario {
|
|||
|
||||
impl CrossRecipeScenario {
|
||||
/// Generate all the operations to be processed with the current config
|
||||
// TODO[!]: Consider adding to interface
|
||||
///
|
||||
/// This is a very implementation specific step and function internally as a helper
|
||||
fn generate_selected_operation(
|
||||
&self,
|
||||
) -> Result<Vec<InitialEquipementList>, FatalEquipementError> {
|
||||
|
|
@ -141,6 +142,7 @@ impl Scenario for CrossRecipeScenario {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{ConfigEquipementScenario, CrossRecipeScenario};
|
||||
use crate::{
|
||||
interfaces::{RecipeDatabase, Scenario},
|
||||
weaponry_structs::{
|
||||
|
|
@ -149,13 +151,8 @@ mod test {
|
|||
},
|
||||
};
|
||||
|
||||
use super::{ConfigEquipementScenario, CrossRecipeScenario};
|
||||
|
||||
#[test]
|
||||
fn test_scenario() {}
|
||||
#[test]
|
||||
fn test_deserde_into() {
|
||||
let b = CrossRecipeScenario {
|
||||
fn mock_cross_with_db() -> CrossRecipeScenario {
|
||||
let cross_rec_scenario = CrossRecipeScenario {
|
||||
database: EquipementDatabase {
|
||||
conn: rusqlite::Connection::open_in_memory().unwrap(),
|
||||
},
|
||||
|
|
@ -168,16 +165,57 @@ mod test {
|
|||
finishing: None,
|
||||
},
|
||||
};
|
||||
|
||||
b.get_database()
|
||||
cross_rec_scenario
|
||||
.get_database()
|
||||
.initialize_empty_table::<DatabaseEquipementStats>("Finishing")
|
||||
.unwrap();
|
||||
b.get_database()
|
||||
cross_rec_scenario
|
||||
.get_database()
|
||||
.insert_row::<DatabaseEquipementStats>(
|
||||
"Finishing",
|
||||
DatabaseEquipementStats::random_new(),
|
||||
)
|
||||
.unwrap();
|
||||
cross_rec_scenario
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_gen() {
|
||||
let refined_list = CrossRecipeScenario::new_with_config(ConfigEquipementScenario {
|
||||
table_name: "Equipements".into(),
|
||||
db_path: String::new(),
|
||||
shape: None,
|
||||
materials: None,
|
||||
nature: None,
|
||||
finishing: None,
|
||||
})
|
||||
.unwrap();
|
||||
assert!(refined_list.generate_selected_operation().is_err());
|
||||
}
|
||||
#[test]
|
||||
fn test_scenario_with_snapshot() {
|
||||
let path_a = "../databases/weapons.db";
|
||||
let path_b = "./databases/weapons.db";
|
||||
let path = if std::fs::exists(path_a).unwrap() {
|
||||
path_a
|
||||
} else {
|
||||
path_b
|
||||
};
|
||||
let refined_list = CrossRecipeScenario::new_with_config(ConfigEquipementScenario {
|
||||
table_name: "Equipements".into(),
|
||||
db_path: path.into(),
|
||||
shape: Some(()),
|
||||
materials: Some(1),
|
||||
nature: Some(()),
|
||||
finishing: Some(()),
|
||||
})
|
||||
.unwrap();
|
||||
let final_list = refined_list.generate_refined_recipes().unwrap();
|
||||
insta::assert_yaml_snapshot!(final_list);
|
||||
}
|
||||
#[test]
|
||||
fn test_deserde_into() {
|
||||
let b = mock_cross_with_db();
|
||||
<CrossRecipeScenario as Scenario>::get_database(&b);
|
||||
let r = b
|
||||
.deserde_into_processed_representation::<EqFinishing>(None)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,515 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Ravenous Balancing</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.2/dist/echarts.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/echarts-gl@2.0.9/dist/echarts-gl.min.js"></script>
|
||||
<style> .container { display: flex; justify-content: center; align-items: center; } .item { margin: auto; } </style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="item" id="chart" style="width: 4000px; height: 2000px"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var chart = echarts.init(document.getElementById('chart'), 'dark', { renderer: 'canvas' });
|
||||
var option = {
|
||||
"title": [
|
||||
{
|
||||
"text": "Damage for all cross-gen products (10 Elements)",
|
||||
"left": "center"
|
||||
}
|
||||
],
|
||||
"tooltip": {
|
||||
"trigger": "axis"
|
||||
},
|
||||
"legend": {
|
||||
"left": 10,
|
||||
"top": "middle",
|
||||
"orient": "vertical",
|
||||
"data": [
|
||||
{
|
||||
"name": "max_damage_per_attack"
|
||||
},
|
||||
{
|
||||
"name": "armor_break_per_attack"
|
||||
},
|
||||
{
|
||||
"name": "avg_damage_2a_safe"
|
||||
},
|
||||
{
|
||||
"name": "avg_damage_2a_huge_hit"
|
||||
},
|
||||
{
|
||||
"name": "variance"
|
||||
},
|
||||
{
|
||||
"name": "variance_pct"
|
||||
},
|
||||
{
|
||||
"name": "scenario_damage"
|
||||
},
|
||||
{
|
||||
"name": "defensive"
|
||||
},
|
||||
{
|
||||
"name": "earlygame_sustained_damage_per_turn"
|
||||
},
|
||||
{
|
||||
"name": "midgame_sustained_damage_per_turn"
|
||||
},
|
||||
{
|
||||
"name": "endgame_sustained_damage_per_turn"
|
||||
}
|
||||
]
|
||||
},
|
||||
"toolbox": {
|
||||
"feature": {
|
||||
"saveAsImage": {},
|
||||
"restore": {},
|
||||
"dataZoom": {
|
||||
"yAxisIndex": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
"grid": [
|
||||
{
|
||||
"containLabel": true
|
||||
}
|
||||
],
|
||||
"xAxis": [
|
||||
{
|
||||
"type": "category",
|
||||
"data": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"yAxis": [
|
||||
{}
|
||||
],
|
||||
"dataZoom": [
|
||||
{
|
||||
"type": "inside",
|
||||
"start": 0.0,
|
||||
"end": 100.0
|
||||
},
|
||||
{
|
||||
"start": 0.0,
|
||||
"end": 100.0
|
||||
}
|
||||
],
|
||||
"series": [
|
||||
{
|
||||
"type": "line",
|
||||
"name": "max_damage_per_attack",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "armor_break_per_attack",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "avg_damage_2a_safe",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "avg_damage_2a_huge_hit",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "variance",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "variance_pct",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "scenario_damage",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "defensive",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "earlygame_sustained_damage_per_turn",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "midgame_sustained_damage_per_turn",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"name": "endgame_sustained_damage_per_turn",
|
||||
"markPoint": {
|
||||
"data": [
|
||||
{
|
||||
"type": "max",
|
||||
"name": "Max"
|
||||
},
|
||||
{
|
||||
"type": "min",
|
||||
"name": "Min"
|
||||
}
|
||||
]
|
||||
},
|
||||
"markLine": {
|
||||
"data": [
|
||||
{
|
||||
"type": "average",
|
||||
"name": "Avg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
chart.setOption(option);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue