1 | 'use strict'
|
2 |
|
3 | const test = require('tap').test
|
4 | const guessInterval = require('../analysis/guess-interval.js')
|
5 | const generateProcessStat = require('./generate-process-stat.js')
|
6 |
|
7 | test('guess interval - expected data', function (t) {
|
8 | for (const noise of [0, 1, 5]) {
|
9 | const data = generateProcessStat({
|
10 | handles: [3, 3, 3, 3, 3, 13, 13, 13, 13, 13, 13, 13, 3, 3, 3]
|
11 | }, noise)
|
12 |
|
13 | const interval = guessInterval(data)
|
14 | t.strictDeepEqual(interval, [5, 12])
|
15 | }
|
16 |
|
17 | t.end()
|
18 | })
|
19 |
|
20 | test('guess interval - missing left tail', function (t) {
|
21 | for (const noise of [0, 1, 5]) {
|
22 | const data = generateProcessStat({
|
23 | handles: [3, 3, 3, 3, 3, 13, 13, 13, 13, 13, 13, 13]
|
24 | }, noise)
|
25 |
|
26 | const interval = guessInterval(data)
|
27 | t.strictDeepEqual(interval, [5, 12])
|
28 | }
|
29 |
|
30 | t.end()
|
31 | })
|
32 |
|
33 | test('guess interval - missing right tail', function (t) {
|
34 | for (const noise of [0, 1, 5]) {
|
35 | const data = generateProcessStat({
|
36 | handles: [13, 13, 13, 13, 13, 3, 3, 3, 3, 3, 3, 3]
|
37 | }, noise)
|
38 |
|
39 | const interval = guessInterval(data)
|
40 | t.strictDeepEqual(interval, [0, 5])
|
41 | }
|
42 |
|
43 | t.end()
|
44 | })
|
45 |
|
46 | test('guess interval - flat data', function (t) {
|
47 | const data = generateProcessStat({
|
48 | handles: [3, 3, 3, 3, 3, 3, 3, 3]
|
49 | }, 0)
|
50 |
|
51 | const interval = guessInterval(data)
|
52 | t.strictDeepEqual(interval, [0, 8])
|
53 |
|
54 | t.end()
|
55 | })
|