gzip test data

This commit is contained in:
Robin Appelman 2023-04-02 18:07:41 +02:00
commit 5defd55037
23 changed files with 62 additions and 34005 deletions

View file

@ -32,6 +32,7 @@ insta = { version = "1.28.0", features = ["json"] }
test-case = "3.0.0" test-case = "3.0.0"
rayon = "1.7.0" rayon = "1.7.0"
indicatif = { version = "0.17.3", features = ["rayon"] } indicatif = { version = "0.17.3", features = ["rayon"] }
flate2 = "1.0.25"
[[bench]] [[bench]]
name = "bench" name = "bench"

View file

@ -1,21 +1,28 @@
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
use std::fs::read_to_string; use flate2::read::GzDecoder;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::time::Duration; use std::time::Duration;
use tf_log_parser::{parse, EventHandler, GameEvent, LineSplit, LogHandler, RawEvent, SubjectMap}; use tf_log_parser::{parse, EventHandler, GameEvent, LineSplit, LogHandler, RawEvent, SubjectMap};
fn gz_read<P: AsRef<Path>>(path: P) -> String {
let mut content = String::new();
GzDecoder::new(File::open(path).expect("failed to open"))
.read_to_string(&mut content)
.expect("failed to read");
content
}
pub fn parse_benchmark(c: &mut Criterion) { pub fn parse_benchmark(c: &mut Criterion) {
let input = read_to_string("test_data/log_2892242.log").unwrap(); let input = gz_read("tests/data/log_2892242.log.gz");
c.bench_function("parse log 2892242", |b| b.iter(|| parse(black_box(&input)))); c.bench_function("parse log 2892242", |b| b.iter(|| parse(black_box(&input))));
} }
pub fn parse_event(c: &mut Criterion) { pub fn parse_event(c: &mut Criterion) {
let input = read_to_string("test_data/log_2892242.log").unwrap(); let input = gz_read("tests/data/log_2892242.log.gz");
let raw: Vec<_> = input let raw: Vec<_> = LineSplit::new(&input).flat_map(RawEvent::parse).collect();
.split("L ")
.filter(|line| !line.is_empty())
.flat_map(RawEvent::parse)
.collect();
c.bench_function("parse event 2892242", |b| { c.bench_function("parse event 2892242", |b| {
b.iter(|| { b.iter(|| {
black_box(&raw).iter().flat_map(GameEvent::parse).count(); black_box(&raw).iter().flat_map(GameEvent::parse).count();
@ -24,7 +31,7 @@ pub fn parse_event(c: &mut Criterion) {
} }
pub fn parse_raw(c: &mut Criterion) { pub fn parse_raw(c: &mut Criterion) {
let input = read_to_string("test_data/log_2892242.log").unwrap(); let input = gz_read("tests/data/log_2892242.log.gz");
c.bench_function("parse raw 2892242", |b| { c.bench_function("parse raw 2892242", |b| {
b.iter(|| { b.iter(|| {
LineSplit::new(black_box(&input)) LineSplit::new(black_box(&input))
@ -36,10 +43,8 @@ pub fn parse_raw(c: &mut Criterion) {
} }
pub fn handle_event(c: &mut Criterion) { pub fn handle_event(c: &mut Criterion) {
let input = read_to_string("test_data/log_2892242.log").unwrap(); let input = gz_read("tests/data/log_2892242.log.gz");
let events: Vec<_> = input let events: Vec<_> = LineSplit::new(&input)
.split("L ")
.filter(|line| !line.is_empty())
.flat_map(RawEvent::parse) .flat_map(RawEvent::parse)
.map(|raw| (GameEvent::parse(&raw).unwrap(), raw)) .map(|raw| (GameEvent::parse(&raw).unwrap(), raw))
.collect(); .collect();

View file

@ -3,7 +3,7 @@ use std::convert::TryFrom;
use tf_log_parser::raw_event::RawSubject; use tf_log_parser::raw_event::RawSubject;
use tf_log_parser::{parse, LineSplit, RawEvent, SubjectId}; use tf_log_parser::{parse, LineSplit, RawEvent, SubjectId};
static LOG: &str = include_str!("../test_data/log_2892242.log"); static LOG: &str = include_str!("../tests/data/log_2892242.log");
pub fn parse_benchmark() { pub fn parse_benchmark() {
black_box(parse(black_box(LOG))).ok(); black_box(parse(black_box(LOG))).ok();

View file

@ -171,7 +171,15 @@ impl<'a> Iterator for LineSplit<'a> {
#[test] #[test]
fn test_split() { fn test_split() {
let input = std::fs::read_to_string("test_data/log_2892242.log").unwrap(); use flate2::read::GzDecoder;
use std::fs::File;
use std::io::Read;
let mut input = String::new();
GzDecoder::new(File::open("tests/data/log_2892242.log.gz").expect("failed to open"))
.read_to_string(&mut input)
.expect("failed to read");
let split: Vec<_> = LineSplit::new(&input).collect(); let split: Vec<_> = LineSplit::new(&input).collect();
let expected: Vec<_> = input let expected: Vec<_> = input
.split("L ") .split("L ")

View file

@ -333,30 +333,3 @@ fn test_parse_raw() {
raw raw
); );
} }
#[test]
fn test_parse_all_valid() {
use std::io::Read;
let files = [
"test_data/log_6s.log",
"test_data/log_hl.log",
"test_data/log_bball.log",
"test_data/log_2788889.log",
"test_data/log_2892242.log",
];
let mut buff = String::new();
for file in files {
buff.clear();
std::fs::File::open(file)
.unwrap()
.read_to_string(&mut buff)
.unwrap();
for line in buff.trim().split("L ").filter(|line| !line.is_empty()) {
if line.starts_with("L ") {
RawEvent::parse(line).unwrap();
}
}
}
}

View file

@ -1,696 +0,0 @@
{
"game": {
"rounds": [],
"toatlLength": 0
},
"chat": [
{
"timeInSeconds": 0,
"steamid": "Console",
"name": "Console",
"team": "Console",
"message": "ETF2L config (2020-01-20) loaded."
},
{
"timeInSeconds": 0,
"steamid": "Console",
"name": "Console",
"team": "Console",
"message": "* Please check that the settings are correct for this game mode!"
},
{
"timeInSeconds": 0,
"steamid": "Console",
"name": "Console",
"team": "Console",
"message": "* You must record POV demos and take screenshots of all results."
},
{
"timeInSeconds": 0,
"steamid": "[U:1:861133286]",
"name": "ONE-TYZ",
"team": "Spectator",
"message": "негр"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:861133286]",
"name": "ONE-TYZ",
"team": "Spectator",
"message": "можно я зайду просто попрыгаю?"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:861133286]",
"name": "ONE-TYZ",
"team": "Spectator",
"message": "эксперты"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:352975440]",
"name": "Want hug",
"team": "Spectator",
"message": "холокост?"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:861133286]",
"name": "ONE-TYZ",
"team": "Red",
"message": "сразу видно что у нас большие яйца."
},
{
"timeInSeconds": 0,
"steamid": "[U:1:479446967]",
"name": "Grigoriy",
"team": "Blue",
"message": "кирил"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:479446967]",
"name": "Grigoriy",
"team": "Blue",
"message": "мы ваши братья"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:479446967]",
"name": "Grigoriy",
"team": "Blue",
"message": "мы в чистилище"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:479446967]",
"name": "Grigoriy",
"team": "Blue",
"message": "Pootis"
},
{
"timeInSeconds": 0,
"steamid": "Console",
"name": "Console",
"team": "Console",
"message": "Please donate to support serveme.tf and get access to more servers"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:232573199]",
"name": раалwings",
"team": "Red",
"message": "antibite"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:232573199]",
"name": раалwings",
"team": "Red",
"message": "mojno svami switch?"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:479446967]",
"name": "Grigoriy",
"team": "Blue",
"message": "нет"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:129852188]",
"name": "Fin",
"team": "Blue",
"message": "Cоболезнуем диппи"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:352975440]",
"name": "Want hug",
"team": "Spectator",
"message": "6?"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:352975440]",
"name": "Want hug",
"team": "Spectator",
"message": "4?"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:352975440]",
"name": "Want hug",
"team": "Spectator",
"message": "2"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:450758345]",
"name": "babyrage",
"team": "Red",
"message": "пожалуйста"
},
{
"timeInSeconds": 0,
"steamid": "[U:1:450758345]",
"name": "babyrage",
"team": "Red",
"message": "готов вверх"
},
{
"timeInSeconds": 33,
"steamid": "[U:1:213002038]",
"name": "ᗩ",
"team": "Blue",
"message": "мне астерикс сказал я бессмертный"
},
{
"timeInSeconds": 42,
"steamid": "[U:1:232573199]",
"name": раалwings",
"team": "Red",
"message": "LOL?"
},
{
"timeInSeconds": 44,
"steamid": "[U:1:24668429]",
"name": "little pogchamp",
"team": "Blue",
"message": "¯\\_(ツ)_/¯"
},
{
"timeInSeconds": 62,
"steamid": "[U:1:352975440]",
"name": "Want hug",
"team": "Spectator",
"message": "знач не умер он просто на респу телепортнулся"
},
{
"timeInSeconds": 254,
"steamid": "[U:1:169048576]",
"name": "Kumis",
"team": "Blue",
"message": "BLYAT"
},
{
"timeInSeconds": 261,
"steamid": "[U:1:352975440]",
"name": "Want hug",
"team": "Spectator",
"message": "че"
},
{
"timeInSeconds": 361,
"steamid": "[U:1:213002038]",
"name": "ᗩ",
"team": "Blue",
"message": "слав убейся умоляю..."
},
{
"timeInSeconds": 437,
"steamid": "[U:1:205097719]",
"name": "丂匚尺ㄖ千ㄒ",
"team": "Red",
"message": "!REP CLAV"
},
{
"timeInSeconds": 493,
"steamid": "[U:1:352975440]",
"name": "Want hug",
"team": "Spectator",
"message": "пупсик крутой!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1"
},
{
"timeInSeconds": 535,
"steamid": "[U:1:479446967]",
"name": "Grigoriy",
"team": "Blue",
"message": "ФЧФЧФЧ"
}
],
"healspread": {
"[U:1:129852188]": {
"[U:1:458841022]": 2129,
"[U:1:213002038]": 2434,
"[U:1:479446967]": 1813,
"[U:1:169048576]": 520,
"[U:1:24668429]": 1045
},
"[U:1:189526172]": {
"[U:1:861133286]": 495,
"[U:1:232573199]": 696,
"[U:1:205097719]": 471,
"[U:1:450758345]": 1450,
"[U:1:374702019]": 1207
}
},
"killstreaks": [
{
"steamid": "[U:1:458841022]",
"streak": 3,
"time": 286
},
{
"steamid": "[U:1:479446967]",
"streak": 4,
"time": 334
},
{
"steamid": "[U:1:232573199]",
"streak": 3,
"time": 509
},
{
"steamid": "[U:1:213002038]",
"streak": 4,
"time": 512
},
{
"steamid": "[U:1:450758345]",
"streak": 3,
"time": 516
}
],
"playerClasses": {},
"players": {
"[U:1:129852188]": {
"team": "Blue",
"kills": 0,
"assists": 9,
"deaths": 5,
"damage": 303,
"suicides": 0,
"damageTaken": 1509,
"charges": 3,
"chargesByType": {
"medigun": 3
},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 7941,
"healingReceived": 0,
"medkits": 6,
"medkitsHp": 197,
"backstabs": 0,
"capturesPoint": 4,
"capturesIntel": 0,
"longestKillStreak": 0,
"currentKillStreak": 0,
"medicstats": {
"advantagesLost": 0,
"biggestAdvantageLost": 0,
"nearFullChargeDeaths": 0,
"deathsAfterUber": 1,
"avgTimeBeforeFirstHealing": 13.866666666666665,
"avgTimeToBuild": 66,
"avgTimeToUse": 31.333333333333332,
"avgUberLength": 7.033333333333334
}
},
"[U:1:458841022]": {
"team": "Blue",
"kills": 15,
"assists": 5,
"deaths": 7,
"damage": 4866,
"suicides": 0,
"damageTaken": 1943,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 1,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 2129,
"medkits": 20,
"medkitsHp": 741,
"backstabs": 0,
"capturesPoint": 4,
"capturesIntel": 0,
"longestKillStreak": 5,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:189526172]": {
"team": "Red",
"kills": 0,
"assists": 2,
"deaths": 11,
"damage": 408,
"suicides": 0,
"damageTaken": 2430,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 4319,
"healingReceived": 0,
"medkits": 1,
"medkitsHp": 30,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 0,
"currentKillStreak": 0,
"medicstats": {
"advantagesLost": 0,
"biggestAdvantageLost": 0,
"nearFullChargeDeaths": 0,
"deathsAfterUber": 0,
"avgTimeBeforeFirstHealing": 16.136363636363637,
"avgTimeToBuild": 0,
"avgTimeToUse": 0,
"avgUberLength": 0
}
},
"[U:1:861133286]": {
"team": "Red",
"kills": 7,
"assists": 0,
"deaths": 11,
"damage": 2140,
"suicides": 0,
"damageTaken": 1959,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 5,
"headshotKills": 0,
"healing": 0,
"healingReceived": 495,
"medkits": 17,
"medkitsHp": 761,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 2,
"currentKillStreak": 2,
"medicstats": null
},
"[U:1:232573199]": {
"team": "Red",
"kills": 14,
"assists": 3,
"deaths": 8,
"damage": 2954,
"suicides": 0,
"damageTaken": 2208,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 696,
"medkits": 12,
"medkitsHp": 346,
"backstabs": 0,
"capturesPoint": 1,
"capturesIntel": 0,
"longestKillStreak": 3,
"currentKillStreak": 1,
"medicstats": null
},
"[U:1:213002038]": {
"team": "Blue",
"kills": 12,
"assists": 4,
"deaths": 6,
"damage": 2775,
"suicides": 1,
"damageTaken": 2183,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 2,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 2434,
"medkits": 21,
"medkitsHp": 638,
"backstabs": 0,
"capturesPoint": 3,
"capturesIntel": 0,
"longestKillStreak": 4,
"currentKillStreak": 2,
"medicstats": null
},
"[U:1:205097719]": {
"team": "Red",
"kills": 5,
"assists": 4,
"deaths": 11,
"damage": 2068,
"suicides": 0,
"damageTaken": 2375,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 471,
"medkits": 9,
"medkitsHp": 205,
"backstabs": 0,
"capturesPoint": 2,
"capturesIntel": 0,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:479446967]": {
"team": "Blue",
"kills": 17,
"assists": 2,
"deaths": 5,
"damage": 3448,
"suicides": 0,
"damageTaken": 2097,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1813,
"medkits": 16,
"medkitsHp": 404,
"backstabs": 0,
"capturesPoint": 10,
"capturesIntel": 0,
"longestKillStreak": 7,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:450758345]": {
"team": "Red",
"kills": 8,
"assists": 1,
"deaths": 10,
"damage": 2567,
"suicides": 0,
"damageTaken": 3764,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 3,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1450,
"medkits": 17,
"medkitsHp": 752,
"backstabs": 0,
"capturesPoint": 1,
"capturesIntel": 0,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:24668429]": {
"team": "Blue",
"kills": 11,
"assists": 3,
"deaths": 9,
"damage": 2437,
"suicides": 0,
"damageTaken": 2226,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 1,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1045,
"medkits": 16,
"medkitsHp": 463,
"backstabs": 0,
"capturesPoint": 3,
"capturesIntel": 0,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:169048576]": {
"team": "Blue",
"kills": 11,
"assists": 5,
"deaths": 8,
"damage": 2829,
"suicides": 0,
"damageTaken": 2060,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 520,
"medkits": 10,
"medkitsHp": 214,
"backstabs": 0,
"capturesPoint": 5,
"capturesIntel": 0,
"longestKillStreak": 2,
"currentKillStreak": 3,
"medicstats": null
},
"[U:1:374702019]": {
"team": "Red",
"kills": 5,
"assists": 4,
"deaths": 15,
"damage": 1881,
"suicides": 0,
"damageTaken": 3922,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1207,
"medkits": 9,
"medkitsHp": 268,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 2,
"currentKillStreak": 0,
"medicstats": null
}
},
"PvC": {},
"PvP": {},
"realDamage": {
"[U:1:861133286]": {
"DamageTaken": 1959,
"DamageDealt": 2140
},
"[U:1:458841022]": {
"DamageTaken": 1943,
"DamageDealt": 4866
},
"[U:1:232573199]": {
"DamageTaken": 2208,
"DamageDealt": 2954
},
"[U:1:479446967]": {
"DamageTaken": 2097,
"DamageDealt": 3448
},
"[U:1:189526172]": {
"DamageTaken": 2430,
"DamageDealt": 408
},
"[U:1:169048576]": {
"DamageTaken": 2060,
"DamageDealt": 2829
},
"[U:1:450758345]": {
"DamageTaken": 3764,
"DamageDealt": 2567
},
"[U:1:205097719]": {
"DamageTaken": 2375,
"DamageDealt": 2068
},
"[U:1:24668429]": {
"DamageTaken": 2226,
"DamageDealt": 2437
},
"[U:1:374702019]": {
"DamageTaken": 3922,
"DamageDealt": 1881
},
"[U:1:129852188]": {
"DamageTaken": 1509,
"DamageDealt": 303
},
"[U:1:213002038]": {
"DamageTaken": 2183,
"DamageDealt": 2775
}
},
"teams": {
"Red": {
"score": 0,
"kills": 39,
"deaths": 66,
"damage": 12018,
"charges": 0,
"drops": 0,
"captures": 2,
"midfights": 1
},
"Blue": {
"score": 5,
"kills": 66,
"deaths": 39,
"damage": 16658,
"charges": 3,
"drops": 0,
"captures": 16,
"midfights": 4
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,211 +0,0 @@
{
"game": {
"rounds": [],
"toatlLength": 0
},
"chat": [
{
"timeInSeconds": 588,
"steamid": "Console",
"name": "Console",
"team": "Console",
"message": "hello, bear! just donated to serveme.tf - 1 year! 31 percent of our monthly server bills are now taken care of"
}
],
"healspread": {},
"killstreaks": [
{
"steamid": "[U:1:101449025]",
"streak": 3,
"time": 29
},
{
"steamid": "[U:1:101608870]",
"streak": 4,
"time": 44
},
{
"steamid": "[U:1:101449025]",
"streak": 3,
"time": 187
},
{
"steamid": "[U:1:82123920]",
"streak": 3,
"time": 207
},
{
"steamid": "[U:1:88677982]",
"streak": 4,
"time": 234
},
{
"steamid": "[U:1:101608870]",
"streak": 3,
"time": 310
},
{
"steamid": "[U:1:82123920]",
"streak": 4,
"time": 371
},
{
"steamid": "[U:1:101608870]",
"streak": 3,
"time": 463
}
],
"playerClasses": {},
"players": {
"[U:1:82123920]": {
"team": "Red",
"kills": 31,
"assists": 6,
"deaths": 32,
"damage": 6461,
"suicides": 3,
"damageTaken": 7399,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 4,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 0,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 1,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:101608870]": {
"team": "Blue",
"kills": 31,
"assists": 10,
"deaths": 29,
"damage": 8262,
"suicides": 1,
"damageTaken": 6274,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 4,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 0,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 10,
"longestKillStreak": 6,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:88677982]": {
"team": "Blue",
"kills": 30,
"assists": 8,
"deaths": 29,
"damage": 5764,
"suicides": 1,
"damageTaken": 5226,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 6,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 0,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 15,
"longestKillStreak": 5,
"currentKillStreak": 2,
"medicstats": null
},
"[U:1:101449025]": {
"team": "Red",
"kills": 25,
"assists": 9,
"deaths": 32,
"damage": 5039,
"suicides": 0,
"damageTaken": 6627,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 5,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 0,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 15,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
}
},
"PvC": {},
"PvP": {},
"realDamage": {
"[U:1:82123920]": {
"DamageTaken": 7399,
"DamageDealt": 6461
},
"[U:1:101608870]": {
"DamageTaken": 6274,
"DamageDealt": 8160
},
"[U:1:88677982]": {
"DamageTaken": 5226,
"DamageDealt": 5764
},
"[U:1:101449025]": {
"DamageTaken": 6525,
"DamageDealt": 5039
}
},
"teams": {
"Red": {
"score": 0,
"kills": 56,
"deaths": 61,
"damage": 11500,
"charges": 0,
"drops": 0,
"captures": 0,
"midfights": 0
},
"Blue": {
"score": 1,
"kills": 61,
"deaths": 56,
"damage": 14026,
"charges": 0,
"drops": 0,
"captures": 0,
"midfights": 0
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,883 +0,0 @@
{
"game": {
"rounds": [],
"toatlLength": 0
},
"chat": [
{
"timeInSeconds": 23,
"steamid": "[U:1:88164062]",
"name": "dy/dx",
"team": "Red",
"message": "whoosh is afk as usual"
},
{
"timeInSeconds": 27,
"steamid": "[U:1:489586343]",
"name": "everywhere you go turns to dust",
"team": "Blue",
"message": "ur mom"
},
{
"timeInSeconds": 45,
"steamid": "[U:1:898216621]",
"name": "lax",
"team": "Red",
"message": "doing ur mom"
},
{
"timeInSeconds": 50,
"steamid": "[U:1:898216621]",
"name": "lax",
"team": "Red",
"message": "doing her a massage"
},
{
"timeInSeconds": 84,
"steamid": "[U:1:475388996]",
"name": "ǝlectro_spaz | tradeit.gg",
"team": "Red",
"message": "soilder down"
},
{
"timeInSeconds": 108,
"steamid": "[U:1:316446623]",
"name": "Until Dusk",
"team": "Red",
"message": "swoosh"
},
{
"timeInSeconds": 113,
"steamid": "[U:1:316446623]",
"name": "Until Dusk",
"team": "Red",
"message": "we blame him"
},
{
"timeInSeconds": 115,
"steamid": "[U:1:205162937]",
"name": "Rayno",
"team": "Red",
"message": "woosh afk pog"
},
{
"timeInSeconds": 122,
"steamid": "[U:1:1134050539]",
"name": "CrackAss",
"team": "Red",
"message": "sdaufoiusaoifdsu"
},
{
"timeInSeconds": 123,
"steamid": "[U:1:204629350]",
"name": "Matorolight",
"team": "Red",
"message": "fucking subway "
},
{
"timeInSeconds": 246,
"steamid": "[U:1:898216621]",
"name": "lax",
"team": "Red",
"message": "leader still afk"
},
{
"timeInSeconds": 249,
"steamid": "[U:1:898216621]",
"name": "lax",
"team": "Red",
"message": ";w;"
},
{
"timeInSeconds": 258,
"steamid": "[U:1:489586343]",
"name": "everywhere you go turns to dust",
"team": "Blue",
"message": "u can pause"
},
{
"timeInSeconds": 260,
"steamid": "[U:1:149300769]",
"name": "Fade",
"team": "Blue",
"message": "pause if you guys need"
},
{
"timeInSeconds": 289,
"steamid": "[U:1:316446623]",
"name": "Until Dusk",
"team": "Red",
"message": "swoosh dc"
},
{
"timeInSeconds": 291,
"steamid": "[U:1:204629350]",
"name": "Matorolight",
"team": "Red",
"message": "pause?"
},
{
"timeInSeconds": 321,
"steamid": "[U:1:475388996]",
"name": "ǝlectro_spaz | tradeit.gg",
"team": "Red",
"message": "heavy down"
},
{
"timeInSeconds": 336,
"steamid": "[U:1:88164062]",
"name": "dy/dx",
"team": "Red",
"message": ":o"
},
{
"timeInSeconds": 344,
"steamid": "[U:1:88164062]",
"name": "dy/dx",
"team": "Red",
"message": "i jumped on your head"
},
{
"timeInSeconds": 346,
"steamid": "[U:1:88164062]",
"name": "dy/dx",
"team": "Red",
"message": "lol"
},
{
"timeInSeconds": 350,
"steamid": "[U:1:204629350]",
"name": "Matorolight",
"team": "Red",
"message": "i need to dc hold on"
},
{
"timeInSeconds": 360,
"steamid": "[U:1:293609738]",
"name": "hexeh",
"team": "Red",
"message": "you guys "
},
{
"timeInSeconds": 362,
"steamid": "[U:1:293609738]",
"name": "hexeh",
"team": "Red",
"message": "can pause "
},
{
"timeInSeconds": 364,
"steamid": "[U:1:293609738]",
"name": "hexeh",
"team": "Red",
"message": "you know"
},
{
"timeInSeconds": 370,
"steamid": "[U:1:205162937]",
"name": "Rayno",
"team": "Blue",
"message": "our deadass are dumb"
},
{
"timeInSeconds": 374,
"steamid": "[U:1:205162937]",
"name": "Rayno",
"team": "Blue",
"message": "how to pause WHEEZE"
},
{
"timeInSeconds": 578,
"steamid": "[U:1:293609738]",
"name": "hexeh",
"team": "Red",
"message": "나는 한국어로 타이핑하고있다"
},
{
"timeInSeconds": 689,
"steamid": "[U:1:316446623]",
"name": "Until Dusk",
"team": "Blue",
"message": "who dc?"
},
{
"timeInSeconds": 705,
"steamid": "[U:1:88164062]",
"name": "dy/dx",
"team": "Blue",
"message": "seems like 1 person cant connect to this server maybe"
},
{
"timeInSeconds": 789,
"steamid": "[U:1:205162937]",
"name": "Rayno",
"team": "Blue",
"message": "LMAO"
},
{
"timeInSeconds": 797,
"steamid": "[U:1:1134050539]",
"name": "CrackAss",
"team": "Blue",
"message": "1 HP"
},
{
"timeInSeconds": 798,
"steamid": "[U:1:1134050539]",
"name": "CrackAss",
"team": "Blue",
"message": "OSAHDFLKJSAHDLKJFHDSAK"
},
{
"timeInSeconds": 808,
"steamid": "[U:1:898216621]",
"name": "lax",
"team": "Blue",
"message": "pinoy internet"
}
],
"healspread": {
"[U:1:178398866]": {
"[U:1:102720552]": 1273,
"[U:1:293609738]": 352,
"[U:1:151870309]": 2312,
"[U:1:489586343]": 1777,
"[U:1:293532173]": 520,
"[U:1:115664802]": 807,
"[U:1:1010126009]": 318,
"[U:1:149300769]": 433,
"[U:1:475388996]": 49
},
"[U:1:316446623]": {
"[U:1:1134050539]": 245,
"[U:1:929680887]": 23,
"[U:1:88164062]": 642,
"[U:1:205162937]": 1235,
"[U:1:204629350]": 1007,
"[U:1:1042156930]": 1180,
"[U:1:475388996]": 154,
"[U:1:898216621]": 230
},
"[U:1:1134050539]": {
"[U:1:898216621]": 64,
"[U:1:204629350]": 17
},
"[U:1:149300769]": {
"[U:1:102720552]": 28
},
"[U:1:1042156930]": {
"[U:1:102720552]": 75,
"[U:1:88164062]": 66
}
},
"killstreaks": [],
"playerClasses": {},
"players": {
"[U:1:178398866]": {
"team": "Red",
"kills": 0,
"assists": 7,
"deaths": 1,
"damage": 38,
"suicides": 0,
"damageTaken": 310,
"charges": 1,
"chargesByType": {
"medigun": 1
},
"drops": 1,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 7841,
"healingReceived": 0,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 0,
"currentKillStreak": 0,
"medicstats": {
"advantagesLost": 1,
"biggestAdvantageLost": 31,
"nearFullChargeDeaths": 0,
"deathsAfterUber": 0,
"avgTimeBeforeFirstHealing": 9.8,
"avgTimeToBuild": 35,
"avgTimeToUse": 80,
"avgUberLength": 6.9
}
},
"[U:1:102720552]": {
"team": "Blue",
"kills": 7,
"assists": 3,
"deaths": 1,
"damage": 1119,
"suicides": 0,
"damageTaken": 1093,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 1,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1376,
"medkits": 4,
"medkitsHp": 162,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 4,
"currentKillStreak": 3,
"medicstats": null
},
"[U:1:316446623]": {
"team": "Blue",
"kills": 0,
"assists": 2,
"deaths": 4,
"damage": 0,
"suicides": 0,
"damageTaken": 1573,
"charges": 3,
"chargesByType": {
"kritzkrieg": 3
},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 4716,
"healingReceived": 0,
"medkits": 1,
"medkitsHp": 31,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 0,
"currentKillStreak": 0,
"medicstats": {
"advantagesLost": 1,
"biggestAdvantageLost": 10,
"nearFullChargeDeaths": 0,
"deathsAfterUber": 0,
"avgTimeBeforeFirstHealing": 7.133333333333334,
"avgTimeToBuild": 26.25,
"avgTimeToUse": 22,
"avgUberLength": 7.4
}
},
"[U:1:1134050539]": {
"team": "Blue",
"kills": 0,
"assists": 0,
"deaths": 2,
"damage": 421,
"suicides": 0,
"damageTaken": 600,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 9,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 81,
"healingReceived": 245,
"medkits": 3,
"medkitsHp": 88,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 0,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:929680887]": {
"team": "Red",
"kills": 0,
"assists": 0,
"deaths": 1,
"damage": 0,
"suicides": 0,
"damageTaken": 146,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 23,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 0,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:293609738]": {
"team": "Blue",
"kills": 9,
"assists": 1,
"deaths": 4,
"damage": 6034,
"suicides": 0,
"damageTaken": 660,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 352,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 1,
"capturesIntel": 0,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:88164062]": {
"team": "Blue",
"kills": 4,
"assists": 1,
"deaths": 3,
"damage": 1119,
"suicides": 0,
"damageTaken": 1428,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 708,
"medkits": 10,
"medkitsHp": 335,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:151870309]": {
"team": "Blue",
"kills": 4,
"assists": 3,
"deaths": 1,
"damage": 1678,
"suicides": 0,
"damageTaken": 1387,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 1,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 2312,
"medkits": 6,
"medkitsHp": 287,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 4,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:489586343]": {
"team": "Red",
"kills": 6,
"assists": 1,
"deaths": 2,
"damage": 2558,
"suicides": 0,
"damageTaken": 1258,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 1,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1777,
"medkits": 7,
"medkitsHp": 225,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 6,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:205162937]": {
"team": "Blue",
"kills": 7,
"assists": 1,
"deaths": 3,
"damage": 2433,
"suicides": 0,
"damageTaken": 1766,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 1,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1235,
"medkits": 14,
"medkitsHp": 476,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 5,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:293532173]": {
"team": "Red",
"kills": 1,
"assists": 2,
"deaths": 5,
"damage": 897,
"suicides": 0,
"damageTaken": 2317,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 2,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 520,
"medkits": 18,
"medkitsHp": 519,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 1,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:204629350]": {
"team": "Red",
"kills": 1,
"assists": 1,
"deaths": 6,
"damage": 1442,
"suicides": 0,
"damageTaken": 1727,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 1,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 1024,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 1,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:115664802]": {
"team": "Blue",
"kills": 5,
"assists": 2,
"deaths": 3,
"damage": 1830,
"suicides": 0,
"damageTaken": 571,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 6,
"headshotKills": 0,
"healing": 0,
"healingReceived": 807,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 1,
"capturesIntel": 0,
"longestKillStreak": 3,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:1010126009]": {
"team": "Red",
"kills": 3,
"assists": 2,
"deaths": 3,
"damage": 831,
"suicides": 0,
"damageTaken": 1243,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 0,
"headshotKills": 0,
"healing": 0,
"healingReceived": 318,
"medkits": 2,
"medkitsHp": 52,
"backstabs": 0,
"capturesPoint": 3,
"capturesIntel": 0,
"longestKillStreak": 2,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:149300769]": {
"team": "Red",
"kills": 3,
"assists": 2,
"deaths": 2,
"damage": 1250,
"suicides": 0,
"damageTaken": 729,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 10,
"sentriesDestroyed": 4,
"headshots": 0,
"headshotKills": 0,
"healing": 28,
"healingReceived": 433,
"medkits": 2,
"medkitsHp": 48,
"backstabs": 0,
"capturesPoint": 1,
"capturesIntel": 0,
"longestKillStreak": 0,
"currentKillStreak": 3,
"medicstats": null
},
"[U:1:1042156930]": {
"team": "Blue",
"kills": 2,
"assists": 2,
"deaths": 6,
"damage": 1035,
"suicides": 0,
"damageTaken": 5481,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 1,
"headshots": 0,
"headshotKills": 0,
"healing": 141,
"healingReceived": 1180,
"medkits": 2,
"medkitsHp": 150,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 1,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:475388996]": {
"team": "Blue",
"kills": 4,
"assists": 1,
"deaths": 8,
"damage": 2368,
"suicides": 0,
"damageTaken": 1671,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 2,
"headshotKills": 0,
"healing": 0,
"healingReceived": 203,
"medkits": 1,
"medkitsHp": 26,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 2,
"currentKillStreak": 0,
"medicstats": null
},
"[U:1:898216621]": {
"team": "Blue",
"kills": 4,
"assists": 0,
"deaths": 5,
"damage": 750,
"suicides": 0,
"damageTaken": 1843,
"charges": 0,
"chargesByType": {},
"drops": 0,
"airshots": 0,
"sentriesBuilt": 0,
"sentriesDestroyed": 0,
"headshots": 3,
"headshotKills": 0,
"healing": 0,
"healingReceived": 294,
"medkits": 0,
"medkitsHp": 0,
"backstabs": 0,
"capturesPoint": 0,
"capturesIntel": 0,
"longestKillStreak": 2,
"currentKillStreak": 1,
"medicstats": null
}
},
"PvC": {},
"PvP": {},
"realDamage": {
"[U:1:205162937]": {
"DamageTaken": 1766,
"DamageDealt": 2433
},
"[U:1:293609738]": {
"DamageTaken": 660,
"DamageDealt": 6034
},
"[U:1:1010126009]": {
"DamageTaken": 1243,
"DamageDealt": 831
},
"[U:1:1042156930]": {
"DamageTaken": 5481,
"DamageDealt": 1035
},
"[U:1:149300769]": {
"DamageTaken": 729,
"DamageDealt": 1250
},
"[U:1:475388996]": {
"DamageTaken": 1671,
"DamageDealt": 2368
},
"[U:1:293532173]": {
"DamageTaken": 2317,
"DamageDealt": 897
},
"[U:1:115664802]": {
"DamageTaken": 571,
"DamageDealt": 1830
},
"[U:1:151870309]": {
"DamageTaken": 1387,
"DamageDealt": 1678
},
"[U:1:102720552]": {
"DamageTaken": 1093,
"DamageDealt": 1119
},
"[U:1:489586343]": {
"DamageTaken": 1258,
"DamageDealt": 2558
},
"[U:1:898216621]": {
"DamageTaken": 1843,
"DamageDealt": 750
},
"[U:1:88164062]": {
"DamageTaken": 1428,
"DamageDealt": 1119
},
"[U:1:204629350]": {
"DamageTaken": 1727,
"DamageDealt": 1442
},
"[U:1:316446623]": {
"DamageTaken": 1573,
"DamageDealt": 0
},
"[U:1:1134050539]": {
"DamageTaken": 600,
"DamageDealt": 421
},
"[U:1:178398866]": {
"DamageTaken": 310,
"DamageDealt": 38
},
"[U:1:929680887]": {
"DamageTaken": 146,
"DamageDealt": 0
}
},
"teams": {
"Red": {
"score": 1,
"kills": 22,
"deaths": 38,
"damage": 9568,
"charges": 3,
"drops": 0,
"captures": 0,
"midfights": 0
},
"Blue": {
"score": 1,
"kills": 38,
"deaths": 22,
"damage": 16235,
"charges": 1,
"drops": 1,
"captures": 3,
"midfights": 1
}
}
}

