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_ciimport { SpSdkConfig } from '../../../../src/trace/component/setting/SpSdkConfig'; 16fb726d48Sopenharmony_ci 17fb726d48Sopenharmony_cidescribe('spSdkConfig Test', () => { 18fb726d48Sopenharmony_ci let spSdkConfig = new SpSdkConfig(); 19fb726d48Sopenharmony_ci it('spSdkConfigTest01', function () { 20fb726d48Sopenharmony_ci spSdkConfig.show = true; 21fb726d48Sopenharmony_ci expect(spSdkConfig.show).toBeTruthy(); 22fb726d48Sopenharmony_ci }); 23fb726d48Sopenharmony_ci 24fb726d48Sopenharmony_ci it('spSdkConfigTest02', function () { 25fb726d48Sopenharmony_ci spSdkConfig.show = false; 26fb726d48Sopenharmony_ci expect(spSdkConfig.show).toBeFalsy(); 27fb726d48Sopenharmony_ci }); 28fb726d48Sopenharmony_ci 29fb726d48Sopenharmony_ci it('spSdkConfigTest03', function () { 30fb726d48Sopenharmony_ci spSdkConfig.startSamp = true; 31fb726d48Sopenharmony_ci expect(spSdkConfig.startSamp).toBeTruthy(); 32fb726d48Sopenharmony_ci }); 33fb726d48Sopenharmony_ci 34fb726d48Sopenharmony_ci it('spSdkConfigTest04', function () { 35fb726d48Sopenharmony_ci spSdkConfig.startSamp = false; 36fb726d48Sopenharmony_ci expect(spSdkConfig.startSamp).toBeFalsy(); 37fb726d48Sopenharmony_ci }); 38fb726d48Sopenharmony_ci 39fb726d48Sopenharmony_ci it('spSdkConfigTest05', function () { 40fb726d48Sopenharmony_ci spSdkConfig.configName = ''; 41fb726d48Sopenharmony_ci expect(spSdkConfig.configName).toBeDefined(); 42fb726d48Sopenharmony_ci }); 43fb726d48Sopenharmony_ci 44fb726d48Sopenharmony_ci it('spSdkConfigTest06', function () { 45fb726d48Sopenharmony_ci spSdkConfig.configName = 'configName'; 46fb726d48Sopenharmony_ci expect(spSdkConfig.configName).toBeDefined(); 47fb726d48Sopenharmony_ci }); 48fb726d48Sopenharmony_ci 49fb726d48Sopenharmony_ci it('spSdkConfigTest07', function () { 50fb726d48Sopenharmony_ci spSdkConfig.type = ''; 51fb726d48Sopenharmony_ci expect(spSdkConfig.type).toBeDefined(); 52fb726d48Sopenharmony_ci }); 53fb726d48Sopenharmony_ci 54fb726d48Sopenharmony_ci it('spSdkConfigTest08', function () { 55fb726d48Sopenharmony_ci spSdkConfig.type = 'configName'; 56fb726d48Sopenharmony_ci expect(spSdkConfig.type).toBeDefined(); 57fb726d48Sopenharmony_ci }); 58fb726d48Sopenharmony_ci 59fb726d48Sopenharmony_ci it('spSdkConfigTest09', function () { 60fb726d48Sopenharmony_ci expect(spSdkConfig.getPlugName()).not.toBeUndefined(); 61fb726d48Sopenharmony_ci }); 62fb726d48Sopenharmony_ci 63fb726d48Sopenharmony_ci it('spSdkConfigTest10', function () { 64fb726d48Sopenharmony_ci expect(spSdkConfig.getSampleInterval()).not.toBeUndefined(); 65fb726d48Sopenharmony_ci }); 66fb726d48Sopenharmony_ci 67fb726d48Sopenharmony_ci it('spSdkConfigTest11', function () { 68fb726d48Sopenharmony_ci expect(spSdkConfig.getGpuConfig()).not.toBeUndefined(); 69fb726d48Sopenharmony_ci }); 70fb726d48Sopenharmony_ci 71fb726d48Sopenharmony_ci it('spSdkConfigTest12', function () { 72fb726d48Sopenharmony_ci expect(spSdkConfig.checkIntegerInput('')).not.toBeUndefined(); 73fb726d48Sopenharmony_ci }); 74fb726d48Sopenharmony_ci 75fb726d48Sopenharmony_ci it('spSdkConfigTest13', function () { 76fb726d48Sopenharmony_ci expect(spSdkConfig.checkIntegerInput('checkIntegerInput')).not.toBeUndefined(); 77fb726d48Sopenharmony_ci }); 78fb726d48Sopenharmony_ci 79fb726d48Sopenharmony_ci it('spSdkConfigTest14', function () { 80fb726d48Sopenharmony_ci expect(spSdkConfig.checkFloatInput('checkFloatInput')).not.toBeUndefined(); 81fb726d48Sopenharmony_ci }); 82fb726d48Sopenharmony_ci 83fb726d48Sopenharmony_ci it('spSdkConfigTest15', function () { 84fb726d48Sopenharmony_ci expect(spSdkConfig.isAbleShowConfig(false)).toBeUndefined(); 85fb726d48Sopenharmony_ci }); 86fb726d48Sopenharmony_ci 87fb726d48Sopenharmony_ci it('spSdkConfigTest16', function () { 88fb726d48Sopenharmony_ci expect(spSdkConfig.isAbleShowConfig(true)).toBeUndefined(); 89fb726d48Sopenharmony_ci }); 90fb726d48Sopenharmony_ci 91fb726d48Sopenharmony_ci it('spSdkConfigTest17', function () { 92fb726d48Sopenharmony_ci spSdkConfig.sdkConfigList = { 93fb726d48Sopenharmony_ci name: '', 94fb726d48Sopenharmony_ci configuration: { 95fb726d48Sopenharmony_ci ss: { 96fb726d48Sopenharmony_ci type: 'string', 97fb726d48Sopenharmony_ci default: 'strsadsa', 98fb726d48Sopenharmony_ci description: 'xxxx', 99fb726d48Sopenharmony_ci }, 100fb726d48Sopenharmony_ci aa: { 101fb726d48Sopenharmony_ci type: 'string', 102fb726d48Sopenharmony_ci default: '11', 103fb726d48Sopenharmony_ci }, 104fb726d48Sopenharmony_ci cc: { 105fb726d48Sopenharmony_ci type: 'number', 106fb726d48Sopenharmony_ci description: 'number1111', 107fb726d48Sopenharmony_ci default: '11', 108fb726d48Sopenharmony_ci }, 109fb726d48Sopenharmony_ci ee: { 110fb726d48Sopenharmony_ci type: 'integer', 111fb726d48Sopenharmony_ci default: '12', 112fb726d48Sopenharmony_ci description: 'integer1222', 113fb726d48Sopenharmony_ci }, 114fb726d48Sopenharmony_ci ff: { 115fb726d48Sopenharmony_ci type: 'boolean', 116fb726d48Sopenharmony_ci description: 'switchhh', 117fb726d48Sopenharmony_ci default: '11', 118fb726d48Sopenharmony_ci }, 119fb726d48Sopenharmony_ci }, 120fb726d48Sopenharmony_ci }; 121fb726d48Sopenharmony_ci expect(spSdkConfig.initConfig()).toBeUndefined(); 122fb726d48Sopenharmony_ci }); 123fb726d48Sopenharmony_ci it('spSdkConfigTest18', function () { 124fb726d48Sopenharmony_ci expect(spSdkConfig.getGpuConfig()).toStrictEqual({ 125fb726d48Sopenharmony_ci aa: '11', 126fb726d48Sopenharmony_ci cc: 11, 127fb726d48Sopenharmony_ci ee: 12, 128fb726d48Sopenharmony_ci ff: false, 129fb726d48Sopenharmony_ci ss: 'strsadsa', 130fb726d48Sopenharmony_ci }); 131fb726d48Sopenharmony_ci }); 132fb726d48Sopenharmony_ci}); 133