Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | /*
|
---|
2 | * This is a TypeScript port of the original Java version, which was written by
|
---|
3 | * Gil Tene as described in
|
---|
4 | * https://github.com/HdrHistogram/HdrHistogram
|
---|
5 | * and released to the public domain, as explained at
|
---|
6 | * http://creativecommons.org/publicdomain/zero/1.0/
|
---|
7 | */
|
---|
8 | import * as hdr from "./index";
|
---|
9 |
|
---|
10 | describe("Histogram builder", () => {
|
---|
11 | it("should build histogram with default values", () => {
|
---|
12 | // given
|
---|
13 | // when
|
---|
14 | const histogram = hdr.build();
|
---|
15 | // then
|
---|
16 | expect(histogram).not.toBeNull();
|
---|
17 | expect(histogram.autoResize).toBe(true);
|
---|
18 | expect(histogram.highestTrackableValue).toBe(2);
|
---|
19 | });
|
---|
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 |
|
---|
31 | histogram.recordValue(12345);
|
---|
32 | expectedHistogram.recordValue(12345);
|
---|
33 |
|
---|
34 | // then
|
---|
35 | expect(histogram.mean).toBe(expectedHistogram.mean);
|
---|
36 | });
|
---|
37 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.