File diff suppressed because it is too large Load diff

2
tests/data/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.log
*.json

Binary file not shown.

Binary file not shown.

BIN
tests/data/log_6s.log.gz Normal file

Binary file not shown.

BIN
tests/data/log_bball.log.gz Normal file

Binary file not shown.

BIN
tests/data/log_hl.log.gz Normal file

Binary file not shown.

23
tests/smoke.rs Normal file
View file

@ -0,0 +1,23 @@
use flate2::read::GzDecoder;
use std::fs::File;
use std::io::Read;
use test_case::test_case;
use tf_log_parser::{LineSplit, RawEvent};
#[test_case("log_6s.log")]
#[test_case("log_2788889.log")]
#[test_case("log_2892242.log")]
#[test_case("log_bball.log")]
#[test_case("log_hl.log")]
fn smoke_test(name: &str) {
let path = format!("tests/data/{}.gz", name);
let mut content = String::new();
GzDecoder::new(File::open(path).expect("failed to open"))
.read_to_string(&mut content)
.expect("failed to read");
for line in LineSplit::new(&content) {
if line.starts_with("L ") {
RawEvent::parse(line).expect("failed to parse raw event");
}
}
}

View file

@ -1,6 +1,8 @@
use flate2::read::GzDecoder;
use serde::Serialize; use serde::Serialize;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::fs::read_to_string; use std::fs::File;
use std::io::Read;
use test_case::test_case; use test_case::test_case;
use tf_log_parser::module::{ClassStats, MedicStats}; use tf_log_parser::module::{ClassStats, MedicStats};
use tf_log_parser::{parse, EventHandler, LogHandler, LogHandlerPerSubjectOutput}; use tf_log_parser::{parse, EventHandler, LogHandler, LogHandlerPerSubjectOutput};
@ -57,7 +59,11 @@ impl From<ClassStats> for ClassStatsRaw {
#[test_case("log_bball.log")] #[test_case("log_bball.log")]
#[test_case("log_hl.log")] #[test_case("log_hl.log")]
fn test_parse(name: &str) { fn test_parse(name: &str) {
let content = read_to_string(&format!("test_data/{}", name)).unwrap(); let path = format!("tests/data/{}.gz", name);
let mut content = String::new();
GzDecoder::new(File::open(path).expect("failed to open"))
.read_to_string(&mut content)
.expect("failed to read");
let (global, per_player) = parse(&content).unwrap(); let (global, per_player) = parse(&content).unwrap();
let log = LogResult { let log = LogResult {
global, global,