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 { SliceGroup, SPTChild } from '../../../src/trace/bean/StateProcessThread'; 17fb726d48Sopenharmony_ci 18fb726d48Sopenharmony_cidescribe('StateProcessThread Test', () => { 19fb726d48Sopenharmony_ci it('StateProcessThreadTest01', function () { 20fb726d48Sopenharmony_ci let sliceGroup = new SliceGroup(); 21fb726d48Sopenharmony_ci sliceGroup = { 22fb726d48Sopenharmony_ci title: 'id', 23fb726d48Sopenharmony_ci count: 0, 24fb726d48Sopenharmony_ci minDuration: 0, 25fb726d48Sopenharmony_ci maxDuration: 0, 26fb726d48Sopenharmony_ci avgDuration: 'stdDuration', 27fb726d48Sopenharmony_ci }; 28fb726d48Sopenharmony_ci expect(sliceGroup).not.toBeUndefined(); 29fb726d48Sopenharmony_ci expect(sliceGroup).toMatchInlineSnapshot( 30fb726d48Sopenharmony_ci { 31fb726d48Sopenharmony_ci title: expect.any(String), 32fb726d48Sopenharmony_ci count: expect.any(Number), 33fb726d48Sopenharmony_ci minDuration: expect.any(Number), 34fb726d48Sopenharmony_ci maxDuration: expect.any(Number), 35fb726d48Sopenharmony_ci avgDuration: expect.any(String) }, ` 36fb726d48Sopenharmony_ci{ 37fb726d48Sopenharmony_ci "avgDuration": Any<String>, 38fb726d48Sopenharmony_ci "count": Any<Number>, 39fb726d48Sopenharmony_ci "maxDuration": Any<Number>, 40fb726d48Sopenharmony_ci "minDuration": Any<Number>, 41fb726d48Sopenharmony_ci "title": Any<String>, 42fb726d48Sopenharmony_ci} 43fb726d48Sopenharmony_ci`); 44fb726d48Sopenharmony_ci }); 45fb726d48Sopenharmony_ci 46fb726d48Sopenharmony_ci it('SPTChildTest02', function () { 47fb726d48Sopenharmony_ci let sptChild = new SPTChild(); 48fb726d48Sopenharmony_ci sptChild = { 49fb726d48Sopenharmony_ci process: 'process', 50fb726d48Sopenharmony_ci processId: 0, 51fb726d48Sopenharmony_ci processName: 'processName', 52fb726d48Sopenharmony_ci thread: 'thread', 53fb726d48Sopenharmony_ci threadId: 0, 54fb726d48Sopenharmony_ci threadName: 'threadName', 55fb726d48Sopenharmony_ci state: 'state', 56fb726d48Sopenharmony_ci startNs: 0, 57fb726d48Sopenharmony_ci startTime: 'startTime', 58fb726d48Sopenharmony_ci duration: 0, 59fb726d48Sopenharmony_ci cpu: 1, 60fb726d48Sopenharmony_ci core: 'core', 61fb726d48Sopenharmony_ci priority: 0, 62fb726d48Sopenharmony_ci prior: 'prior', 63fb726d48Sopenharmony_ci note: 'note', 64fb726d48Sopenharmony_ci }; 65fb726d48Sopenharmony_ci expect(sptChild).not.toBeUndefined(); 66fb726d48Sopenharmony_ci expect(sptChild).toMatchInlineSnapshot( 67fb726d48Sopenharmony_ci{ 68fb726d48Sopenharmony_ci process: expect.any(String), 69fb726d48Sopenharmony_ci processId: expect.any(Number), 70fb726d48Sopenharmony_ci processName: expect.any(String), 71fb726d48Sopenharmony_ci thread: expect.any(String), 72fb726d48Sopenharmony_ci threadId: expect.any(Number), 73fb726d48Sopenharmony_ci threadName: expect.any(String), 74fb726d48Sopenharmony_ci state: expect.any(String), 75fb726d48Sopenharmony_ci startNs: expect.any(Number), 76fb726d48Sopenharmony_ci startTime: expect.any(String), 77fb726d48Sopenharmony_ci duration: expect.any(Number), 78fb726d48Sopenharmony_ci cpu: expect.any(Number), 79fb726d48Sopenharmony_ci core: expect.any(String), 80fb726d48Sopenharmony_ci priority: expect.any(Number), 81fb726d48Sopenharmony_ci prior: expect.any(String), 82fb726d48Sopenharmony_ci note: expect.any(String) }, ` 83fb726d48Sopenharmony_ci{ 84fb726d48Sopenharmony_ci "core": Any<String>, 85fb726d48Sopenharmony_ci "cpu": Any<Number>, 86fb726d48Sopenharmony_ci "duration": Any<Number>, 87fb726d48Sopenharmony_ci "note": Any<String>, 88fb726d48Sopenharmony_ci "prior": Any<String>, 89fb726d48Sopenharmony_ci "priority": Any<Number>, 90fb726d48Sopenharmony_ci "process": Any<String>, 91fb726d48Sopenharmony_ci "processId": Any<Number>, 92fb726d48Sopenharmony_ci "processName": Any<String>, 93fb726d48Sopenharmony_ci "startNs": Any<Number>, 94fb726d48Sopenharmony_ci "startTime": Any<String>, 95fb726d48Sopenharmony_ci "state": Any<String>, 96fb726d48Sopenharmony_ci "thread": Any<String>, 97fb726d48Sopenharmony_ci "threadId": Any<Number>, 98fb726d48Sopenharmony_ci "threadName": Any<String>, 99fb726d48Sopenharmony_ci} 100fb726d48Sopenharmony_ci` 101fb726d48Sopenharmony_ci ); 102fb726d48Sopenharmony_ci }); 103fb726d48Sopenharmony_ci}); 104