1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | /*
|
---|
4 | * This is a TypeScript port of the original Java version, which was written by
|
---|
5 | * Gil Tene as described in
|
---|
6 | * https://github.com/HdrHistogram/HdrHistogram
|
---|
7 | * and released to the public domain, as explained at
|
---|
8 | * http://creativecommons.org/publicdomain/zero/1.0/
|
---|
9 | */
|
---|
10 | const hdr = require("./index");
|
---|
11 | describe("Histogram builder", () => {
|
---|
12 | it("should build histogram with default values", () => {
|
---|
13 | // given
|
---|
14 | // when
|
---|
15 | const histogram = hdr.build();
|
---|
16 | // then
|
---|
17 | expect(histogram).not.toBeNull();
|
---|
18 | expect(histogram.autoResize).toBe(true);
|
---|
19 | expect(histogram.highestTrackableValue).toBe(2);
|
---|
20 | });
|
---|
21 | it("should build histogram with custom parameters", () => {
|
---|
22 | // given
|
---|
23 | // when
|
---|
24 | const histogram = hdr.build({
|
---|
25 | bitBucketSize: 32,
|
---|
26 | numberOfSignificantValueDigits: 2,
|
---|
27 | });
|
---|
28 | const expectedHistogram = new hdr.Int32Histogram(1, 2, 2);
|
---|
29 | expectedHistogram.autoResize = true;
|
---|
30 | histogram.recordValue(12345);
|
---|
31 | expectedHistogram.recordValue(12345);
|
---|
32 | // then
|
---|
33 | expect(histogram.mean).toBe(expectedHistogram.mean);
|
---|
34 | });
|
---|
35 | });
|
---|
36 | //# sourceMappingURL=index.spec.js.map |
---|