<commit_before>extern crate rgmk;
extern crate byteorder;
extern crate env_logger;

use std::fs::File;
use std::io::prelude::*;
use std::io::{BufReader, BufWriter, Cursor};

fn main() {
    env_logger::init().unwrap();
    let original = {
        let mut args = std::env::args().skip(1);
        let path = args.next().expect("Expected path as argument");
        let mut file = File::open(&path).unwrap();
        let mut vec = Vec::new();
        file.read_to_end(&mut vec).unwrap();
        vec
    };
    let game_data = rgmk::GameData::from_reader(&mut BufReader::new(Cursor::new(&original[..])))
                        .unwrap();
    let mut new: Vec<u8> = vec![0; original.len()];
    game_data.write_to_writer(&mut BufWriter::new(Cursor::new(&mut new[..]))).unwrap();
    for (i, (o, n)) in original[..].iter().zip(new[..].iter()).enumerate() {
        if o != n {
            use byteorder::{ReadBytesExt, LittleEndian};
            let orig = (&original[i..i + 4]).read_u32::<LittleEndian>().unwrap();
            let new = (&new[i..i + 4]).read_u32::<LittleEndian>().unwrap();
            panic!("Difference at offset {}. orig {} vs new {}", i, orig, new);
        }
    }
}<commit_msg>io_tests/identity: print Display implementation of errors instead of Debug<commit_after>extern crate rgmk;
extern crate byteorder;
extern crate env_logger;

use std::fs::File;
use std::io::prelude::*;
use std::io::{BufReader, BufWriter, Cursor};

fn main() {
    env_logger::init().unwrap();
    let original = {
        let mut args = std::env::args().skip(1);
        let path = args.next().expect("Expected path as argument");
        let mut file = File::open(&path).unwrap();
        let mut vec = Vec::new();
        file.read_to_end(&mut vec).unwrap();
        vec
    };
    let game_data = rgmk::GameData::from_reader(&mut BufReader::new(Cursor::new(&original[..])))
                        .unwrap_or_else(|e| panic!("Failed to read: {}", e));
    let mut new: Vec<u8> = vec![0; original.len()];
    game_data.write_to_writer(&mut BufWriter::new(Cursor::new(&mut new[..]))).unwrap();
    for (i, (o, n)) in original[..].iter().zip(new[..].iter()).enumerate() {
        if o != n {
            use byteorder::{ReadBytesExt, LittleEndian};
            let orig = (&original[i..i + 4]).read_u32::<LittleEndian>().unwrap();
            let new = (&new[i..i + 4]).read_u32::<LittleEndian>().unwrap();
            panic!("Difference at offset {}. orig {} vs new {}", i, orig, new);
        }
    }
}
{'fraction_non_alphanumeric': 0.19784172661870503, 'fraction_numerical': 0.007194244604316547, 'mean_word_length': 2.941732283464567, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1853155', 'n_tokens_mistral': 817, 'n_tokens_neox': 815, 'n_words': 184}