source: trip-planner-front/node_modules/hdr-histogram-js/src/log.spec.ts@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 801 bytes
RevLine 
[6a3a178]1import { build, HistogramLogReader, HistogramLogWriter } from ".";
2
3describe("Logs", () => {
4 it("should give same result after been written then read", () => {
5 // given
6 let buffer = "";
7 const writer = new HistogramLogWriter((content) => {
8 buffer += content;
9 });
10 writer.outputLogFormatVersion();
11 writer.outputStartTime(12345000);
12 writer.outputLegend();
13 const inputHistogram = build();
14 inputHistogram.recordValue(42);
15 // when
16 writer.outputIntervalHistogram(inputHistogram, 12345042, 1234056, 1);
17 const reader = new HistogramLogReader(buffer);
18 const outputHistogram = reader.nextIntervalHistogram();
19 // then
20 expect(outputHistogram).not.toBeNull();
21 // @ts-ignore
22 expect(outputHistogram.mean).toBe(inputHistogram.mean);
23 });
24});
Note: See TracBrowser for help on using the repository browser.