snapshot tests

This commit is contained in:
Robin Appelman 2023-03-16 22:40:48 +01:00
commit fbe3eee614
8 changed files with 1603 additions and 5 deletions

View file

@ -190,6 +190,12 @@ impl<T: PartialEq> PartialEq for ClassMap<T> {
}
}
impl<T> From<ClassMap<T>> for [T; 10] {
fn from(value: ClassMap<T>) -> Self {
value.0
}
}
/// Optimized subject id
#[derive(Copy, Clone, Eq, PartialEq, Debug, Ord, PartialOrd, Hash)]
pub enum SubjectId {

View file

@ -8,10 +8,10 @@ use std::collections::BTreeMap;
#[derive(Debug, Serialize, Default, PartialEq)]
pub struct ClassStats {
kills: ClassMap<u8>,
deaths: ClassMap<u8>,
assists: ClassMap<u8>,
damage: ClassMap<u16>,
pub kills: ClassMap<u8>,
pub deaths: ClassMap<u8>,
pub assists: ClassMap<u8>,
pub damage: ClassMap<u16>,
}
#[derive(Default)]

View file

@ -32,3 +32,12 @@ impl PlayerSpecificData for HealSpread {
self
}
}
impl IntoIterator for HealSpread {
type Item = (SteamId3, u32);
type IntoIter = <BTreeMap<SteamId3, u32> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}

View file

@ -170,7 +170,7 @@ macro_rules! handler {
}
pub struct [<$name PerSubjectOutput>] {
pub $($child: <$ty as $crate::EventHandler>::PerSubjectOutput),*
$(pub $child: <$ty as $crate::EventHandler>::PerSubjectOutput),*
}
impl serde::Serialize for [<$name PerSubjectOutput>] {