New: add clan_tag

This commit is contained in:
Pavel Perestoronin committed 2022-12-03 20:34:44 +01:00
1 parent 7376cfc97e
commit e1f38014b8
2 files changed
+15

No files matched your search

+3
View File
@@ -57,6 +57,9 @@ pub struct PlayerInfo {
/// Player's team assignment.
#[prost(enumeration = "TeamNumber", tag = "3")]
pub team_number: i32,
#[prost(string, optional, tag = "5")]
pub clan_tag: Option<String>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, prost::Enumeration)]
+12
View File
@@ -86,3 +86,15 @@ fn player_results_ok() -> Result<()> {
Ok(())
}
#[test]
fn clan_tags_ok() -> Result<()> {
let battle_results = Replay::open(File::open("tests/replays/player_results_ok.wotbreplay")?)?
.read_battle_results()?;
assert_eq!(battle_results.players[1].info.clan_tag.as_deref(), Some("AN0NY"));
assert_eq!(battle_results.players[10].info.clan_tag.as_deref(), Some("BBS"));
assert_eq!(battle_results.players[11].info.clan_tag, None);
Ok(())
}