mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 10:14:10 +02:00
gzip test data
This commit is contained in:
parent
461de19d2e
commit
5defd55037
23 changed files with 62 additions and 34005 deletions
2
tests/data/.gitignore
vendored
Normal file
2
tests/data/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*.log
|
||||
*.json
|
||||
BIN
tests/data/log_2788889.log.gz
Normal file
BIN
tests/data/log_2788889.log.gz
Normal file
Binary file not shown.
6809
tests/data/log_2892242.log
Normal file
6809
tests/data/log_2892242.log
Normal file
File diff suppressed because it is too large
Load diff
BIN
tests/data/log_2892242.log.gz
Normal file
BIN
tests/data/log_2892242.log.gz
Normal file
Binary file not shown.
BIN
tests/data/log_6s.log.gz
Normal file
BIN
tests/data/log_6s.log.gz
Normal file
Binary file not shown.
BIN
tests/data/log_bball.log.gz
Normal file
BIN
tests/data/log_bball.log.gz
Normal file
Binary file not shown.
BIN
tests/data/log_hl.log.gz
Normal file
BIN
tests/data/log_hl.log.gz
Normal file
Binary file not shown.
23
tests/smoke.rs
Normal file
23
tests/smoke.rs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
use flate2::read::GzDecoder;
|
||||
use serde::Serialize;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs::read_to_string;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use test_case::test_case;
|
||||
use tf_log_parser::module::{ClassStats, MedicStats};
|
||||
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_hl.log")]
|
||||
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 log = LogResult {
|
||||
global,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue