HilogJsTest.js 22.7 KB
Newer Older
C
chenxuihui 已提交
1
/*
1
15929983503 已提交
2
 * Copyright (C) 2023 Huawei Device Co., Ltd.
C
chenxuihui 已提交
3 4 5 6 7 8 9 10 11 12 13 14
 * 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.
 */
J
jiyong_sd 已提交
15
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
C
chenxuihui 已提交
16
import hilog from '@ohos.hilog'
Z
zhuoli 已提交
17
// @ts-ignore
1
15929983503 已提交
18
import hilogndk from "libhilogndk.so"
C
chenxuihui 已提交
19

J
jiyong_sd 已提交
20
export default function HilogJsTest() {
C
chenxuihui 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
describe('HilogJsTest', function () {

    /**
    * run before testClass
    */
    beforeAll(function () {
        console.info('beforeAll called');
    })

    /**
    * run after testClass
    */
    afterAll(function () {
        console.info('afterAll called');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0100
1
15929983503 已提交
39 40
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
41 42 43 44
     */
    it('testHilogJsApi01', 2, function () {
        console.info('testHilogJsApi01 start');
        try{
1
15929983503 已提交
45
            hilog.debug(0x3200, "HILOGTEST", "%{public}s", 'hilogJs0100')
C
chenxuihui 已提交
46 47 48 49 50 51 52 53 54
        } catch (error){
            console.log(`testHilogJsApi01 got an error: ${JSON.stringify(error)}`)
            expect().assertFail()
        }
        console.info('testHilogJsApi01 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0200
1
15929983503 已提交
55 56
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
57 58
     */
    it('testHilogJsApi02', 2, function () {
1
15929983503 已提交
59 60 61 62 63 64 65 66
      console.info('testHilogJsApi02 start');
      try{
        hilog.error(0x3200, "HILOGTEST", "%{public}s", 'hilogJs0200')
      } catch (error){
        console.log(`testHilogJsApi02 got an error: ${JSON.stringify(error)}`)
        expect().assertFail()
      }
      console.info('testHilogJsApi02 end');
C
chenxuihui 已提交
67 68 69 70
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0300
1
15929983503 已提交
71 72
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
73 74
     */
    it('testHilogJsApi03', 2, function () {
1
15929983503 已提交
75 76 77 78 79 80 81 82
      console.info('testHilogJsApi03 start');
      try{
        hilog.fatal(0x3200, "HILOGTEST", "%{public}s", 'hilogJs0300')
      } catch (error){
        console.log(`testHilogJsApi03 got an error: ${JSON.stringify(error)}`)
        expect().assertFail()
      }
      console.info('testHilogJsApi03 end');
C
chenxuihui 已提交
83 84 85 86
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0400
1
15929983503 已提交
87 88
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
89 90
     */
    it('testHilogJsApi04', 2, function () {
1
15929983503 已提交
91 92 93 94 95 96 97 98
      console.info('testHilogJsApi04 start');
      try{
        hilog.info(0x3200, "HILOGTEST", "%{public}s", 'hilogJs0400')
      } catch (error){
        console.log(`testHilogJsApi04 got an error: ${JSON.stringify(error)}`)
        expect().assertFail()
      }
      console.info('testHilogJsApi04 end');
C
chenxuihui 已提交
99 100 101 102
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0500
1
15929983503 已提交
103 104
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
105 106
     */
    it('testHilogJsApi05', 2, function () {
1
15929983503 已提交
107 108 109 110 111 112 113 114
      console.info('testHilogJsApi04 start');
      try{
        hilog.warn(0x3200, "HILOGTEST", "%{public}s", 'hilogJs0500')
      } catch (error){
        console.log(`testHilogJsApi05 got an error: ${JSON.stringify(error)}`)
        expect().assertFail()
      }
      console.info('testHilogJsApi05 end');
C
chenxuihui 已提交
115 116 117 118 119 120 121 122 123
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0600
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi06', 2, function () {
        console.info('testHilogJsApi06 start');
C
chenxuihui 已提交
124
        const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.DEBUG);
1
15929983503 已提交
125
        expect(res).assertEqual(true);
C
chenxuihui 已提交
126 127 128 129 130 131 132 133 134 135
        console.info('testHilogJsApi06 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0700
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi07', 2, function () {
        console.info('testHilogJsApi07 start');
C
chenxuihui 已提交
136
        const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.DEBUG);
C
chenxuihui 已提交
137 138 139 140
        var tag = "";
        for (var i = 0; i < 1000; i++){
            tag += "HILOGTEST"
        }
1
15929983503 已提交
141
        expect(res).assertEqual(true);
C
chenxuihui 已提交
142 143 144 145 146 147 148 149 150 151
        console.info('testHilogJsApi07 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_0800
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi08', 2, function () {
        console.info('testHilogJsApi08 start');
C
chenxuihui 已提交
152
        const res = hilog.isLoggable(0x3200, "", hilog.LogLevel.DEBUG);
1
15929983503 已提交
153
        expect(res).assertEqual(true);
C
chenxuihui 已提交
154 155 156 157 158 159 160 161 162 163
        console.info('testHilogJsApi08 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_1100
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi09', 2, function () {
        console.info('testHilogJsApi09 start');
C
chenxuihui 已提交
164
        const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.ERROR);
C
chenxuihui 已提交
165 166 167 168 169 170 171 172 173 174 175
        expect(res).assertEqual(true);
        console.info('testHilogJsApi09 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_1200
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi10', 2, function () {
        console.info('testHilogJsApi10 start');
C
chenxuihui 已提交
176
        const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.FATAL);
C
chenxuihui 已提交
177 178 179 180 181 182 183 184 185 186 187
        expect(res).assertEqual(true);
        console.info('testHilogJsApi10 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_1300
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi11', 2, function () {
        console.info('testHilogJsApi11 start');
C
chenxuihui 已提交
188
        const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.INFO);
C
chenxuihui 已提交
189 190 191 192 193 194 195 196 197 198 199
        expect(res).assertEqual(true);
        console.info('testHilogJsApi11 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_1400
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi12', 2, function () {
        console.info('testHilogJsApi12 start');
C
chenxuihui 已提交
200
        const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.WARN);
C
chenxuihui 已提交
201 202 203 204 205 206 207 208 209 210 211
        expect(res).assertEqual(true);
        console.info('testHilogJsApi12 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_1500
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi13', 2, function () {
        console.info('testHilogJsApi13 start');
C
chenxuihui 已提交
212
        const res = hilog.isLoggable(0x3200, "HILOGTEST", 100);
C
chenxuihui 已提交
213
        expect(res).assertEqual(false);
C
chenxuihui 已提交
214 215 216 217 218 219 220 221 222 223
        console.info('testHilogJsApi13 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_1600
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi14', 2, function () {
        console.info('testHilogJsApi14 start');
C
chenxuihui 已提交
224
        const res = hilog.isLoggable(0, "HILOGTEST", hilog.LogLevel.WARN);
C
chenxuihui 已提交
225 226 227 228 229 230 231 232 233 234 235
        expect(res).assertEqual(true);
        console.info('testHilogJsApi14 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_01700
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi15', 2, function () {
        console.info('testHilogJsApi15 start');
C
chenxuihui 已提交
236
        const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.WARN);
C
chenxuihui 已提交
237 238 239 240 241 242 243 244 245 246
        expect(res).assertEqual(true);
        console.info('testHilogJsApi15 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_1800
     * @tc.name hitrace interface test
     * @tc.desc hitrace begin interface test.
     */
    it('testHilogJsApi16', 2, function () {
1
15929983503 已提交
247 248 249 250 251 252 253 254
      console.info('testHilogJsApi16 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}s", 'hilogJs1800')
      }catch(error){
        console.log(`testHilogJsApi16 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi16 end');
C
chenxuihui 已提交
255 256 257 258
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_2100
1
15929983503 已提交
259 260
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
261 262
     */
    it('testHilogJsApi17', 2, function () {
1
15929983503 已提交
263 264 265 266 267 268 269 270
      console.info('testHilogJsApi17 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}d", 2.1)
      }catch(error){
        console.log(`testHilogJsApi17 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi17 end');
C
chenxuihui 已提交
271 272 273 274
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_2500
1
15929983503 已提交
275 276
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
277 278
     */
    it('testHilogJsApi18', 2, function () {
1
15929983503 已提交
279 280 281 282 283 284 285 286
      console.info('testHilogJsApi18 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}d", 65535)
      }catch(error){
        console.log(`testHilogJsApi18 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi18 end');
C
chenxuihui 已提交
287 288 289 290
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_2600
1
15929983503 已提交
291 292
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
293 294
     */
    it('testHilogJsApi19', 2, function () {
1
15929983503 已提交
295 296 297 298 299 300 301 302
      console.info('testHilogJsApi19 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}s", "hilog info")
      }catch(error){
        console.log(`testHilogJsApi19 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi19 end');
C
chenxuihui 已提交
303 304 305 306
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_2900
1
15929983503 已提交
307 308
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
309 310
     */
    it('testHilogJsApi20', 2, function () {
1
15929983503 已提交
311 312 313 314 315 316 317 318
      console.info('testHilogJsApi20 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}d", 2147483647)
      }catch(error){
        console.log(`testHilogJsApi20 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi20 end');
C
chenxuihui 已提交
319 320 321 322
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3000
1
15929983503 已提交
323 324
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
325 326
     */
    it('testHilogJsApi21', 2, function () {
1
15929983503 已提交
327 328 329 330 331 332 333 334
      console.info('testHilogJsApi21 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}s", "100%s%d%x%f")
      }catch(error){
        console.log(`testHilogJsApi21 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi21 end');
C
chenxuihui 已提交
335 336 337 338
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3200
1
15929983503 已提交
339 340
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
341 342
     */
    it('testHilogJsApi22', 2, function () {
1
15929983503 已提交
343 344 345 346 347 348 349 350
      console.info('testHilogJsApi22 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}s", "65536")
      }catch(error){
        console.log(`testHilogJsApi22 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi22 end');
C
chenxuihui 已提交
351 352 353 354
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3300
1
15929983503 已提交
355 356
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
357 358
     */
    it('testHilogJsApi23', 2, function () {
1
15929983503 已提交
359 360 361 362 363 364 365 366 367
      console.info('testHilogJsApi23 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "username:%{public}s, password:%{private}s.", "username", "password")
        hilog.debug(0x3200, "HILOGTEST", "username:%{public}s, password:%s.", "username123", "password")
      }catch(error){
        console.log(`testHilogJsApi23 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi23 end');
C
chenxuihui 已提交
368 369 370 371
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3400
1
15929983503 已提交
372 373
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
374 375
     */
    it('testHilogJsApi24', 2, function () {
1
15929983503 已提交
376 377 378 379 380 381 382 383
      console.info('testHilogJsApi24 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{public}s", "hilog public")
      }catch(error){
        console.log(`testHilogJsApi24 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi24 end');
C
chenxuihui 已提交
384 385 386 387
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3500
1
15929983503 已提交
388 389
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
390 391
     */
    it('testHilogJsApi25', 2, function () {
1
15929983503 已提交
392 393 394 395 396 397 398 399
      console.info('testHilogJsApi25 start');
      try{
        hilog.debug(0x3200, "HILOGTEST", "%{nopublic}s", "Hilogtest")
      }catch(error){
        console.log(`testHilogJsApi25 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi25 end');
C
chenxuihui 已提交
400 401 402 403
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3800
1
15929983503 已提交
404 405
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
C
chenxuihui 已提交
406 407
     */
    it('testHilogJsApi26', 2, function () {
1
15929983503 已提交
408 409 410 411 412 413 414 415 416
      console.info('testHilogJsApi26 start');
      try{
        hilog.info(0x3200, "HILOGTEST", "username:%{public}s, password:%{private}s.", "username", "password")
        hilog.info(0x3200, "HILOGTEST", "username:%{public}s, password:%s.", "username123", "password")
      }catch(error){
        console.log(`testHilogJsApi26 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi26 end');
C
chenxuihui 已提交
417 418
    })

1
15929983503 已提交
419
    /**
1
15929983503 已提交
420
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3900
1
15929983503 已提交
421 422
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
1
15929983503 已提交
423 424
     */
    it('testHilogJsApi27', 2, function () {
1
15929983503 已提交
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
      console.info('testHilogJsApi27 start');
      try{
        hilog.info(0xffff, "HILOGTEST", "username:%{public}s, password:%{public}s.", "username", "password")
      }catch(error){
        console.log(`testHilogJsApi27 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi27 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4000
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi28', 2, function () {
      console.info('testHilogJsApi28 start');
      try{
        hilog.info(0xfffe, "HILOGTEST", "username:%{public}s, password:%{public}s.", "username", "password")
      }catch(error){
        console.log(`testHilogJsApi28 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi28 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4100
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi29', 2, function () {
      console.info('testHilogJsApi29 start');
      try{
        hilog.info(0xfffff, "HILOGTEST", "username:%{public}s, password:%{public}s.", "username", "password")
      }catch(error){
        console.log(`testHilogJsApi29 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi29 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4200
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi30', 2, function () {
      console.info('testHilogJsApi30 start');
      try{
        hilog.info(0xffffe, "HILOGTEST", "username:%{public}s, password:%{public}s.", "username", "password")
      }catch(error){
        console.log(`testHilogJsApi30 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi30 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4300
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi31', 2, function () {
      console.info('testHilogJsApi31 start');
      try{
        // @ts-ignore
        hilog.info("中文domainId", "HILOGTEST", "username:%{public}s, password:%{public}s.", "username", "password")
      }catch(error){
        console.log(`testHilogJsApi31 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi31 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4400
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi32', 2, function () {
      console.info('testHilogJsApi32 start');
      try{
        hilog.info(100, "HILOGTEST", "username:%{public}s, password:%{public}s.", "username", "password")
      }catch(error){
        console.log(`testHilogJsApi32 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi32 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4500
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi33', 2, function () {
      console.info('testHilogJsApi33 start');
      try{
        hilog.info(0x3200, "HILOGTEST", "username:%{public}s.", null)
      }catch(error){
        console.log(`testHilogJsApi33 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi33 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4600
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi34', 2, function () {
      console.info('testHilogJsApi34 start');
      try{
        hilog.info(0x3200, "HILOGTEST", "username:%{public}s.", undefined)
      }catch(error){
        console.log(`testHilogJsApi34 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi34 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4700
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi35', 2, function () {
      console.info('testHilogJsApi35 start');
      try{
        hilog.info(0x3200, "HILOGTEST", "MAX Number:%{public}d, MIN Number:%{public}d", Number.MAX_VALUE, Number.MIN_VALUE)
      }catch(error){
        console.log(`testHilogJsApi35 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi35 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4800
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi36', 2, function () {
      console.info('testHilogJsApi36 start');
      try{
        hilog.info(0x3200, "HILOGTEST", "中文测试:%{public}s, 混合打印:%{public}s", "中文打印测试", "for中文test,.;:*_-=^(%)?#$/|\\")
      }catch(error){
        console.log(`testHilogJsApi36 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi36 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_4900
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi37', 2, function () {
      console.info('testHilogJsApi37 start');
      try{
        hilog.info(0x3200, "HILOGTEST", "boolean1:%{public}s, boolean2:%{public}s", true, false)
      }catch(error){
        console.log(`testHilogJsApi37 got an error: ${JSON.stringify(error)}`)
        expect().assertFail();
      }
      console.info('testHilogJsApi37 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5100
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi38', 2, function () {
      console.info('testHilogJsApi38 start');
      const res = hilog.isLoggable(100, "HILOGTEST", hilog.LogLevel.INFO);
      expect(res).assertEqual(true);
      console.info('testHilogJsApi38 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5200
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi39', 2, function () {
      console.info('testHilogJsApi39 start');
      const res = hilog.isLoggable(0xfffff, "HILOGTEST", hilog.LogLevel.INFO);
      expect(res).assertEqual(false);
      console.info('testHilogJsApi39 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5400
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi40', 2, function () {
      console.info('testHilogJsApi40 start');
      const res = hilog.isLoggable(0xffff, "HILOGTEST", hilog.LogLevel.INFO);
      expect(res).assertEqual(true);
      console.info('testHilogJsApi40 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5500
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi41', 2, function () {
      console.info('testHilogJsApi41 start');
      const res = hilog.isLoggable(0xfffe, "HILOGTEST", hilog.LogLevel.INFO);
      expect(res).assertEqual(true);
      console.info('testHilogJsApi41 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5600
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi42', 2, function () {
      console.info('testHilogJsApi42 start');
      const res = hilog.isLoggable(0x123456789, "HILOGTEST", hilog.LogLevel.INFO);
      expect(res).assertEqual(false);
      console.info('testHilogJsApi42 end');
    })

    /**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5700
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi43', 2, function () {
      console.info('testHilogJsApi43 start');
      // @ts-ignore
      const res = hilog.isLoggable("中文测试", "HILOGTEST", hilog.LogLevel.INFO);
      expect(res).assertEqual(undefined);
      console.info('testHilogJsApi43 end');
    })
	
	/**
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5800
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
     */
    it('testHilogJsApi44', 2, function () {
        console.info('testHilogJsApi44 start');
1
15929983503 已提交
676 677
        const res = hilogndk.ohIsLoggableTest();
        expect(res).assertEqual(true);
1
15929983503 已提交
678
        console.info('testHilogJsApi44 end');
1
15929983503 已提交
679 680 681
    })

    /**
1
15929983503 已提交
682 683 684
     * @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_5900
     * @tc.name hilog interface test
     * @tc.desc hilog begin interface test.
1
15929983503 已提交
685
     */
1
15929983503 已提交
686 687
     it('testHilogJsApi45', 2, function () {
        console.info('testHilogJsApi45 start');
1
15929983503 已提交
688 689
        const res = hilogndk.ohPrintTest();
        expect(res).assertEqual(true);
1
15929983503 已提交
690
        console.info('testHilogJsApi45 end');
1
15929983503 已提交
691
    })
1
15929983503 已提交
692
  })
J
jiyong_sd 已提交
693
}