1fb726d48Sopenharmony_ci/*
2fb726d48Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3fb726d48Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb726d48Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb726d48Sopenharmony_ci * You may obtain a copy of the License at
6fb726d48Sopenharmony_ci *
7fb726d48Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fb726d48Sopenharmony_ci *
9fb726d48Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb726d48Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb726d48Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb726d48Sopenharmony_ci * See the License for the specific language governing permissions and
13fb726d48Sopenharmony_ci * limitations under the License.
14fb726d48Sopenharmony_ci */
15fb726d48Sopenharmony_ci
16fb726d48Sopenharmony_ciimport { CpuUsage, Freq } from '../../../src/trace/bean/CpuUsage';
17fb726d48Sopenharmony_ci
18fb726d48Sopenharmony_cidescribe('CpuUsage Test', () => {
19fb726d48Sopenharmony_ci  let cpuUsage = new CpuUsage();
20fb726d48Sopenharmony_ci  let freq = new Freq();
21fb726d48Sopenharmony_ci
22fb726d48Sopenharmony_ci  it('CpuUsageTest01', function () {
23fb726d48Sopenharmony_ci    cpuUsage = {
24fb726d48Sopenharmony_ci      cpu: 0,
25fb726d48Sopenharmony_ci      usage: 0,
26fb726d48Sopenharmony_ci      usageStr: '',
27fb726d48Sopenharmony_ci      top1: 0,
28fb726d48Sopenharmony_ci      top2: 0,
29fb726d48Sopenharmony_ci      top3: 0,
30fb726d48Sopenharmony_ci      top1Percent: 0,
31fb726d48Sopenharmony_ci      top1PercentStr: '',
32fb726d48Sopenharmony_ci      top2Percent: 0,
33fb726d48Sopenharmony_ci      top2PercentStr: '',
34fb726d48Sopenharmony_ci      top3Percent: 0,
35fb726d48Sopenharmony_ci      top3PercentStr: '',
36fb726d48Sopenharmony_ci    };
37fb726d48Sopenharmony_ci    expect(cpuUsage).not.toBeUndefined();
38fb726d48Sopenharmony_ci    expect(cpuUsage).toMatchInlineSnapshot(
39fb726d48Sopenharmony_ci{
40fb726d48Sopenharmony_ci  cpu: expect.any(Number),
41fb726d48Sopenharmony_ci  usage: expect.any(Number),
42fb726d48Sopenharmony_ci  usageStr: expect.any(String),
43fb726d48Sopenharmony_ci  top1: expect.any(Number),
44fb726d48Sopenharmony_ci  top2: expect.any(Number),
45fb726d48Sopenharmony_ci  top3: expect.any(Number),
46fb726d48Sopenharmony_ci  top1Percent: expect.any(Number),
47fb726d48Sopenharmony_ci  top1PercentStr: expect.any(String),
48fb726d48Sopenharmony_ci  top2Percent: expect.any(Number),
49fb726d48Sopenharmony_ci  top2PercentStr: expect.any(String),
50fb726d48Sopenharmony_ci  top3Percent: expect.any(Number),
51fb726d48Sopenharmony_ci  top3PercentStr: expect.any(String) }, `
52fb726d48Sopenharmony_ci{
53fb726d48Sopenharmony_ci  "cpu": Any<Number>,
54fb726d48Sopenharmony_ci  "top1": Any<Number>,
55fb726d48Sopenharmony_ci  "top1Percent": Any<Number>,
56fb726d48Sopenharmony_ci  "top1PercentStr": Any<String>,
57fb726d48Sopenharmony_ci  "top2": Any<Number>,
58fb726d48Sopenharmony_ci  "top2Percent": Any<Number>,
59fb726d48Sopenharmony_ci  "top2PercentStr": Any<String>,
60fb726d48Sopenharmony_ci  "top3": Any<Number>,
61fb726d48Sopenharmony_ci  "top3Percent": Any<Number>,
62fb726d48Sopenharmony_ci  "top3PercentStr": Any<String>,
63fb726d48Sopenharmony_ci  "usage": Any<Number>,
64fb726d48Sopenharmony_ci  "usageStr": Any<String>,
65fb726d48Sopenharmony_ci}
66fb726d48Sopenharmony_ci`);
67fb726d48Sopenharmony_ci  });
68fb726d48Sopenharmony_ci
69fb726d48Sopenharmony_ci  it('CpuUsageTest02', function () {
70fb726d48Sopenharmony_ci    cpuUsage = {
71fb726d48Sopenharmony_ci      cpu: 0,
72fb726d48Sopenharmony_ci      value: 0,
73fb726d48Sopenharmony_ci      startNs: 0,
74fb726d48Sopenharmony_ci      dur: 0,
75fb726d48Sopenharmony_ci    };
76fb726d48Sopenharmony_ci    expect(freq).not.toBeUndefined();
77fb726d48Sopenharmony_ci    expect(cpuUsage).toMatchInlineSnapshot(
78fb726d48Sopenharmony_ci{
79fb726d48Sopenharmony_ci  cpu: expect.any(Number),
80fb726d48Sopenharmony_ci  value: expect.any(Number),
81fb726d48Sopenharmony_ci  startNs: expect.any(Number),
82fb726d48Sopenharmony_ci  dur: expect.any(Number) }, `
83fb726d48Sopenharmony_ci{
84fb726d48Sopenharmony_ci  "cpu": Any<Number>,
85fb726d48Sopenharmony_ci  "dur": Any<Number>,
86fb726d48Sopenharmony_ci  "startNs": Any<Number>,
87fb726d48Sopenharmony_ci  "value": Any<Number>,
88fb726d48Sopenharmony_ci}
89fb726d48Sopenharmony_ci`);
90fb726d48Sopenharmony_ci  });
91fb726d48Sopenharmony_ci});
92