1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { SliceGroup, SPTChild } from '../../../src/trace/bean/StateProcessThread';
17
18describe('StateProcessThread Test', () => {
19    it('StateProcessThreadTest01', function () {
20        let sliceGroup = new SliceGroup();
21      sliceGroup = {
22            title: 'id',
23            count: 0,
24            minDuration: 0,
25            maxDuration: 0,
26            avgDuration: 'stdDuration',
27        };
28        expect(sliceGroup).not.toBeUndefined();
29        expect(sliceGroup).toMatchInlineSnapshot(
30  {
31    title: expect.any(String),
32    count: expect.any(Number),
33    minDuration: expect.any(Number),
34    maxDuration: expect.any(Number),
35    avgDuration: expect.any(String) }, `
36{
37  "avgDuration": Any<String>,
38  "count": Any<Number>,
39  "maxDuration": Any<Number>,
40  "minDuration": Any<Number>,
41  "title": Any<String>,
42}
43`);
44  });
45
46    it('SPTChildTest02', function () {
47        let sptChild = new SPTChild();
48        sptChild = {
49            process: 'process',
50            processId: 0,
51            processName: 'processName',
52            thread: 'thread',
53            threadId: 0,
54            threadName: 'threadName',
55            state: 'state',
56            startNs: 0,
57            startTime: 'startTime',
58            duration: 0,
59            cpu: 1,
60            core: 'core',
61            priority: 0,
62            prior: 'prior',
63            note: 'note',
64        };
65        expect(sptChild).not.toBeUndefined();
66        expect(sptChild).toMatchInlineSnapshot(
67{
68  process: expect.any(String),
69  processId: expect.any(Number),
70  processName: expect.any(String),
71  thread: expect.any(String),
72  threadId: expect.any(Number),
73  threadName: expect.any(String),
74  state: expect.any(String),
75  startNs: expect.any(Number),
76  startTime: expect.any(String),
77  duration: expect.any(Number),
78  cpu: expect.any(Number),
79  core: expect.any(String),
80  priority: expect.any(Number),
81  prior: expect.any(String),
82  note: expect.any(String) }, `
83{
84  "core": Any<String>,
85  "cpu": Any<Number>,
86  "duration": Any<Number>,
87  "note": Any<String>,
88  "prior": Any<String>,
89  "priority": Any<Number>,
90  "process": Any<String>,
91  "processId": Any<Number>,
92  "processName": Any<String>,
93  "startNs": Any<Number>,
94  "startTime": Any<String>,
95  "state": Any<String>,
96  "thread": Any<String>,
97  "threadId": Any<Number>,
98  "threadName": Any<String>,
99}
100`
101    );
102  });
103});
104