提交 d1e17a4f 编写于 作者: Y youyouyuai

Merge remote-tracking branch 'upstream/master'

...@@ -51,12 +51,9 @@ hcpptest_suite("ActsAbilityMgrTest") { ...@@ -51,12 +51,9 @@ hcpptest_suite("ActsAbilityMgrTest") {
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite/", "${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite/",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry", "//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//kernel/liteos_a/kernel/include",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include", "//third_party/bounds_checking_function/include",
"//third_party/cJSON", "//third_party/cJSON",
"//utils/native/lite/include", "//utils/native/lite/include",
"//kernel/liteos_a/lib/libsec/include",
"${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite", "${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite",
"//foundation/graphic/ui/interfaces/kits", "//foundation/graphic/ui/interfaces/kits",
"//foundation/graphic/utils/interfaces/innerkits", "//foundation/graphic/utils/interfaces/innerkits",
......
...@@ -31,8 +31,6 @@ hcpptest_suite("ActsBundleMgrTest") { ...@@ -31,8 +31,6 @@ hcpptest_suite("ActsBundleMgrTest") {
"//third_party/googletest/googletest/include", "//third_party/googletest/googletest/include",
"//utils/native/lite/include", "//utils/native/lite/include",
"${aafwk_lite_path}/interfaces/innerkits/intent_lite", "${aafwk_lite_path}/interfaces/innerkits/intent_lite",
"//kernel/liteos_a/kernel/include",
"//kernel/liteos_a/kernel/common",
"//third_party/cJSON", "//third_party/cJSON",
] ]
deps = [ deps = [
......
...@@ -31,7 +31,6 @@ hcpptest_suite("ActsSoftBusTest") { ...@@ -31,7 +31,6 @@ hcpptest_suite("ActsSoftBusTest") {
"//third_party/cJSON", "//third_party/cJSON",
"//third_party/mbedtls/include", "//third_party/mbedtls/include",
"//third_party/bounds_checking_function/include", "//third_party/bounds_checking_function/include",
"//kernel/liteos_a/lib/libsec/include",
"//base/startup/syspara_lite/interfaces/kits/include", "//base/startup/syspara_lite/interfaces/kits/include",
"//base/security/deviceauth/interfaces/innerkits/deviceauth_lite", "//base/security/deviceauth/interfaces/innerkits/deviceauth_lite",
"//base/security/deviceauth/frameworks/deviceauth_lite/source/huks_adapter/", "//base/security/deviceauth/frameworks/deviceauth_lite/source/huks_adapter/",
......
# Assertion
- Assertion,HJSUnit测试框架提供的断言能力,通过expect(XXX).assertXX的断言方式检查结果。
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("../../common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report',
'version': '1.0.3'
})
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionName).assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertClose', function () {
it('assertCloseSuccess001', 0, function () {
let a = 100;
let b = 0.1
expect(a).assertClose(99, b)
})
it('assertCloseFail002', 0, function () {
let a = 100;
let b = 0.1
expect(a).assertClose(1, b)
})
it('assertCloseFail003', 0, function () {
let a = 100;
let b = 0.1
expect(a).assertClose(null, b)
})
it('assertCloseFail004', 0, function () {
expect(null).assertClose(null, 0)
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertContain', function () {
it('assertContainSuccessOnString', 0, function () {
let a = 'abc';
let b = 'b'
expect(a).assertContain(b)
})
it('assertContainSuccessOnArray', 0, function () {
let a = ['a', 'b', 'c'];
let b = 'b'
expect(a).assertContain(b)
})
it('assertContainFailOnString', 0, function () {
let a = 'abc';
let b = 'd'
expect(a).assertContain(b)
})
it('assertContainFailOnArray', 0, function () {
let a = ['a', 'b', 'c'];
let b = 'd'
expect(a).assertContain(b)
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertFail', function () {
it('assertFail', 0, function () {
let a = null
expect(a).assertFail()
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertFalse', function () {
it('assertFalseSuccess', 0, function () {
let d = false
expect(d).assertFalse()
})
it('assertFalseFail', 0, function () {
let d = true
expect(d).assertFalse()
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertInstanceOf', function () {
it('assertInstanceOfSuccessOnNumber', 0, function () {
let a = 12;
expect(a).assertInstanceOf('Number')
})
it('assertInstanceOfFailOnNumber', 0, function () {
let a = "abc";
expect(a).assertInstanceOf('String');
expect(a).assertInstanceOf('Number');
})
})
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertLarger', function () {
it('assertLargerSuccess', 0, function () {
let a = 12;
let b = 10;
expect(a).assertLarger(b)
})
it('assertLargerFail', 0, function () {
let a = 12;
let b = 13;
expect(a).assertLarger(b);
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertLess', function () {
it('assertLessSuccess', 0, function () {
let a = 12;
let b = 15;
expect(a).assertLess(b)
})
it('assertLessFail', 0, function () {
let a = 12;
let b = 10;
expect(a).assertLess(b);
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertNull', function () {
it('assertNullSuccess', 0, function () {
let d
expect(d).assertNull()
})
it('assertNullFail', 0, function () {
let d = 100
expect(d).assertNull()
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertThrowError', function () {
it('assertThrowErrorFail001', 0, function () {
let a = 12;
expect(a).assertThrowError()
})
it('assertThrowErrorSuccess', 0, function () {
let a = test
function test() {
throw Error("exception")
}
expect(a).assertThrowError("exception");
})
it('assertThrowErrorFail002', 0, function () {
let a = test
function test() {
throw Error("exception")
}
expect(a).assertThrowError("test");
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('assertUndefined', function () {
it('assertUndefinedSuccess', 0, function () {
let a = undefined
expect(a).assertUndefined()
})
it('assertUndefinedFail', 0, function () {
let a = 100
expect(a).assertUndefined()
})
})
\ No newline at end of file
# Async
- 异步,HJSUnit测试框架针对测试用例提供的异步能力。测试框架识别异步用例的关键字为async,用法如下:在回调函数function前加“async”关键字,调用异步接口时需加上“await”前缀;回调函数中添加“done”参数和用例结尾的加上“done()”,保证可以在执行该异步用例时强制获取到用例执行结果。
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("../../common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report',
'version': '1.0.3'
})
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it} from 'deccjsunit/index'
describe('callback', function () {
it('callbackDemo', 0, async function (done) {
await a()
})
})
function a(done){
setTimeout(function(){
console.log("run a after 1000ms")
},1000)
done()
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./Callback.test.js')
require('./Promise.test.js')
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it} from 'deccjsunit/index'
describe('promise', function () {
it('promiseDemo', 0, async function (done) {
await new Promise(
function (resolve, reject) {
// 一段耗时的异步操作
resolve('成功') // 数据处理完成
// reject('失败') // 数据处理出错
}).then(
(res) => {console.log(res)}, // 成功
(err) => {console.log(err)} // 失败
)
done()
})
})
\ No newline at end of file
# DataDriver
- DataDriver,HJSUnit测试框架提供的数据驱动能力。通过配置data.json文件,实现针对指定测试套、测试用例的参数传递,亦或是根据指定测试套、测试用例的执行次数做压力测试。
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("../../common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, Constant, DataDriver, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
import data from '../../../test/data.json'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const dataDriver = new DataDriver({data:data})
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report',
'version': '1.0.3'
})
core.addService('dataDriver',dataDriver)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from 'deccjsunit/index'
describe('testSuite01', function () {
it('testSpec01', function (data) {
console.info('testSpec01......' + JSON.stringify(data))
})
it('testSpec02', function (data) {
console.info('testSpec02......' + JSON.stringify(data))
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./DataDriver.test.js')
\ No newline at end of file
{
"suites": [{
"describe":["testSuite01"],
"params":{
"suiteParam01": "suiteParam"
}
},{
"describe":["testSuite01","testSpec02"],
"params":{
"suiteParam": "suiteParam"
}
},{
"describe":"testSuite01",
"stress": 8,
"items":[{
"it":"testSpec01",
"stress": 1,
"params":[{
"name":"tom"
}]
},{
"it":"testSpec02",
"stress": 2
}]
}]
}
\ No newline at end of file
# App Samples
- [Introduction](#section_HJSUnit_001)
- [Usage](#section_HJSUnit_002)
- [Limitations](#section_HJSUnit_003)
## Introduction<a name="section_HJSUnit_001"></a>
We provide a series of app samples to help you quickly get familiar with the test capabilities and how to use of the HJSUnit. Each app sample is an independent project in DevEco Studio. You can import sample code from a project to a customized project to learn how to use APIs by browsing code, building the project, and installing and running the app.
## Usage<a name="section_HJSUnit_002"></a>
1. Development tool: Devco Studio 2.2.0.200 or later
2. Procedure: Create a blank JS template project in Devco Studio, import the sample code in the ohosTest directory of the sample project to the ohosTest directory of the user-defined project, and compile, build, run, and debug the project.
3. After HAP installation and execution, you can view the execution effect of the sample on the device and then conduct debugging.
## Limitations<a name="section_HJSUnit_003"></a>
Before installing and running the sample, check the **deviceType** field in the **config.json** file to obtain the device types supported by the sample. You can modify this field to enable the sample to run on your target device. \(The **config.json** file is generally stored in the **entry/src/main** directory, which may be different depending on the samples.\)
\ No newline at end of file
# 应用示例
- [概要简介](#section_HJSUnit_001)
- [使用说明](#section_HJSUnit_002)
- [约束与限制](#section_HJSUnit_003)
## 概要简介<a name="section_HJSUnit_001"></a>
为帮助测试人员快速熟悉HJSUnit所提供的测试能力和如何使用,我们提供了一系列的应用示例,即Sample。每一个应用示例都是一个独立的DevEco Studio工程项目,测试人员可以将工程中的代码导入到自定义工程中,通过浏览代码、编译工程、安装和运行应用示例来了解应用示例中涉及测试能力的使用方法。
## 使用说明<a name="section_HJSUnit_002"></a>
1. 开发工具:2.2.0.200版本及以上的Deveco Studio
2. 使用步骤:①在Deveco Studio中新建空白JS模板项目,将示例工程ohosTest目录下的示例代码导入到自定义工程的ohosTest目录下,进行编译构建及运行调试。
3. 安装运行后,即可在设备上查看应用示例运行效果,以及进行相关调试。
## 约束与限制<a name="section_HJSUnit_003"></a>
安装运行应用示例之前,请先通过config.json文件中的"deviceType"字段来确认该应用示例支持的设备类型,可尝试通过修改该字段使其可以在相应类型的设备上运行(config.json文件一般在代码的entry/src/main路径下,不同的Sample可能会有不同)。
\ No newline at end of file
...@@ -561,7 +561,7 @@ describe('fileIOTest', function () { ...@@ -561,7 +561,7 @@ describe('fileIOTest', function () {
try { try {
expect(fileio.chmodSync(fpath, 0o660)).assertNull() expect(fileio.chmodSync(fpath, 0o660)).assertNull()
expect(fileio.Stat.statSync(fpath).mode & 0o777).assertEqual(0o660) expect(fileio.statSync(fpath).mode & 0o777).assertEqual(0o660)
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
console.log("fileio_test_chmod_sync_000 has failed for " + e) console.log("fileio_test_chmod_sync_000 has failed for " + e)
...@@ -661,7 +661,7 @@ describe('fileIOTest', function () { ...@@ -661,7 +661,7 @@ describe('fileIOTest', function () {
try { try {
expect(fileio.truncateSync(fpath)).assertNull() expect(fileio.truncateSync(fpath)).assertNull()
expect(fileio.Stat.statSync(fpath).size).assertEqual(0) expect(fileio.statSync(fpath).size).assertEqual(0)
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
console.log("fileio_test_truncate_sync_000 has failed for " + e) console.log("fileio_test_truncate_sync_000 has failed for " + e)
...@@ -761,7 +761,7 @@ describe('fileIOTest', function () { ...@@ -761,7 +761,7 @@ describe('fileIOTest', function () {
try { try {
let fd = fileio.openSync(fpath, 0o2) let fd = fileio.openSync(fpath, 0o2)
expect(fileio.fchmodSync(fd, 0o660)).assertNull() expect(fileio.fchmodSync(fd, 0o660)).assertNull()
expect(fileio.Stat.statSync(fpath).mode & 0o777).assertEqual(0o660) expect(fileio.statSync(fpath).mode & 0o777).assertEqual(0o660)
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
console.log("fileio_test_fchmod_sync_000 has failed for " + e) console.log("fileio_test_fchmod_sync_000 has failed for " + e)
...@@ -794,7 +794,7 @@ describe('fileIOTest', function () { ...@@ -794,7 +794,7 @@ describe('fileIOTest', function () {
try { try {
let fd = fileio.openSync(fpath, 0o2) let fd = fileio.openSync(fpath, 0o2)
expect(fileio.ftruncateSync(fd)).assertNull() expect(fileio.ftruncateSync(fd)).assertNull()
expect(fileio.Stat.statSync(fpath).size).assertEqual(0) expect(fileio.statSync(fpath).size).assertEqual(0)
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
console.log("fileio_test_ftruncate_sync_000 has failed for " + e) console.log("fileio_test_ftruncate_sync_000 has failed for " + e)
......
...@@ -29,7 +29,7 @@ describe('fileIOTestDir', function () { ...@@ -29,7 +29,7 @@ describe('fileIOTestDir', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
expect(dd.closeSync()).assertNull() expect(dd.closeSync()).assertNull()
expect(fileio.rmdirSync(dpath)).assertNull() expect(fileio.rmdirSync(dpath)).assertNull()
...@@ -46,7 +46,7 @@ describe('fileIOTestDir', function () { ...@@ -46,7 +46,7 @@ describe('fileIOTestDir', function () {
*/ */
it('fileio_test_dir_open_close_sync_001', 0, function () { it('fileio_test_dir_open_close_sync_001', 0, function () {
try { try {
fileio.Dir.opendirSync() fileio.opendirSync()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
} }
...@@ -61,7 +61,7 @@ describe('fileIOTestDir', function () { ...@@ -61,7 +61,7 @@ describe('fileIOTestDir', function () {
let dpath = nextFileName('fileio_test_dir_read_sync_000') + 'd' let dpath = nextFileName('fileio_test_dir_read_sync_000') + 'd'
try { try {
fileio.Dir.opendirSync(dpath) fileio.opendirSync(dpath)
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
} }
...@@ -79,7 +79,7 @@ describe('fileIOTestDir', function () { ...@@ -79,7 +79,7 @@ describe('fileIOTestDir', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
expect(dd.readSync() != null).assertTrue() expect(dd.readSync() != null).assertTrue()
expect(dd.closeSync()).assertNull() expect(dd.closeSync()).assertNull()
...@@ -105,7 +105,7 @@ describe('fileIOTestDir', function () { ...@@ -105,7 +105,7 @@ describe('fileIOTestDir', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
expect(dd.readSync(-1) != null).assertTrue() expect(dd.readSync(-1) != null).assertTrue()
expect(null).assertFail() expect(null).assertFail()
......
...@@ -31,7 +31,7 @@ describe('fileIOTestDirent', function () { ...@@ -31,7 +31,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -57,7 +57,7 @@ describe('fileIOTestDirent', function () { ...@@ -57,7 +57,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -84,7 +84,7 @@ describe('fileIOTestDirent', function () { ...@@ -84,7 +84,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -109,7 +109,7 @@ describe('fileIOTestDirent', function () { ...@@ -109,7 +109,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -136,7 +136,7 @@ describe('fileIOTestDirent', function () { ...@@ -136,7 +136,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -161,7 +161,7 @@ describe('fileIOTestDirent', function () { ...@@ -161,7 +161,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -188,7 +188,7 @@ describe('fileIOTestDirent', function () { ...@@ -188,7 +188,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -213,7 +213,7 @@ describe('fileIOTestDirent', function () { ...@@ -213,7 +213,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -240,7 +240,7 @@ describe('fileIOTestDirent', function () { ...@@ -240,7 +240,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -265,7 +265,7 @@ describe('fileIOTestDirent', function () { ...@@ -265,7 +265,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -292,7 +292,7 @@ describe('fileIOTestDirent', function () { ...@@ -292,7 +292,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -317,7 +317,7 @@ describe('fileIOTestDirent', function () { ...@@ -317,7 +317,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -344,7 +344,7 @@ describe('fileIOTestDirent', function () { ...@@ -344,7 +344,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -369,7 +369,7 @@ describe('fileIOTestDirent', function () { ...@@ -369,7 +369,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
let dd = fileio.Dir.opendirSync(dpath) let dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
...@@ -396,7 +396,7 @@ describe('fileIOTestDirent', function () { ...@@ -396,7 +396,7 @@ describe('fileIOTestDirent', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
dd = fileio.Dir.opendirSync(dpath) dd = fileio.opendirSync(dpath)
expect(dd !== null).assertTrue() expect(dd !== null).assertTrue()
let dirent = dd.readSync() let dirent = dd.readSync()
expect(dirent !== null).assertTrue() expect(dirent !== null).assertTrue()
......
...@@ -65,7 +65,7 @@ describe('fileIOTestStat', function () { ...@@ -65,7 +65,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat !== null).assertTrue() expect(stat !== null).assertTrue()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -83,7 +83,7 @@ describe('fileIOTestStat', function () { ...@@ -83,7 +83,7 @@ describe('fileIOTestStat', function () {
let fpath = nextFileName('fileio_test_stat_stat_sync_001') let fpath = nextFileName('fileio_test_stat_stat_sync_001')
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
} }
...@@ -99,7 +99,7 @@ describe('fileIOTestStat', function () { ...@@ -99,7 +99,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.dev).assertInstanceOf('Number') expect(stat.dev).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -118,7 +118,7 @@ describe('fileIOTestStat', function () { ...@@ -118,7 +118,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.ino).assertInstanceOf('Number') expect(stat.ino).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -137,7 +137,7 @@ describe('fileIOTestStat', function () { ...@@ -137,7 +137,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.mode).assertInstanceOf('Number') expect(stat.mode).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -156,7 +156,7 @@ describe('fileIOTestStat', function () { ...@@ -156,7 +156,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.nlink).assertInstanceOf('Number') expect(stat.nlink).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -175,7 +175,7 @@ describe('fileIOTestStat', function () { ...@@ -175,7 +175,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.uid).assertInstanceOf('Number') expect(stat.uid).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -194,7 +194,7 @@ describe('fileIOTestStat', function () { ...@@ -194,7 +194,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.gid).assertInstanceOf('Number') expect(stat.gid).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -213,7 +213,7 @@ describe('fileIOTestStat', function () { ...@@ -213,7 +213,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.rdev).assertInstanceOf('Number') expect(stat.rdev).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -232,7 +232,7 @@ describe('fileIOTestStat', function () { ...@@ -232,7 +232,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.size).assertInstanceOf('Number') expect(stat.size).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -251,7 +251,7 @@ describe('fileIOTestStat', function () { ...@@ -251,7 +251,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.blocks).assertInstanceOf('Number') expect(stat.blocks).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -270,7 +270,7 @@ describe('fileIOTestStat', function () { ...@@ -270,7 +270,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.atime).assertInstanceOf('Number') expect(stat.atime).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -289,7 +289,7 @@ describe('fileIOTestStat', function () { ...@@ -289,7 +289,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.mtime).assertInstanceOf('Number') expect(stat.mtime).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -308,7 +308,7 @@ describe('fileIOTestStat', function () { ...@@ -308,7 +308,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.ctime).assertInstanceOf('Number') expect(stat.ctime).assertInstanceOf('Number')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -327,7 +327,7 @@ describe('fileIOTestStat', function () { ...@@ -327,7 +327,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isBlockDevice()).assertInstanceOf('Boolean') expect(stat.isBlockDevice()).assertInstanceOf('Boolean')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -346,7 +346,7 @@ describe('fileIOTestStat', function () { ...@@ -346,7 +346,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isBlockDevice()).assertFalse() expect(stat.isBlockDevice()).assertFalse()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -365,7 +365,7 @@ describe('fileIOTestStat', function () { ...@@ -365,7 +365,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isBlockDevice(-1)).assertFalse() expect(stat.isBlockDevice(-1)).assertFalse()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
...@@ -383,7 +383,7 @@ describe('fileIOTestStat', function () { ...@@ -383,7 +383,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isCharacterDevice()).assertInstanceOf('Boolean') expect(stat.isCharacterDevice()).assertInstanceOf('Boolean')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -402,7 +402,7 @@ describe('fileIOTestStat', function () { ...@@ -402,7 +402,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isCharacterDevice()).assertFalse() expect(stat.isCharacterDevice()).assertFalse()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -421,7 +421,7 @@ describe('fileIOTestStat', function () { ...@@ -421,7 +421,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isCharacterDevice(-1)).assertFalse() expect(stat.isCharacterDevice(-1)).assertFalse()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
...@@ -439,7 +439,7 @@ describe('fileIOTestStat', function () { ...@@ -439,7 +439,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isDirectory()).assertInstanceOf('Boolean') expect(stat.isDirectory()).assertInstanceOf('Boolean')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -458,7 +458,7 @@ describe('fileIOTestStat', function () { ...@@ -458,7 +458,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isDirectory()).assertFalse() expect(stat.isDirectory()).assertFalse()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -477,7 +477,7 @@ describe('fileIOTestStat', function () { ...@@ -477,7 +477,7 @@ describe('fileIOTestStat', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
let stat = fileio.Stat.statSync(dpath) let stat = fileio.statSync(dpath)
expect(stat.isDirectory()).assertTrue() expect(stat.isDirectory()).assertTrue()
expect(fileio.rmdirSync(dpath)).assertNull() expect(fileio.rmdirSync(dpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -496,7 +496,7 @@ describe('fileIOTestStat', function () { ...@@ -496,7 +496,7 @@ describe('fileIOTestStat', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
let stat = fileio.Stat.statSync(dpath) let stat = fileio.statSync(dpath)
expect(stat.isDirectory(-1)).assertTrue() expect(stat.isDirectory(-1)).assertTrue()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
...@@ -514,7 +514,7 @@ describe('fileIOTestStat', function () { ...@@ -514,7 +514,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isFIFO()).assertInstanceOf('Boolean') expect(stat.isFIFO()).assertInstanceOf('Boolean')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -533,7 +533,7 @@ describe('fileIOTestStat', function () { ...@@ -533,7 +533,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isFIFO()).assertFalse() expect(stat.isFIFO()).assertFalse()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -552,7 +552,7 @@ describe('fileIOTestStat', function () { ...@@ -552,7 +552,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isFIFO(-1)).assertFalse() expect(stat.isFIFO(-1)).assertFalse()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
...@@ -570,7 +570,7 @@ describe('fileIOTestStat', function () { ...@@ -570,7 +570,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertInstanceOf('Boolean') expect(prepareFile(fpath, FILE_CONTENT)).assertInstanceOf('Boolean')
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isFile()).assertInstanceOf('Boolean') expect(stat.isFile()).assertInstanceOf('Boolean')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -589,7 +589,7 @@ describe('fileIOTestStat', function () { ...@@ -589,7 +589,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertInstanceOf('Boolean') expect(prepareFile(fpath, FILE_CONTENT)).assertInstanceOf('Boolean')
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isFile()).assertTrue() expect(stat.isFile()).assertTrue()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -608,7 +608,7 @@ describe('fileIOTestStat', function () { ...@@ -608,7 +608,7 @@ describe('fileIOTestStat', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
let stat = fileio.Stat.statSync(dpath) let stat = fileio.statSync(dpath)
expect(stat.isFile()).assertFalse() expect(stat.isFile()).assertFalse()
expect(fileio.rmdirSync(dpath)).assertNull() expect(fileio.rmdirSync(dpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -627,7 +627,7 @@ describe('fileIOTestStat', function () { ...@@ -627,7 +627,7 @@ describe('fileIOTestStat', function () {
try { try {
expect(fileio.mkdirSync(dpath)).assertNull() expect(fileio.mkdirSync(dpath)).assertNull()
let stat = fileio.Stat.statSync(dpath) let stat = fileio.statSync(dpath)
expect(stat.isFile(-1)).assertFalse() expect(stat.isFile(-1)).assertFalse()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
...@@ -645,7 +645,7 @@ describe('fileIOTestStat', function () { ...@@ -645,7 +645,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isSocket()).assertInstanceOf('Boolean') expect(stat.isSocket()).assertInstanceOf('Boolean')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -664,7 +664,7 @@ describe('fileIOTestStat', function () { ...@@ -664,7 +664,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isSocket()).assertFalse() expect(stat.isSocket()).assertFalse()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -683,7 +683,7 @@ describe('fileIOTestStat', function () { ...@@ -683,7 +683,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isSocket(-1)).assertFalse() expect(stat.isSocket(-1)).assertFalse()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
...@@ -701,7 +701,7 @@ describe('fileIOTestStat', function () { ...@@ -701,7 +701,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isSymbolicLink()).assertInstanceOf('Boolean') expect(stat.isSymbolicLink()).assertInstanceOf('Boolean')
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -720,7 +720,7 @@ describe('fileIOTestStat', function () { ...@@ -720,7 +720,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isSymbolicLink()).assertFalse() expect(stat.isSymbolicLink()).assertFalse()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
} catch (e) { } catch (e) {
...@@ -739,7 +739,7 @@ describe('fileIOTestStat', function () { ...@@ -739,7 +739,7 @@ describe('fileIOTestStat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let stat = fileio.Stat.statSync(fpath) let stat = fileio.statSync(fpath)
expect(stat.isSymbolicLink(-1)).assertFalse() expect(stat.isSymbolicLink(-1)).assertFalse()
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
......
...@@ -29,7 +29,7 @@ describe('fileIOTestStream', function () { ...@@ -29,7 +29,7 @@ describe('fileIOTestStream', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
var ss = fileio.Stream.createStreamSync(fpath, "r+") var ss = fileio.createStreamSync(fpath, "r+")
expect(ss !== null).assertTrue() expect(ss !== null).assertTrue()
expect(ss.closeSync()).assertNull() expect(ss.closeSync()).assertNull()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
...@@ -48,7 +48,7 @@ describe('fileIOTestStream', function () { ...@@ -48,7 +48,7 @@ describe('fileIOTestStream', function () {
let fpath = nextFileName('fileio_test_stream_create_stream_sync_001') let fpath = nextFileName('fileio_test_stream_create_stream_sync_001')
try { try {
fileio.Stream.createStreamSync(fpath, "r+") fileio.createStreamSync(fpath, "r+")
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
} }
...@@ -64,7 +64,7 @@ describe('fileIOTestStream', function () { ...@@ -64,7 +64,7 @@ describe('fileIOTestStream', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
fileio.Stream.createStreamSync(fpath, "ohos") fileio.createStreamSync(fpath, "ohos")
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
...@@ -82,7 +82,7 @@ describe('fileIOTestStream', function () { ...@@ -82,7 +82,7 @@ describe('fileIOTestStream', function () {
try { try {
var fd = fileio.openSync(fpath, 0o2) var fd = fileio.openSync(fpath, 0o2)
let ss = fileio.Stream.fdopenStreamSync(fd, "r+") let ss = fileio.fdopenStreamSync(fd, "r+")
expect(ss !== null).assertTrue() expect(ss !== null).assertTrue()
expect(ss.closeSync()).assertNull() expect(ss.closeSync()).assertNull()
expect(fileio.unlinkSync(fpath)).assertNull() expect(fileio.unlinkSync(fpath)).assertNull()
...@@ -99,7 +99,7 @@ describe('fileIOTestStream', function () { ...@@ -99,7 +99,7 @@ describe('fileIOTestStream', function () {
*/ */
it('fileio_test_stream_fdopen_stream_sync_001', 0, function () { it('fileio_test_stream_fdopen_stream_sync_001', 0, function () {
try { try {
let ss = fileio.Stream.fdopenStreamSync(-1, "r+") let ss = fileio.fdopenStreamSync(-1, "r+")
expect(null).assertFail() expect(null).assertFail()
} catch (e) { } catch (e) {
} }
...@@ -115,7 +115,7 @@ describe('fileIOTestStream', function () { ...@@ -115,7 +115,7 @@ describe('fileIOTestStream', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let ss = fileio.Stream.createStreamSync(fpath, "r+") let ss = fileio.createStreamSync(fpath, "r+")
expect(ss !== null).assertTrue() expect(ss !== null).assertTrue()
let len = ss.readSync(new ArrayBuffer(4096)) let len = ss.readSync(new ArrayBuffer(4096))
expect(len).assertEqual(FILE_CONTENT.length) expect(len).assertEqual(FILE_CONTENT.length)
...@@ -137,7 +137,7 @@ describe('fileIOTestStream', function () { ...@@ -137,7 +137,7 @@ describe('fileIOTestStream', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let ss = fileio.Stream.createStreamSync(fpath, "r+") let ss = fileio.createStreamSync(fpath, "r+")
expect(ss !== null).assertTrue() expect(ss !== null).assertTrue()
expect(ss.writeSync(FILE_CONTENT)).assertEqual(FILE_CONTENT.length) expect(ss.writeSync(FILE_CONTENT)).assertEqual(FILE_CONTENT.length)
expect(ss.closeSync()).assertNull() expect(ss.closeSync()).assertNull()
...@@ -158,7 +158,7 @@ describe('fileIOTestStream', function () { ...@@ -158,7 +158,7 @@ describe('fileIOTestStream', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue() expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
try { try {
let ss = fileio.Stream.createStreamSync(fpath, "r+") let ss = fileio.createStreamSync(fpath, "r+")
expect(ss !== null).assertTrue() expect(ss !== null).assertTrue()
expect(ss.writeSync(FILE_CONTENT)).assertEqual(FILE_CONTENT.length) expect(ss.writeSync(FILE_CONTENT)).assertEqual(FILE_CONTENT.length)
expect(ss.flushSync()).assertNull() expect(ss.flushSync()).assertNull()
......
...@@ -17,5 +17,9 @@ group("ActsGlobalTest") { ...@@ -17,5 +17,9 @@ group("ActsGlobalTest") {
"//test/xts/acts/global_lite/i18n_lite/numberrecall_posix:ActsNumberRecallTest", "//test/xts/acts/global_lite/i18n_lite/numberrecall_posix:ActsNumberRecallTest",
"//test/xts/acts/global_lite/i18n_lite/datetime_posix:ActsGlobalDateTimeTest", "//test/xts/acts/global_lite/i18n_lite/datetime_posix:ActsGlobalDateTimeTest",
"//test/xts/acts/global_lite/i18n_lite/datetimerecall_posix:ActsGlobalDateTimeRecallTest", "//test/xts/acts/global_lite/i18n_lite/datetimerecall_posix:ActsGlobalDateTimeRecallTest",
"//test/xts/acts/global_lite/i18n_lite/week_plural_number/src:WeekPluralNumbertest",
# depend on the resources
#"//test/xts/acts/global_lite/i18n_lite/resource_parse_load/src:ResourceParseLoadtest",
] ]
} }
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ResourceParseLoadtest") {
suite_name = "acts"
sources = [
"global_test.cpp",
"hap_manager_test.cpp",
"hap_parser_test.cpp",
"hap_resource_test.cpp",
"locale_info_test.cpp",
"res_config_impl_test.cpp",
"res_config_test.cpp",
"res_desc_test.cpp",
"resource_manager_performance_test.cpp",
"resource_manager_test.cpp",
"string_utils_test.cpp",
"test_common.cpp",
]
include_dirs = [
"//base/global/i18n_lite/interfaces/kits/i18n/include",
"//base/global/resmgr_lite/frameworks/resmgr_lite/include",
"//base/global/resmgr_lite/interfaces/innerkits/include",
]
deps = [
"//base/global/resmgr_lite/frameworks/resmgr_lite:global_resmgr",
#"//third_party/bounds_checking_function:libsec_shared",
]
}
{
"kits": [
{
"push": [
"ResourceParseLoadtest->/data/local/tmp/ResourceParseLoadtest"
],
"type": "PushKit",
"post-push": [
"chmod -R 777 /data/local/tmp/*"
]
}
],
"driver": {
"native-test-timeout": "120000",
"type": "CppTest",
"module-name": "ResourceParseLoadtest",
"runtime-hint": "1s",
"native-test-device-path": "/data/local/tmp"
},
"description": "ResourceParseLoadtest Tests"
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "global_test.h"
#include <gtest/gtest.h>
#include "test_common.h"
#include "utils/errors.h"
#include "utils/string_utils.h"
#define private public
#include "global.h"
using namespace OHOS::Global::Resource;
using namespace testing::ext;
class GlobalTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp();
void TearDown();
};
void GlobalTest::SetUpTestCase(void)
{
// step 1: input testsuit setup step
g_logLevel = LOG_DEBUG;
}
void GlobalTest::TearDownTestCase()
{
// step 2: input testsuit teardown step
}
void GlobalTest::SetUp()
{
// step 3: input testcase setup step
}
void GlobalTest::TearDown()
{
// step 4: input testcase teardown step
}
int GetResId(const std::string &name, ResType resType)
{
auto rc = new ResConfigImpl;
rc->SetLocaleInfo("en", nullptr, "US");
std::string resPath = FormatFullPath(g_resFilePath);
const char *path = resPath.c_str();
const HapResource *pResource = HapResource::LoadFromIndex(path, rc);
int ret = pResource->GetIdByName(name.c_str(), resType);
delete pResource;
delete rc;
return ret;
}
/*
* @tc.name: GlobalFuncTest001
* @tc.desc: Test GLOBAL_ConfigLanguage function, file case.
* @tc.type: FUNC
*/
HWTEST_F(GlobalTest, GlobalFuncTest001, TestSize.Level1)
{
char lan[10];
char region[10];
GLOBAL_ConfigLanguage("en-Latn-US");
int32_t ret = GLOBAL_GetLanguage(lan, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("en"), lan);
ret = GLOBAL_GetRegion(region, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("US"), region);
GLOBAL_ConfigLanguage("en_Latn_US");
ret = GLOBAL_GetLanguage(lan, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("en"), lan);
ret = GLOBAL_GetRegion(region, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("US"), region);
GLOBAL_ConfigLanguage("en-US");
ret = GLOBAL_GetLanguage(lan, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("en"), lan);
ret = GLOBAL_GetRegion(region, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("US"), region);
GLOBAL_ConfigLanguage("en_US");
ret = GLOBAL_GetLanguage(lan, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("en"), lan);
ret = GLOBAL_GetRegion(region, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("US"), region);
GLOBAL_ConfigLanguage("en");
ret = GLOBAL_GetLanguage(lan, 10);
ASSERT_EQ(OK, ret);
ASSERT_EQ(std::string("en"), lan);
}
/*
* @tc.name: GlobalFuncTest002
* @tc.desc: Test GLOBAL_GetValueByName function, file case.
* @tc.type: FUNC
*/
HWTEST_F(GlobalTest, GlobalFuncTest002, TestSize.Level1)
{
GLOBAL_ConfigLanguage("en_Latn_US");
char *values = nullptr;
int32_t ret = GLOBAL_GetValueByName("app_name", FormatFullPath(g_resFilePath).c_str(), &values);
// when ret != OK , values has been freed.
ASSERT_EQ(OK, ret);
EXPECT_EQ(std::string("App Name"), values);
free(values);
}
/*
* @tc.name: GlobalFuncTest003
* @tc.desc: Test GLOBAL_GetValueById function, file case.
* @tc.type: FUNC
*/
HWTEST_F(GlobalTest, GlobalFuncTest003, TestSize.Level1)
{
GLOBAL_ConfigLanguage("en_Latn_US");
char *values = nullptr;
int id = GetResId("app_name", ResType::STRING);
ASSERT_TRUE(id > 0);
int32_t ret = GLOBAL_GetValueById(static_cast<uint32_t>(id), FormatFullPath(g_resFilePath).c_str(), &values);
// when ret != OK , values has been freed.
ASSERT_EQ(OK, ret);
EXPECT_EQ(std::string("App Name"), values);
free(values);
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_GLOBAL_TEST_H
#define RESOURCE_MANAGER_GLOBAL_TEST_H
int GlobalFuncTest001();
int GlobalFuncTest002();
int GlobalFuncTest003();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "hap_manager_test.h"
#include <gtest/gtest.h>
#include "test_common.h"
#include "utils/string_utils.h"
#define private public
#include "hap_manager.h"
using namespace OHOS::Global::Resource;
using namespace testing::ext;
class HapManagerTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp();
void TearDown();
};
void HapManagerTest::SetUpTestCase(void)
{
// step 1: input testsuit setup step
g_logLevel = LOG_DEBUG;
}
void HapManagerTest::TearDownTestCase()
{
// step 2: input testsuit teardown step
}
void HapManagerTest::SetUp()
{
// step 3: input testcase setup step
HILOG_DEBUG("HapManagerTest setup");
}
void HapManagerTest::TearDown()
{
// step 4: input testcase teardown step
HILOG_DEBUG("HapManagerTest teardown");
}
/*
* this test shows how to load a hap, then find value list by id
* @tc.name: HapManagerFuncTest001
* @tc.desc: Test AddResourcePath & GetResourceList function, file case.
* @tc.type: FUNC
*/
HWTEST_F(HapManagerTest, HapManagerFuncTest001, TestSize.Level1)
{
HapManager *hapManager = new HapManager(new ResConfigImpl);
bool ret = hapManager->AddResourcePath(FormatFullPath(g_resFilePath).c_str());
EXPECT_TRUE(ret);
int id = 16777217;
const HapResource::IdValues *idValues = hapManager->GetResourceList(id);
if (idValues == nullptr) {
delete hapManager;
EXPECT_TRUE(false);
return;
}
PrintIdValues(idValues);
delete hapManager;
}
/*
* this test shows how to reload a hap
* @tc.name: HapManagerFuncTest002
* @tc.desc: Test UpdateResConfig & AddResourcePath function, file case.
* @tc.type: FUNC
*/
HWTEST_F(HapManagerTest, HapManagerFuncTest002, TestSize.Level1)
{
ResConfig *rc = CreateResConfig();
if (rc == nullptr) {
EXPECT_TRUE(false);
return;
}
rc->SetLocaleInfo("en", nullptr, "US");
std::string resPath = FormatFullPath(g_resFilePath);
const char *path = resPath.c_str();
HapManager *hapManager = new HapManager(new ResConfigImpl);
if (hapManager == nullptr) {
delete (rc);
EXPECT_TRUE(false);
return;
}
hapManager->UpdateResConfig(*rc);
bool ret = hapManager->AddResourcePath(path);
EXPECT_TRUE(ret);
int id = 16777228;
const HapResource::IdValues *idValues = hapManager->GetResourceList(id);
if (idValues == nullptr) {
delete (hapManager);
delete (rc);
EXPECT_TRUE(false);
return;
}
EXPECT_EQ(static_cast<size_t>(1), idValues->GetLimitPathsConst().size());
PrintIdValues(idValues);
// reload
ResConfig* rc2 = CreateResConfig();
if (rc2 == nullptr) {
delete (hapManager);
delete (rc);
EXPECT_TRUE(false);
return;
}
rc2->SetLocaleInfo("zh", nullptr, "CN");
hapManager->UpdateResConfig(*rc2);
do {
idValues = hapManager->GetResourceList(id);
if (idValues == nullptr) {
EXPECT_TRUE(false);
break;
}
EXPECT_EQ(static_cast<size_t>(2), idValues->GetLimitPathsConst().size());
PrintIdValues(idValues);
} while (false);
delete (hapManager);
delete (rc2);
delete (rc);
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_HAP_MANAGER_TEST_H
#define RESOURCE_MANAGER_HAP_MANAGER_TEST_H
int HapManagerFuncTest001();
int HapManagerFuncTest002();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "hap_parser_test.h"
#include <gtest/gtest.h>
#include "test_common.h"
#include "utils/string_utils.h"
#define private public
#include "hap_parser.h"
using namespace OHOS::Global::Resource;
using namespace testing::ext;
class HapParserTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp();
void TearDown();
};
void HapParserTest::SetUpTestCase(void)
{
// step 1: input testsuit setup step
g_logLevel = LOG_DEBUG;
}
void HapParserTest::TearDownTestCase()
{
// step 2: input testsuit teardown step
}
void HapParserTest::SetUp()
{
// step 3: input testcase setup step
}
void HapParserTest::TearDown()
{
// step 4: input testcase teardown step
}
/*
* @tc.name: HapParserFuncTest001
* @tc.desc: Test CreateResConfigFromKeyParams
* @tc.type: FUNC
*/
HWTEST_F(HapParserTest, HapParserFuncTest001, TestSize.Level1)
{
std::vector<KeyParam *> keyParams;
auto kp = new KeyParam();
kp->type_ = LANGUAGES;
kp->value_ = 31336;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = REGION;
kp->value_ = 17230;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = SCREEN_DENSITY;
kp->value_ = SCREEN_DENSITY_SDPI;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = DEVICETYPE;
kp->value_ = DEVICE_CAR;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = DIRECTION;
kp->value_ = DIRECTION_VERTICAL;
kp->InitStr();
keyParams.push_back(kp);
auto config = HapParser::CreateResConfigFromKeyParams(keyParams);
if (config != nullptr) {
EXPECT_EQ(std::string("zh"), config->GetLocaleInfo()->GetLanguage());
EXPECT_EQ(std::string("CN"), config->GetLocaleInfo()->GetRegion());
EXPECT_EQ(std::string("Hans"), config->GetLocaleInfo()->GetScript());
EXPECT_EQ(DEVICE_CAR, config->GetDeviceType());
EXPECT_EQ(DIRECTION_VERTICAL, config->GetDirection());
EXPECT_EQ(SCREEN_DENSITY_SDPI, config->GetScreenDensity());
} else {
EXPECT_TRUE(false);
}
for (auto kp = keyParams.begin(); kp != keyParams.end(); kp++) {
delete *kp;
}
delete config;
}
/*
* @tc.name: HapParserFuncTest002
* @tc.desc: Test GetDeviceType
* @tc.type: FUNC
*/
HWTEST_F(HapParserTest, HapParserFuncTest002, TestSize.Level1)
{
ASSERT_EQ(DEVICE_CAR, HapParser::GetDeviceType(DEVICE_CAR));
ASSERT_EQ(DEVICE_PC, HapParser::GetDeviceType(DEVICE_PC));
ASSERT_EQ(DEVICE_PHONE, HapParser::GetDeviceType(DEVICE_PHONE));
ASSERT_EQ(DEVICE_TABLET, HapParser::GetDeviceType(DEVICE_TABLET));
ASSERT_EQ(DEVICE_TV, HapParser::GetDeviceType(DEVICE_TV));
ASSERT_EQ(DEVICE_WEARABLE, HapParser::GetDeviceType(DEVICE_WEARABLE));
ASSERT_EQ(DEVICE_NOT_SET, HapParser::GetDeviceType(1000000));
}
/*
* @tc.name: HapParserFuncTest003
* @tc.desc: Test GetScreenDensity
* @tc.type: FUNC
*/
HWTEST_F(HapParserTest, HapParserFuncTest003, TestSize.Level1)
{
ASSERT_EQ(SCREEN_DENSITY_SDPI, HapParser::GetScreenDensity(SCREEN_DENSITY_SDPI));
ASSERT_EQ(SCREEN_DENSITY_MDPI, HapParser::GetScreenDensity(SCREEN_DENSITY_MDPI));
ASSERT_EQ(SCREEN_DENSITY_LDPI, HapParser::GetScreenDensity(SCREEN_DENSITY_LDPI));
ASSERT_EQ(SCREEN_DENSITY_XLDPI, HapParser::GetScreenDensity(SCREEN_DENSITY_XLDPI));
ASSERT_EQ(SCREEN_DENSITY_XXLDPI, HapParser::GetScreenDensity(SCREEN_DENSITY_XXLDPI));
ASSERT_EQ(SCREEN_DENSITY_XXXLDPI, HapParser::GetScreenDensity(SCREEN_DENSITY_XXXLDPI));
ASSERT_EQ(SCREEN_DENSITY_NOT_SET, HapParser::GetScreenDensity(10000000));
}
/*
* @tc.name: HapParserFuncTest004
* @tc.desc: Test ToFolderPath
* @tc.type: FUNC
*/
HWTEST_F(HapParserTest, HapParserFuncTest004, TestSize.Level1)
{
std::vector<KeyParam *> keyParams;
auto kp = new KeyParam();
kp->type_ = LANGUAGES;
kp->value_ = 31336;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = REGION;
kp->value_ = 17230;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = SCREEN_DENSITY;
kp->value_ = SCREEN_DENSITY_SDPI;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = DEVICETYPE;
kp->value_ = DEVICE_CAR;
kp->InitStr();
keyParams.push_back(kp);
kp = new KeyParam();
kp->type_ = DIRECTION;
kp->value_ = DIRECTION_VERTICAL;
kp->InitStr();
keyParams.push_back(kp);
std::string folder = HapParser::ToFolderPath(keyParams);
ASSERT_EQ("zh_CN-vertical-car-sdpi", folder);
for (auto kp = keyParams.begin(); kp != keyParams.end(); kp++) {
delete *kp;
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_HAP_RESOURCE_TEST_H
#define RESOURCE_MANAGER_HAP_RESOURCE_TEST_H
int HapParserFuncTest001();
int HapParserFuncTest002();
int HapParserFuncTest003();
int HapParserFuncTest004();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "hap_resource_test.h"
#include <climits>
#include <gtest/gtest.h>
#include "hap_parser.h"
#include "hap_resource.h"
#include "test_common.h"
#include "utils/date_utils.h"
#include "utils/errors.h"
#include "utils/string_utils.h"
#define private public
using namespace OHOS::Global::Resource;
using namespace testing::ext;
class HapResourceTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp();
void TearDown();
};
void HapResourceTest::SetUpTestCase(void)
{
// step 1: input testsuit setup step
g_logLevel = LOG_DEBUG;
}
void HapResourceTest::TearDownTestCase(void)
{
// step 2: input testsuit teardown step
}
void HapResourceTest::SetUp()
{
// step 3: input testcase setup step
}
void HapResourceTest::TearDown()
{
// step 4: input testcase teardown step
}
/*
* this test shows how to load a hap, defaultConfig set to null
* @tc.name: HapResourceFuncTest001
* @tc.desc: Test Load & GetIdValues & GetIdValuesByName function, file case.
* @tc.type: FUNC
*/
HWTEST_F(HapResourceTest, HapResourceFuncTest001, TestSize.Level1)
{
auto start = CurrentTimeUsec();
const HapResource *pResource = HapResource::LoadFromIndex(FormatFullPath(g_resFilePath).c_str(), nullptr);
auto cost = CurrentTimeUsec() - start;
HILOG_DEBUG("load cost: %ld us.", cost);
if (pResource == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_EQ(static_cast<size_t>(80), pResource->IdSize());
int id = pResource->GetIdByName("app_name", ResType::STRING);
start = CurrentTimeUsec();
auto idValues = pResource->GetIdValues(id);
cost = CurrentTimeUsec() - start;
EXPECT_EQ(static_cast<size_t>(3), idValues->GetLimitPathsConst().size());
HILOG_DEBUG("GetIdValues by id cost: %ld us.", cost);
PrintIdValues(idValues);
{
auto limitPath = idValues->GetLimitPathsConst()[0];
EXPECT_TRUE(limitPath->GetFolder() == "en_US");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "App Name");
}
{
auto limitPath = idValues->GetLimitPathsConst()[1];
EXPECT_TRUE(limitPath->GetFolder() == "zh_CN");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "应用名称");
}
{
auto limitPath = idValues->GetLimitPathsConst()[2];
EXPECT_TRUE(limitPath->GetFolder() == "default");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "About");
}
std::string name = std::string("app_name");
start = CurrentTimeUsec();
auto idValues2 = pResource->GetIdValuesByName(name, ResType::STRING);
cost = CurrentTimeUsec() - start;
EXPECT_EQ(static_cast<size_t>(3), idValues2->GetLimitPathsConst().size());
HILOG_DEBUG("GetIdValues by name cost: %ld us.", cost);
PrintIdValues(idValues);
{
auto limitPath = idValues->GetLimitPathsConst()[0];
EXPECT_TRUE(limitPath->GetFolder() == "en_US");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "App Name");
}
{
auto limitPath = idValues->GetLimitPathsConst()[1];
EXPECT_TRUE(limitPath->GetFolder() == "zh_CN");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "应用名称");
}
{
auto limitPath = idValues->GetLimitPathsConst()[2];
EXPECT_TRUE(limitPath->GetFolder() == "default");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "About");
}
delete (pResource);
}
/*
* load a hap, set config en_US
* @tc.name: HapResourceFuncTest002
* @tc.desc: Test Load & GetIdValues & GetIdValuesByName function, file case.
* @tc.type: FUNC
*/
HWTEST_F(HapResourceTest, HapResourceFuncTest002, TestSize.Level1)
{
ResConfigImpl *rc = new ResConfigImpl;
rc->SetLocaleInfo("en", nullptr, "US");
std::string resPath = FormatFullPath(g_resFilePath);
const char *path = resPath.c_str();
auto start = CurrentTimeUsec();
const HapResource *pResource = HapResource::LoadFromIndex(path, rc);
auto cost = CurrentTimeUsec() - start;
HILOG_DEBUG("load cost: %ld us.", cost);
if (pResource == nullptr) {
delete rc;
EXPECT_TRUE(false);
return;
}
EXPECT_EQ(static_cast<size_t>(79), pResource->IdSize());
int id = pResource->GetIdByName("app_name", ResType::STRING);
start = CurrentTimeUsec();
auto idValues = pResource->GetIdValues(id);
cost = CurrentTimeUsec() - start;
EXPECT_EQ(static_cast<size_t>(2), idValues->GetLimitPathsConst().size());
HILOG_DEBUG("GetIdValues by id cost: %ld us.", cost);
PrintIdValues(idValues);
{
auto limitPath = idValues->GetLimitPathsConst()[0];
EXPECT_TRUE(limitPath->GetFolder() == "en_US");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "App Name");
}
{
auto limitPath = idValues->GetLimitPathsConst()[1];
EXPECT_TRUE(limitPath->GetFolder() == "default");
EXPECT_TRUE(limitPath->GetIdItem()->name_ == "app_name");
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "About");
}
std::string name = std::string("app_name");
start = CurrentTimeUsec();
auto idValues2 = pResource->GetIdValuesByName(name, ResType::STRING);
cost = CurrentTimeUsec() - start;
EXPECT_EQ(static_cast<size_t>(2), idValues2->GetLimitPathsConst().size());
HILOG_DEBUG("GetIdValues by name cost: %ld us.", cost);
PrintIdValues(idValues);
{
auto limitPath = idValues2->GetLimitPathsConst()[0];
EXPECT_TRUE(limitPath->GetFolder() == "en_US");
EXPECT_TRUE(limitPath->GetIdItem()->id_ == static_cast<uint32_t>(id));
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "App Name");
}
{
auto limitPath = idValues->GetLimitPathsConst()[1];
EXPECT_TRUE(limitPath->GetFolder() == "default");
EXPECT_TRUE(limitPath->GetIdItem()->id_ == static_cast<uint32_t>(id));
EXPECT_TRUE(limitPath->GetIdItem()->value_ == "About");
}
delete pResource;
delete rc;
}
/*
* load a hap, get a value which is ref
* @tc.name: HapResourceFuncTest003
* @tc.desc: Test GetIdValuesByName function, file case.
* @tc.type: FUNC
*/
HWTEST_F(HapResourceTest, HapResourceFuncTest003, TestSize.Level1)
{
auto start = CurrentTimeUsec();
const HapResource *pResource = HapResource::LoadFromIndex(FormatFullPath(g_resFilePath).c_str(), nullptr);
auto cost = CurrentTimeUsec() - start;
HILOG_DEBUG("load cost: %ld us.", cost);
if (pResource == nullptr) {
EXPECT_TRUE(false);
return;
}
auto idv = pResource->GetIdValuesByName(std::string("integer_ref"), ResType::INTEGER);
PrintIdValues(idv);
idv = pResource->GetIdValuesByName(std::string("string_ref"), ResType::STRING);
PrintIdValues(idv);
// ref propagation
idv = pResource->GetIdValuesByName(std::string("string_ref2"), ResType::STRING);
PrintIdValues(idv);
idv = pResource->GetIdValuesByName(std::string("boolean_ref"), ResType::BOOLEAN);
PrintIdValues(idv);
idv = pResource->GetIdValuesByName(std::string("color_ref"), ResType::COLOR);
PrintIdValues(idv);
idv = pResource->GetIdValuesByName(std::string("float_ref"), ResType::FLOAT);
PrintIdValues(idv);
// ref in array ,
idv = pResource->GetIdValuesByName(std::string("intarray_1"), ResType::INTARRAY);
PrintIdValues(idv);
// "parent": was ref too
idv = pResource->GetIdValuesByName(std::string("child"), ResType::PATTERN);
PrintIdValues(idv);
}
ResDesc *LoadFromHap(const char *hapPath, const ResConfigImpl *defaultConfig)
{
std::string errOut;
void *buf = nullptr;
size_t bufLen;
int32_t out = HapParser::ReadIndexFromFile(hapPath,
&buf, bufLen, errOut);
if (out != OK) {
HILOG_ERROR("ReadIndexFromFile failed! retcode:%d,err:%s", out, errOut.c_str());
return nullptr;
}
HILOG_DEBUG("extract success, bufLen:%zu", bufLen);
ResDesc *resDesc = new ResDesc();
out = HapParser::ParseResHex((char *)buf, bufLen, *resDesc, defaultConfig);
if (out != OK) {
delete (resDesc);
free(buf);
HILOG_ERROR("ParseResHex failed! retcode:%d", out);
return nullptr;
} else {
HILOG_DEBUG("ParseResHex success:\n%s", resDesc->ToString().c_str());
}
free(buf);
// construct hapresource
return resDesc;
}
/*
* @tc.name: HapResourceFuncTest004
* @tc.desc: Test HapParser::ReadIndexFromFile function, file case.
* @tc.type: FUNC
*/
HWTEST_F(HapResourceTest, HapResourceFuncTest004, TestSize.Level1)
{
// 1. normal case
ResDesc *resDesc = LoadFromHap(FormatFullPath("all.hap").c_str(), nullptr);
ASSERT_TRUE(resDesc != nullptr);
// 2. hap file exists, config.json does not exist
resDesc = LoadFromHap(FormatFullPath("err-config.json-1.hap").c_str(), nullptr);
ASSERT_TRUE(resDesc == nullptr);
// 3. hap file exists, config.json error: missing "moduleName"
resDesc = LoadFromHap(FormatFullPath("err-config.json-2.hap").c_str(), nullptr);
ASSERT_TRUE(resDesc == nullptr);
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_HAP_RESOURCE_TEST_H
#define RESOURCE_MANAGER_HAP_RESOURCE_TEST_H
int HapResourceFuncTest001();
int HapResourceFuncTest002();
int HapResourceFuncTest003();
int HapResourceFuncTest004();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "locale_info_test.h"
#include <chrono>
#include <climits>
#include <cstring>
#include <gtest/gtest.h>
#include "hilog_wrapper.h"
#include "locale_info.h"
#include "test_common.h"
using namespace OHOS::Global::Resource;
using namespace testing::ext;
class LocaleInfoTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp();
void TearDown();
};
void LocaleInfoTest::SetUpTestCase(void)
{
// step 1: input testsuit setup step
}
void LocaleInfoTest::TearDownTestCase(void)
{
// step 2: input testsuit teardown step
}
void LocaleInfoTest::SetUp()
{
}
void LocaleInfoTest::TearDown()
{
}
/*
* @tc.name: LocaleInfoFindAndSortTest001
* @tc.desc: Test FindAndSort
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoFindAndSortTest001, TestSize.Level1)
{
std::vector<std::string> request;
std::vector<std::string> outValue;
request.push_back("en");
request.push_back("en-CN");
request.push_back("en-US");
request.push_back("en-GB");
request.push_back("");
std::string current = "en-US";
FindAndSort(current, request, outValue);
EXPECT_TRUE(outValue.at(0) == "en-US");
EXPECT_TRUE(outValue.at(1) == "en");
EXPECT_TRUE(outValue.at(2) == "");
EXPECT_TRUE(outValue.at(3) == "en-CN");
EXPECT_TRUE(outValue.at(4) == "en-GB");
}
/*
* @tc.name: LocaleInfoFindAndSortTest002
* @tc.desc: Test FindAndSort
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoFindAndSortTest002, TestSize.Level1)
{
std::vector<std::string> request;
std::vector<std::string> outValue;
request.push_back("zh-CN");
request.push_back("zh-TW");
request.push_back("zh");
request.push_back("zh-HK");
request.push_back("");
std::string current = "zh-CN";
FindAndSort(current, request, outValue);
EXPECT_TRUE(outValue.at(0) == "zh-CN");
EXPECT_TRUE(outValue.at(1) == "zh");
EXPECT_TRUE(outValue.at(2) == "");
}
/*
* @tc.name: LocaleInfoFindAndSortTest003
* @tc.desc: Test FindAndSort
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoFindAndSortTest003, TestSize.Level1)
{
std::vector<std::string> request;
std::vector<std::string> outValue;
request.push_back("en");
request.push_back("en-CA");
request.push_back("en-GB");
request.push_back("");
std::string current = "en-CN";
FindAndSort(current, request, outValue);
EXPECT_TRUE(outValue.at(0) == "en");
EXPECT_TRUE(outValue.at(1) == "en-CA");
EXPECT_TRUE(outValue.at(2) == "");
EXPECT_TRUE(outValue.at(3) == "en-GB");
}
/*
* @tc.name: LocaleInfoFindAndSortTest004
* @tc.desc: Test FindAndSort
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoFindAndSortTest004, TestSize.Level1)
{
std::vector<std::string> request;
std::vector<std::string> outValue;
request.push_back("en");
request.push_back("en-CA");
request.push_back("en-GB");
request.push_back("");
std::string current = "en-Qaag";
FindAndSort(current, request, outValue);
EXPECT_TRUE(outValue.at(0) == "en");
EXPECT_TRUE(outValue.at(1) == "en-GB");
EXPECT_TRUE(outValue.at(2) == "en-CA");
EXPECT_TRUE(outValue.at(3) == "");
}
/*
* @tc.name: LocaleInfoFindAndSortTest005
* @tc.desc: Test FindAndSort
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoFindAndSortTest005, TestSize.Level1)
{
std::vector<std::string> request;
std::vector<std::string> outValue;
request.push_back("en");
request.push_back("en-001");
request.push_back("en-CA");
request.push_back("en-GB");
request.push_back("");
std::string current = "en-AI";
FindAndSort(current, request, outValue);
EXPECT_TRUE(outValue.at(0) == "en-001");
EXPECT_TRUE(outValue.at(1) == "en");
EXPECT_TRUE(outValue.at(2) == "en-GB");
EXPECT_TRUE(outValue.at(3) == "en-CA");
EXPECT_TRUE(outValue.at(4) == "");
}
/*
* @tc.name: LocaleInfoGetSysDefaultTest001
* @tc.desc: Test GetSysDefault
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoGetSysDefaultTest001, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-CN", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
UpdateSysDefault(*localeInfo, false);
const LocaleInfo* currentLocaleInfo = GetSysDefault();
if (currentLocaleInfo == nullptr) {
EXPECT_TRUE(false);
delete localeInfo;
return;
}
EXPECT_TRUE(std::strcmp("zh", currentLocaleInfo->GetLanguage()) == 0);
EXPECT_TRUE(std::strcmp("CN", currentLocaleInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoUpdateSysDefaultTest001
* @tc.desc: Test UpdateSysDefault
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoUpdateSysDefaultTest001, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-CN", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
UpdateSysDefault(*localeInfo, false);
const LocaleInfo* currentLocaleInfo = GetSysDefault();
if (currentLocaleInfo == nullptr) {
EXPECT_TRUE(false);
delete localeInfo;
return;
}
EXPECT_TRUE(std::strcmp("zh", currentLocaleInfo->GetLanguage()) == 0);
EXPECT_TRUE(std::strcmp("CN", currentLocaleInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = BuildFromString("en-US", '-', state);
UpdateSysDefault(*localeInfo, false);
currentLocaleInfo = GetSysDefault();
if (currentLocaleInfo == nullptr) {
EXPECT_TRUE(false);
delete localeInfo;
return;
}
EXPECT_TRUE(std::strcmp("en", currentLocaleInfo->GetLanguage()) == 0);
EXPECT_TRUE(std::strcmp("US", currentLocaleInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = BuildFromString("en-Qaag-US", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
UpdateSysDefault(*localeInfo, false);
currentLocaleInfo = GetSysDefault();
if (currentLocaleInfo == nullptr) {
EXPECT_TRUE(false);
delete localeInfo;
return;
}
EXPECT_TRUE(std::strcmp("en", currentLocaleInfo->GetLanguage()) == 0);
EXPECT_TRUE(std::strcmp("US", currentLocaleInfo->GetRegion()) == 0);
EXPECT_TRUE(std::strcmp("Qaag", currentLocaleInfo->GetScript()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoGetLanguageTest001
* @tc.desc: Test LocaleInfo GetLanguage
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoGetLanguageTest001, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-CN", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(std::strcmp("zh", localeInfo->GetLanguage()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoGetRegionTest001
* @tc.desc: Test LocaleInfo GetRegion
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoGetRegionTest001, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-CN", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(std::strcmp("CN", localeInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoGetScriptTest001
* @tc.desc: Test LocaleInfo GetScript
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoGetScriptTest001, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-Hant-CN", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(std::strcmp("Hant", localeInfo->GetScript()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromPartsTest001
* @tc.desc: Test BuildFromParts
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromPartsTest001, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromParts("zh", "Hant", "CN", state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(state == SUCCESS);
EXPECT_TRUE(std::strcmp("zh", localeInfo->GetLanguage()) == 0);
EXPECT_TRUE(std::strcmp("Hant", localeInfo->GetScript()) == 0);
EXPECT_TRUE(std::strcmp("CN", localeInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromPartsTest002
* @tc.desc: Test BuildFromParts
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromPartsTest002, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromParts("zh1", "Hant", "CN", state);
EXPECT_TRUE(state == INVALID_BCP47_LANGUAGE_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromPartsTest003
* @tc.desc: Test BuildFromParts
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromPartsTest003, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromParts("zh", "Hants", "CN", state);
EXPECT_TRUE(state == INVALID_BCP47_SCRIPT_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromPartsTest004
* @tc.desc: Test BuildFromParts
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromPartsTest004, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromParts("zh", "Hant", "C", state);
EXPECT_TRUE(state == INVALID_BCP47_REGION_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromPartsTest005
* @tc.desc: Test BuildFromParts
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromPartsTest005, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromParts(nullptr, "Hants", "CN", state);
EXPECT_TRUE(state == INVALID_BCP47_LANGUAGE_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromPartsTest006
* @tc.desc: Test BuildFromParts
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromPartsTest006, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromParts("zh", nullptr, nullptr, state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(state == SUCCESS);
EXPECT_TRUE(std::strcmp("zh", localeInfo->GetLanguage()) == 0);
EXPECT_TRUE(localeInfo->GetScript() == nullptr);
EXPECT_TRUE(localeInfo->GetRegion() == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest001
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest001, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-Hant-CN", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(state == SUCCESS);
EXPECT_TRUE(std::strcmp("zh", localeInfo->GetLanguage()) == 0);
EXPECT_TRUE(std::strcmp("Hant", localeInfo->GetScript()) == 0);
EXPECT_TRUE(std::strcmp("CN", localeInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest002
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest002, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh1-Hant-CN", '-', state);
EXPECT_TRUE(state == INVALID_BCP47_LANGUAGE_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest003
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest003, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("-Hant-CN", '-', state);
EXPECT_TRUE(state == INVALID_BCP47_LANGUAGE_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest004
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest004, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(state == SUCCESS);
EXPECT_TRUE(std::strcmp("zh", localeInfo->GetLanguage()) == 0);
EXPECT_TRUE(localeInfo->GetScript() == nullptr);
EXPECT_TRUE(localeInfo->GetRegion() == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest005
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest005, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("en_US", '_', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(state == SUCCESS);
EXPECT_TRUE(std::strcmp("en", localeInfo->GetLanguage()) == 0);
EXPECT_TRUE(localeInfo->GetScript() == nullptr);
EXPECT_TRUE(std::strcmp("US", localeInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest006
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest006, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("en_Latn_US", '&', state);
EXPECT_TRUE(state == NOT_SUPPORT_SEP);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest007
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest007, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("en_Latn_US", '_', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(state == SUCCESS);
EXPECT_TRUE(std::strcmp("en", localeInfo->GetLanguage()) == 0);
EXPECT_TRUE(std::strcmp("Latn", localeInfo->GetScript()) == 0);
EXPECT_TRUE(std::strcmp("US", localeInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest008
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest008, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-Hants-CN", '-', state);
EXPECT_TRUE(state == INVALID_BCP47_SCRIPT_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest009
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest009, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-Hant-C", '-', state);
EXPECT_TRUE(state == INVALID_BCP47_REGION_SUBTAG);
EXPECT_TRUE(localeInfo == nullptr);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoBuildFromStringTest0010
* @tc.desc: Test BuildFromString
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoBuildFromStringTest0010, TestSize.Level1)
{
RState state = SUCCESS;
LocaleInfo* localeInfo = BuildFromString("zh-CN-xxxx", '-', state);
if (localeInfo == nullptr) {
EXPECT_TRUE(false);
return;
}
EXPECT_TRUE(state == SUCCESS);
EXPECT_TRUE(std::strcmp("zh", localeInfo->GetLanguage()) == 0);
EXPECT_TRUE(localeInfo->GetScript() == nullptr);
EXPECT_TRUE(std::strcmp("CN", localeInfo->GetRegion()) == 0);
delete localeInfo;
localeInfo = nullptr;
}
/*
* @tc.name: LocaleInfoPerformanceFuncTest001
* @tc.desc: Test FindAndSort Performance
* @tc.type: FUNC
*/
HWTEST_F(LocaleInfoTest, LocaleInfoPerformanceFuncTest001, TestSize.Level1)
{
unsigned long long total = 0;
double average = 0;
std::vector<std::string> outValue;
for (int k = 0; k < 1000; ++k) {
auto t1 = std::chrono::high_resolution_clock::now();
std::vector<std::string> request;
std::vector<std::string> outValue;
request.push_back("en");
request.push_back("en-CN");
request.push_back("en-US");
request.push_back("en-GB");
request.push_back("");
std::string current = "en-US";
FindAndSort(current, request, outValue);
auto t2 = std::chrono::high_resolution_clock::now();
total += std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1).count();
}
average = total / 1000.0;
HILOG_DEBUG("avg cost FindAndSort: %f us", average);
EXPECT_LT(average, 500);
};
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_LOCALE_INFO_TEST_H
#define RESOURCE_MANAGER_LOCALE_INFO_TEST_H
int LocaleInfoFindAndSortTest001();
int LocaleInfoFindAndSortTest002();
int LocaleInfoFindAndSortTest003();
int LocaleInfoFindAndSortTest004();
int LocaleInfoFindAndSortTest005();
int LocaleInfoUpdateSysDefaultTest001();
int LocaleInfoGetSysDefaultTest001();
int LocaleInfoGetLanguageTest001();
int LocaleInfoGetRegionTest001();
int LocaleInfoGetScriptTest001();
int LocaleInfoBuildFromPartsTest001();
int LocaleInfoBuildFromPartsTest002();
int LocaleInfoBuildFromPartsTest003();
int LocaleInfoBuildFromPartsTest004();
int LocaleInfoBuildFromPartsTest005();
int LocaleInfoBuildFromPartsTest006();
int LocaleInfoBuildFromStringTest001();
int LocaleInfoBuildFromStringTest002();
int LocaleInfoBuildFromStringTest003();
int LocaleInfoBuildFromStringTest004();
int LocaleInfoBuildFromStringTest005();
int LocaleInfoBuildFromStringTest006();
int LocaleInfoBuildFromStringTest007();
int LocaleInfoBuildFromStringTest008();
int LocaleInfoBuildFromStringTest009();
int LocaleInfoBuildFromStringTest0010();
int LocaleInfoPerformanceFuncTest001();
#endif // RESOURCE_MANAGER_LOCALE_INFO_TEST_H
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_RES_CONFIG_IMPL_TEST_H
#define RESOURCE_MANAGER_RES_CONFIG_IMPL_TEST_H
int ResConfigImplMatchTest001();
int ResConfigImplMatchTest002();
int ResConfigImplMatchTest003();
int ResConfigImplMatchTest004();
int ResConfigImplMatchTest005();
int ResConfigImplMatchTest006();
int ResConfigImplMatchTest007();
int ResConfigImplMatchTest008();
int ResConfigImplMatchTest009();
int ResConfigImplMatchTest010();
int ResConfigImplMatchTest011();
int ResConfigImplMatchTest012();
int ResConfigImplMatchTest013();
int ResConfigImplMatchTest014();
int ResConfigImplMatchTest015();
int ResConfigImplMatchTest016();
int ResConfigImplMatchTest017();
int ResConfigImplMatchTest018();
int ResConfigImplMatchTest019();
int ResConfigImplMatchTest020();
int ResConfigImplMatchTest021();
int ResConfigImplMatchTest022();
int ResConfigImplMatchTest023();
int ResConfigImplMatchTest024();
int ResConfigImplMatchTest025();
int ResConfigImplMatchTest026();
int ResConfigImplMatchTest027();
int ResConfigImplMatchTest028();
int ResConfigImplMatchTest029();
int ResConfigImplIsMoreSuitableTest001();
int ResConfigImplIsMoreSuitableTest002();
int ResConfigImplIsMoreSuitableTest003();
int ResConfigImplIsMoreSuitableTest004();
int ResConfigImplIsMoreSuitableTest005();
int ResConfigImplIsMoreSuitableTest006();
int ResConfigImplIsMoreSuitableTest007();
int ResConfigImplIsMoreSuitableTest008();
int ResConfigImplIsMoreSuitableTest009();
int ResConfigImplIsMoreSuitableTest010();
int ResConfigImplIsMoreSuitableTest011();
int ResConfigImplIsMoreSuitableTest012();
int ResConfigImplIsMoreSuitableTest013();
int ResConfigImplIsMoreSuitableTest014();
int ResConfigImplIsMoreSuitableTest015();
int ResConfigImplIsMoreSuitableTest016();
int ResConfigImplIsMoreSuitableTest017();
int ResConfigImplIsMoreSuitableTest018();
int ResConfigImplIsMoreSuitableTest019();
int ResConfigImplIsMoreSuitableTest020();
int ResConfigImplIsMoreSuitableTest021();
int ResConfigImplIsMoreSuitableTest022();
int ResConfigImplIsMoreSuitableTest023();
int ResConfigImplIsMoreSuitableTest024();
int ResConfigImplIsMoreSuitableTest025();
int ResConfigImplIsMoreSuitableTest026();
int ResConfigImplIsMoreSuitableTest027();
int ResConfigImplIsMoreSuitableTest028();
int ResConfigImplIsMoreSuitableTest029();
int ResConfigImplIsMoreSuitableTest030();
int ResConfigImplIsMoreSuitableTest031();
int ResConfigImplIsMoreSuitableTest032();
int ResConfigImplIsMoreSuitableTest033();
int ResConfigImplIsMoreSuitableTest034();
int ResConfigImplIsMoreSuitableTest035();
int ResConfigImplIsMoreSuitableTest036();
int ResConfigImplIsMoreSuitableTest037();
int ResConfigImplIsMoreSuitableTest038();
int ResConfigImplIsMoreSuitableTest039();
int ResConfigImplIsMoreSuitableTest040();
int ResConfigImplIsMoreSuitableTest041();
int ResConfigImplIsMoreSuitableTest042();
int ResConfigImplIsMoreSuitableTest043();
int ResConfigImplIsMoreSuitableTest044();
int ResConfigImplIsMoreSuitableTest045();
int ResConfigImplIsMoreSuitableTest046();
int ResConfigImplIsMoreSuitableTest047();
int ResConfigImplIsMoreSuitableTest048();
int ResConfigImplIsMoreSuitableTest049();
int ResConfigImplIsMoreSuitableTest050();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "res_config_test.h"
#include <climits>
#include <cstring>
#include <gtest/gtest.h>
#include "hap_resource.h"
#include "res_config.h"
#include "resource_manager_impl.h"
#include "test_common.h"
using namespace OHOS::Global::Resource;
using namespace testing::ext;
class ResConfigTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp();
void TearDown();
};
void ResConfigTest::SetUpTestCase(void)
{
// step 1: input testsuit setup step
g_logLevel = LOG_DEBUG;
}
void ResConfigTest::TearDownTestCase(void)
{
// step 2: input testsuit teardown step
}
void ResConfigTest::SetUp()
{
}
void ResConfigTest::TearDown()
{
}
/*
* @tc.name: ResConfigFuncTest001
* @tc.desc: Test Config function, non file case.
* @tc.type: FUNC
*/
HWTEST_F(ResConfigTest, ResConfigFuncTest001, TestSize.Level1)
{
ResConfigImpl *rc = new ResConfigImpl;
rc->SetLocaleInfo("en", nullptr, "AU");
ResConfigImpl *current = new ResConfigImpl;
current->SetLocaleInfo("en", nullptr, "GB");
ResConfigImpl *target = new ResConfigImpl;
target->SetLocaleInfo("zh", nullptr, "CN");
EXPECT_TRUE(rc->Match(current));
EXPECT_TRUE(rc->Match(target) == false);
delete target;
delete current;
delete rc;
};
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_RES_CONFIG_TEST_H
#define RESOURCE_MANAGER_RES_CONFIG_TEST_H
int ResConfigFuncTest001();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_RES_DESC_TEST_H
#define RESOURCE_MANAGER_RES_DESC_TEST_H
int ResDescFuncTest001();
int ResDescFuncTest002();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_RESOURCE_MANANGER_PERF_TEST_H
#define RESOURCE_MANAGER_RESOURCE_MANANGER_PERF_TEST_H
int ResourceManagerPerformanceFuncTest001();
int ResourceManagerPerformanceFuncTest002();
int ResourceManagerPerformanceFuncTest003();
int ResourceManagerPerformanceFuncTest004();
int ResourceManagerPerformanceFuncTest005();
int ResourceManagerPerformanceFuncTest006();
int ResourceManagerPerformanceFuncTest007();
int ResourceManagerPerformanceFuncTest008();
int ResourceManagerPerformanceFuncTest009();
int ResourceManagerPerformanceFuncTest010();
int ResourceManagerPerformanceFuncTest011();
int ResourceManagerPerformanceFuncTest012();
int ResourceManagerPerformanceFuncTest013();
int ResourceManagerPerformanceFuncTest014();
int ResourceManagerPerformanceFuncTest015();
int ResourceManagerPerformanceFuncTest016();
int ResourceManagerPerformanceFuncTest017();
int ResourceManagerPerformanceFuncTest018();
int ResourceManagerPerformanceFuncTest019();
int ResourceManagerPerformanceFuncTest020();
int ResourceManagerPerformanceFuncTest021();
int ResourceManagerPerformanceFuncTest022();
int ResourceManagerPerformanceFuncTest023();
int ResourceManagerPerformanceFuncTest024();
int ResourceManagerPerformanceFuncTest025();
int ResourceManagerPerformanceFuncTest026();
int ResourceManagerPerformanceFuncTest027();
int ResourceManagerPerformanceFuncTest028();
int ResourceManagerPerformanceFuncTest029();
int ResourceManagerPerformanceFuncTest030();
int ResourceManagerPerformanceFuncTest031();
int ResourceManagerPerformanceFuncTest032();
#endif
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef RESOURCE_MANAGER_STRING_UTILS_TEST_H
#define RESOURCE_MANAGER_STRING_UTILS_TEST_H
int StringUtilsFuncTest001();
#endif
此差异已折叠。
{
"kits": [
{
"push": [
"WeekPluralNumbertest->/data/local/tmp/WeekPluralNumbertest"
],
"type": "PushKit",
"post-push": [
"chmod -R 777 /data/local/tmp/*"
]
}
],
"driver": {
"native-test-timeout": "120000",
"type": "CppTest",
"module-name": "WeekPluralNumbertest",
"runtime-hint": "1s",
"native-test-device-path": "/data/local/tmp"
},
"description": "WeekPluralNumbertest Tests"
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册