Merge branch 'sam/asset-validation-tests' into 'master'

Added Item Validation Test

See merge request veloren/veloren!1849
This commit is contained in:
Marcel 2021-03-04 15:46:12 +00:00
commit 875bdd8d71
60 changed files with 224 additions and 115 deletions

View File

@ -3,7 +3,7 @@ ItemDef(
description: "Greener than an orc's snout.",
kind: Ingredient(
kind: "Grass",
)
),
quality: Common,
tags: [],
)

View File

@ -3,7 +3,7 @@ ItemDef(
description: "Greener than an orc's snout.",
kind: Ingredient(
kind: "Grass",
)
),
quality: Common,
tags: [],
)

View File

@ -3,7 +3,7 @@ ItemDef(
description: "Greener than an orc's snout.",
kind: Ingredient(
kind: "Grass",
)
),
quality: Common,
tags: [],
)

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 2.0,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.0,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.1,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.6,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.75,
poise_strength: 1.0,
speed: 0.85,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.1,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.3,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.0,
poise_strength: 1.0,
speed: 1.2,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.2,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 2.0,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Epic,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.5,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.4,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.3,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.8,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.7,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.8,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: Low,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.5,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Low,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.6,
poise_strength: 1.0,
speed: 1.2,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.8,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.2,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.0,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.6,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.5,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.4,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.3,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.1,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Axe,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 2.0,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Epic,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.5,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.4,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.2,
poise_strength: 1.0,
speed: 1.2,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 0.7,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 1.0,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 0.8,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: Low,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Hammer,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.5,
power: 0.5,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Low,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.45,
poise_strength: 1.0,
speed: 1.3,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 2.0,
poise_strength: 1.0,
speed: 0.75,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.75,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.65,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.75,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.85,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.3,
poise_strength: 1.0,
speed: 1.2,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.7,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.4,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.6,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.0,
poise_strength: 1.0,
speed: 1.0,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.9,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.2,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 0.8,
poise_strength: 1.0,
speed: 1.2,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.1,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Common,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.95,
poise_strength: 1.0,
speed: 0.8,
),
)),
)),
quality: High,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 2.1,
poise_strength: 1.0,
speed: 0.9,
),
)),
)),
quality: Epic,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.9,
poise_strength: 1.0,
speed: 1.1,
),
)),
)),
quality: Epic,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.5,
poise_strength: 1.0,
speed: 0.75,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.3,
poise_strength: 1.0,
speed: .95,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.05,
poise_strength: 1.0,
speed: 1.2,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -4,12 +4,12 @@ ItemDef(
kind: Tool((
kind: Sword,
hands: One,
stats: (
stats: Direct((
equip_time_secs: 0.4,
power: 1.2,
poise_strength: 1.0,
speed: 1.05,
),
)),
)),
quality: Moderate,
tags: [],

View File

@ -248,3 +248,112 @@ impl Compound for Directory {
Ok(Directory(files))
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_assets_items() {
// TODO: Figure out how to get file name in error so only a single glob is
// needed
// Separated out into subsections so that error more descriptive
crate::comp::item::Item::new_from_asset_glob("common.items.armor.*")
.expect("Failed to iterate over armors.");
crate::comp::item::Item::new_from_asset_glob("common.items.boss_drops.*")
.expect("Failed to iterate over boss drops.");
crate::comp::item::Item::new_from_asset_glob("common.items.consumable.*")
.expect("Failed to iterate over consumables.");
crate::comp::item::Item::new_from_asset_glob("common.items.crafting_ing.*")
.expect("Failed to iterate over crafting ingredients.");
crate::comp::item::Item::new_from_asset_glob("common.items.crafting_tools.*")
.expect("Failed to iterate over crafting tools.");
crate::comp::item::Item::new_from_asset_glob("common.items.debug.*")
.expect("Failed to iterate over debug items.");
crate::comp::item::Item::new_from_asset_glob("common.items.flowers.*")
.expect("Failed to iterate over flower items.");
crate::comp::item::Item::new_from_asset_glob("common.items.food.*")
.expect("Failed to iterate over food items.");
crate::comp::item::Item::new_from_asset_glob("common.items.glider.*")
.expect("Failed to iterate over gliders.");
crate::comp::item::Item::new_from_asset_glob("common.items.grasses.*")
.expect("Failed to iterate over grasses.");
crate::comp::item::Item::new_from_asset_glob("common.items.lantern.*")
.expect("Failed to iterate over lanterns.");
crate::comp::item::Item::new_from_asset_glob("common.items.npc_armor.*")
.expect("Failed to iterate over npc armors.");
crate::comp::item::Item::new_from_asset_glob("common.items.npc_weapons.*")
.expect("Failed to iterate over npc weapons.");
crate::comp::item::Item::new_from_asset_glob("common.items.ore.*")
.expect("Failed to iterate over ores.");
crate::comp::item::Item::new_from_asset_glob("common.items.tag_examples.*")
.expect("Failed to iterate over tag examples.");
crate::comp::item::Item::new_from_asset_glob("common.items.testing.*")
.expect("Failed to iterate over testing items.");
crate::comp::item::Item::new_from_asset_glob("common.items.utility.*")
.expect("Failed to iterate over utility items.");
// Checks each weapon type to allow errors to be located more easily
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.axe.*")
.expect("Failed to iterate over axes.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.axe_1h.*")
.expect("Failed to iterate over 1h axes.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.bow.*")
.expect("Failed to iterate over bows.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.dagger.*")
.expect("Failed to iterate over daggers.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.empty.*")
.expect("Failed to iterate over empty.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.hammer.*")
.expect("Failed to iterate over hammers.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.hammer_1h.*")
.expect("Failed to iterate over 1h hammers.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.sceptre.*")
.expect("Failed to iterate over sceptres.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.shield.*")
.expect("Failed to iterate over shields.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.staff.*")
.expect("Failed to iterate over staffs.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.sword.*")
.expect("Failed to iterate over swords.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.sword_1h.*")
.expect("Failed to iterate over 1h swords.");
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.tool.*")
.expect("Failed to iterate over tools.");
// Checks all weapons should more weapons be added later
crate::comp::item::Item::new_from_asset_glob("common.items.weapons.*")
.expect("Failed to iterate over weapons.");
// Final at the end to account for a new folder being added
crate::comp::item::Item::new_from_asset_glob("common.items.*")
.expect("Failed to iterate over item folders.");
}
}