mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +02:00
gzip test data
This commit is contained in:
parent
461de19d2e
commit
5defd55037
23 changed files with 62 additions and 34005 deletions
10
src/lib.rs
10
src/lib.rs
|
|
@ -171,7 +171,15 @@ impl<'a> Iterator for LineSplit<'a> {
|
|||
|
||||
#[test]
|
||||
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 expected: Vec<_> = input
|
||||
.split("L ")
|
||||
|
|
|
|||
|
|
@ -333,30 +333,3 @@ fn test_parse_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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue