<commit_before>import { expect } from "chai";
import { HistogramLogWriter, HistogramLogReader, build, AbstractHistogram } from ".";

describe("Logs", () => {
    it("should give same result after been written the read", () => {
        // given
        let buffer = "";
        const writer = new HistogramLogWriter(content => {
          buffer += content;
        });
        writer.outputLogFormatVersion();
        writer.outputStartTime(12345000);
        writer.outputLegend();
        const inputHistogram = build();
        inputHistogram.recordValue(1515);
        inputHistogram.recordValue(1789);
        // when
        writer.outputIntervalHistogram(inputHistogram, 12345042, 1234056, 1);
        console.log(buffer)
        const reader = new HistogramLogReader(buffer);
        const outputHistogram = reader.nextIntervalHistogram();
        // then
        expect(outputHistogram).to.be.not.null;
        const outputText = (outputHistogram as AbstractHistogram).outputPercentileDistribution();
        const inputText = inputHistogram.outputPercentileDistribution(); 
        expect(outputText).to.be.equal(inputText);
    })
})<commit_msg>chore: fix formating to please prettier<commit_after>import { expect } from "chai";
import {
  HistogramLogWriter,
  HistogramLogReader,
  build,
  AbstractHistogram
} from ".";

describe("Logs", () => {
  it("should give same result after been written the read", () => {
    // given
    let buffer = "";
    const writer = new HistogramLogWriter(content => {
      buffer += content;
    });
    writer.outputLogFormatVersion();
    writer.outputStartTime(12345000);
    writer.outputLegend();
    const inputHistogram = build();
    inputHistogram.recordValue(1515);
    inputHistogram.recordValue(1789);
    // when
    writer.outputIntervalHistogram(inputHistogram, 12345042, 1234056, 1);
    console.log(buffer);
    const reader = new HistogramLogReader(buffer);
    const outputHistogram = reader.nextIntervalHistogram();
    // then
    expect(outputHistogram).to.be.not.null;
    const outputText = (outputHistogram as AbstractHistogram).outputPercentileDistribution();
    const inputText = inputHistogram.outputPercentileDistribution();
    expect(outputText).to.be.equal(inputText);
  });
});

{'fraction_non_alphanumeric': 0.11665930181175431, 'fraction_numerical': 0.02828104286345559, 'mean_word_length': 3.43921568627451, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3898310', 'n_tokens_mistral': 668, 'n_tokens_neox': 618, 'n_words': 127}