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

@ -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 ")

View file

@ -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();
}
}
}
}