1/* 2 * Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import { describe, it, expect } from '@ohos/hypium'; 16 17export default function ArrayTest() { 18 describe('ArrayTest', () => { 19 /** 20 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0100 21 * @tc.name : testConstructor0001 22 * @tc.desc : Test the function of the interface Constructor 23 * @tc.size : MediumTest 24 * @tc.type : Function 25 * @tc.level : Level 1 26 */ 27 it('testConstructor0001', 0, () => { 28 const TAG = "testConstructor0001"; 29 try { 30 let element0 = 'app'; 31 let obj = new Array(element0); 32 console.log(`${TAG} result:` + JSON.stringify(obj)); 33 expect(JSON.stringify(obj)).assertEqual(`["app"]`); 34 } catch (err) { 35 console.error(`${TAG} failed, error: ${err.message}`); 36 expect().assertFail(); 37 } 38 }) 39 /** 40 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0200 41 * @tc.name : testConstructor0002 42 * @tc.desc : Test the function of the interface Constructor 43 * @tc.size : MediumTest 44 * @tc.type : Function 45 * @tc.level : Level 1 46 */ 47 it('testConstructor0002', 0, () => { 48 const TAG = "testConstructor0002"; 49 try { 50 let element0 = 'app'; 51 let obj = Array(element0); 52 console.log(`${TAG} result:` + JSON.stringify(obj)); 53 expect(JSON.stringify(obj)).assertEqual(`["app"]`); 54 } catch (err) { 55 console.error(`${TAG} failed, error: ${err.message}`); 56 expect().assertFail(); 57 } 58 }) 59 /** 60 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0300 61 * @tc.name : testConstructor0003 62 * @tc.desc : Test the function of the interface Constructor 63 * @tc.size : MediumTest 64 * @tc.type : Function 65 * @tc.level : Level 1 66 */ 67 it('testConstructor0003', 0, () => { 68 const TAG = "testConstructor0003"; 69 try { 70 let element0 = 'app0'; 71 let element1 = 'app1'; 72 let obj = Array(element0, element1); 73 console.log(`${TAG} result:` + JSON.stringify(obj)); 74 expect(JSON.stringify(obj)).assertEqual(`["app0","app1"]`); 75 } catch (err) { 76 console.error(`${TAG} failed, error: ${err.message}`); 77 expect().assertFail(); 78 } 79 }) 80 /** 81 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0400 82 * @tc.name : testConstructor0004 83 * @tc.desc : Test the function of the interface Constructor 84 * @tc.size : MediumTest 85 * @tc.type : Function 86 * @tc.level : Level 1 87 */ 88 it('testConstructor0004', 0, () => { 89 const TAG = "testConstructor0004"; 90 try { 91 let element0 = 'app0'; 92 let element1 = 'app1'; 93 let obj = new Array(element0, element1); 94 console.log(`${TAG} result:` + JSON.stringify(obj)); 95 expect(JSON.stringify(obj)).assertEqual(`["app0","app1"]`); 96 } catch (err) { 97 console.error(`${TAG} failed, error: ${err.message}`); 98 expect().assertFail(); 99 } 100 }) 101 /** 102 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0500 103 * @tc.name : testFrom0001 104 * @tc.desc : Test the function of the interface From 105 * @tc.size : MediumTest 106 * @tc.type : Function 107 * @tc.level : Level 1 108 */ 109 it('testFrom0001', 0, () => { 110 const TAG = "testFrom0001"; 111 try { 112 const set = new Set(["foo", "bar", "baz", "foo"]); 113 let obj = Array.from(set); 114 console.log(`${TAG} result:` + JSON.stringify(obj)); 115 expect(JSON.stringify(obj)).assertEqual("[\"foo\",\"bar\",\"baz\"]"); 116 } catch (err) { 117 console.error(`${TAG} failed, error: ${err.message}`); 118 expect().assertFail(); 119 } 120 }) 121 /** 122 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0600 123 * @tc.name : testFrom0002 124 * @tc.desc : Test the function of the interface From 125 * @tc.size : MediumTest 126 * @tc.type : Function 127 * @tc.level : Level 1 128 */ 129 it('testFrom0002', 0, () => { 130 const TAG = "testFrom0002"; 131 try { 132 let obj = Array.from('ABC'); 133 console.log(`${TAG} result:` + JSON.stringify(obj)); 134 expect(JSON.stringify(obj)).assertEqual("[\"A\",\"B\",\"C\"]"); 135 } catch (err) { 136 console.error(`${TAG} failed, error: ${err.message}`); 137 expect().assertFail(); 138 } 139 }) 140 /** 141 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0700 142 * @tc.name : testFrom0003 143 * @tc.desc : Test the function of the interface From 144 * @tc.size : MediumTest 145 * @tc.type : Function 146 * @tc.level : Level 1 147 */ 148 it('testFrom0003', 0, () => { 149 const TAG = "testFrom0003"; 150 try { 151 const map = new Map([ 152 [1, 2], 153 [2, 4], 154 [4, 8], 155 ]); 156 let obj = Array.from(map); 157 console.log(`${TAG} result:` + JSON.stringify(obj)); 158 expect(JSON.stringify(obj)).assertEqual("[[1,2],[2,4],[4,8]]"); 159 } catch (err) { 160 console.error(`${TAG} failed, error: ${err.message}`); 161 expect().assertFail(); 162 } 163 }) 164 /** 165 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0800 166 * @tc.name : testIsArray0001 167 * @tc.desc : Test the function of the interface IsArray 168 * @tc.size : MediumTest 169 * @tc.type : Function 170 * @tc.level : Level 1 171 */ 172 it('testIsArray0001', 0, () => { 173 const TAG = "testIsArray0001"; 174 try { 175 let result = Array.isArray([]); 176 console.log(`${TAG} result:` + result); 177 expect(result).assertEqual(true); 178 } catch (err) { 179 console.error(`${TAG} failed, error: ${err.message}`); 180 expect().assertFail(); 181 } 182 }) 183 /** 184 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_0900 185 * @tc.name : testIsArray0002 186 * @tc.desc : Test the function of the interface IsArray 187 * @tc.size : MediumTest 188 * @tc.type : Function 189 * @tc.level : Level 1 190 */ 191 it('testIsArray0002', 0, () => { 192 const TAG = "testIsArray0002"; 193 try { 194 let result = Array.isArray([1]); 195 console.log(`${TAG} result:` + result); 196 expect(result).assertEqual(true); 197 } catch (err) { 198 console.error(`${TAG} failed, error: ${err.message}`); 199 expect().assertFail(); 200 } 201 }) 202 /** 203 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1000 204 * @tc.name : testIsArray0003 205 * @tc.desc : Test the function of the interface IsArray 206 * @tc.size : MediumTest 207 * @tc.type : Function 208 * @tc.level : Level 1 209 */ 210 it('testIsArray0003', 0, () => { 211 const TAG = "testIsArray0003"; 212 try { 213 let result = Array.isArray(new Array()); 214 console.log(`${TAG} result:` + result); 215 expect(result).assertEqual(true); 216 } catch (err) { 217 console.error(`${TAG} failed, error: ${err.message}`); 218 expect().assertFail(); 219 } 220 }) 221 /** 222 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1100 223 * @tc.name : testIsArray0004 224 * @tc.desc : Test the function of the interface IsArray 225 * @tc.size : MediumTest 226 * @tc.type : Function 227 * @tc.level : Level 1 228 */ 229 it('testIsArray0004', 0, () => { 230 const TAG = "testIsArray0004"; 231 try { 232 let result = Array.isArray(new Array("a", "b", "c", "d")); 233 console.log(`${TAG} result:` + result); 234 expect(result).assertEqual(true); 235 } catch (err) { 236 console.error(`${TAG} failed, error: ${err.message}`); 237 expect().assertFail(); 238 } 239 }) 240 /** 241 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1200 242 * @tc.name : testIsArray0005 243 * @tc.desc : Test the function of the interface IsArray 244 * @tc.size : MediumTest 245 * @tc.type : Function 246 * @tc.level : Level 1 247 */ 248 it('testIsArray0005', 0, () => { 249 const TAG = "testIsArray0005"; 250 try { 251 let result = Array.isArray(new Array(3)); 252 console.log(`${TAG} result:` + result); 253 expect(result).assertEqual(true); 254 } catch (err) { 255 console.error(`${TAG} failed, error: ${err.message}`); 256 expect().assertFail(); 257 } 258 }) 259 /** 260 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1300 261 * @tc.name : testIsArray0006 262 * @tc.desc : Test the function of the interface IsArray 263 * @tc.size : MediumTest 264 * @tc.type : Function 265 * @tc.level : Level 1 266 */ 267 it('testIsArray0006', 0, () => { 268 const TAG = "testIsArray0006"; 269 try { 270 let result = Array.isArray(Array); 271 console.log(`${TAG} result:` + result); 272 expect(result).assertEqual(false); 273 } catch (err) { 274 console.error(`${TAG} failed, error: ${err.message}`); 275 expect().assertFail(); 276 } 277 }) 278 /** 279 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1400 280 * @tc.name : testIsArray0008 281 * @tc.desc : Test the function of the interface IsArray 282 * @tc.size : MediumTest 283 * @tc.type : Function 284 * @tc.level : Level 1 285 */ 286 it('testIsArray0008', 0, () => { 287 const TAG = "testIsArray0008"; 288 try { 289 let result = Array.isArray({}); 290 console.log(`${TAG} result:` + result); 291 expect(result).assertEqual(false); 292 } catch (err) { 293 console.error(`${TAG} failed, error: ${err.message}`); 294 expect().assertFail(); 295 } 296 }) 297 /** 298 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1500 299 * @tc.name : testIsArray0009 300 * @tc.desc : Test the function of the interface IsArray 301 * @tc.size : MediumTest 302 * @tc.type : Function 303 * @tc.level : Level 1 304 */ 305 it('testIsArray0009', 0, () => { 306 const TAG = "testIsArray0009"; 307 try { 308 let result = Array.isArray(null); 309 console.log(`${TAG} result:` + result); 310 expect(result).assertEqual(false); 311 } catch (err) { 312 console.error(`${TAG} failed, error: ${err.message}`); 313 expect().assertFail(); 314 } 315 }) 316 /** 317 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1600 318 * @tc.name : testIsArray0010 319 * @tc.desc : Test the function of the interface IsArray 320 * @tc.size : MediumTest 321 * @tc.type : Function 322 * @tc.level : Level 1 323 */ 324 it('testIsArray0010', 0, () => { 325 const TAG = "testIsArray0010"; 326 try { 327 let result = Array.isArray(undefined); 328 console.log(`${TAG} result:` + result); 329 expect(result).assertEqual(false); 330 } catch (err) { 331 console.error(`${TAG} failed, error: ${err.message}`); 332 expect().assertFail(); 333 } 334 }) 335 /** 336 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1700 337 * @tc.name : testIsArray0011 338 * @tc.desc : Test the function of the interface IsArray 339 * @tc.size : MediumTest 340 * @tc.type : Function 341 * @tc.level : Level 1 342 */ 343 it('testIsArray0011', 0, () => { 344 const TAG = "testIsArray0011"; 345 try { 346 let result = Array.isArray(17); 347 console.log(`${TAG} result:` + result); 348 expect(result).assertEqual(false); 349 } catch (err) { 350 console.error(`${TAG} failed, error: ${err.message}`); 351 expect().assertFail(); 352 } 353 }) 354 /** 355 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1800 356 * @tc.name : testIsArray0012 357 * @tc.desc : Test the function of the interface IsArray 358 * @tc.size : MediumTest 359 * @tc.type : Function 360 * @tc.level : Level 1 361 */ 362 it('testIsArray0012', 0, () => { 363 const TAG = "testIsArray0012"; 364 try { 365 let result = Array.isArray("Array"); 366 console.log(`${TAG} result:` + result); 367 expect(result).assertEqual(false); 368 } catch (err) { 369 console.error(`${TAG} failed, error: ${err.message}`); 370 expect().assertFail(); 371 } 372 }) 373 /** 374 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_1900 375 * @tc.name : testIsArray0013 376 * @tc.desc : Test the function of the interface IsArray 377 * @tc.size : MediumTest 378 * @tc.type : Function 379 * @tc.level : Level 1 380 */ 381 it('testIsArray0013', 0, () => { 382 const TAG = "testIsArray0013"; 383 try { 384 let result = Array.isArray(true); 385 console.log(`${TAG} result:` + result); 386 expect(result).assertEqual(false); 387 } catch (err) { 388 console.error(`${TAG} failed, error: ${err.message}`); 389 expect().assertFail(); 390 } 391 }) 392 /** 393 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2000 394 * @tc.name : testIsArray0014 395 * @tc.desc : Test the function of the interface IsArray 396 * @tc.size : MediumTest 397 * @tc.type : Function 398 * @tc.level : Level 1 399 */ 400 it('testIsArray0014', 0, () => { 401 const TAG = "testIsArray0014"; 402 try { 403 let result = Array.isArray(false); 404 console.log(`${TAG} result:` + result); 405 expect(result).assertEqual(false); 406 } catch (err) { 407 console.error(`${TAG} failed, error: ${err.message}`); 408 expect().assertFail(); 409 } 410 }) 411 /** 412 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2100 413 * @tc.name : testIsArray0015 414 * @tc.desc : Test the function of the interface IsArray 415 * @tc.size : MediumTest 416 * @tc.type : Function 417 * @tc.level : Level 1 418 */ 419 it('testIsArray0015', 0, () => { 420 const TAG = "testIsArray0015"; 421 try { 422 let result = Array.isArray(new Uint8Array(32)); 423 console.log(`${TAG} result:` + result); 424 expect(result).assertEqual(false); 425 } catch (err) { 426 console.error(`${TAG} failed, error: ${err.message}`); 427 expect().assertFail(); 428 } 429 }) 430 /** 431 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2200 432 * @tc.name : testIsArray0016 433 * @tc.desc : Test the function of the interface IsArray 434 * @tc.size : MediumTest 435 * @tc.type : Function 436 * @tc.level : Level 1 437 */ 438 it('testIsArray0016', 0, () => { 439 const TAG = "testIsArray0016"; 440 try { 441 let result = Array.isArray({ 442 __proto__: Array 443 }); 444 console.log(`${TAG} result:` + result) 445 446 expect(result).assertEqual(false); 447 } catch (err) { 448 console.error(`${TAG} failed, error: ${err.message}`); 449 expect().assertFail(); 450 } 451 }) 452 /** 453 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2300 454 * @tc.name : testOf0001 455 * @tc.desc : Test the function of the interface Of 456 * @tc.size : MediumTest 457 * @tc.type : Function 458 * @tc.level : Level 1 459 */ 460 it('testOf0001', 0, () => { 461 const TAG = "testOf0001"; 462 try { 463 let result = Array.of(1); 464 expect(JSON.stringify(result)).assertEqual('[1]'); 465 } catch (err) { 466 console.error(`${TAG} failed, error: ${err.message}`); 467 expect().assertFail(); 468 } 469 }) 470 /** 471 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2400 472 * @tc.name : testOf0002 473 * @tc.desc : Test the function of the interface Of 474 * @tc.size : MediumTest 475 * @tc.type : Function 476 * @tc.level : Level 1 477 */ 478 it('testOf0002', 0, () => { 479 const TAG = "testOf0002"; 480 try { 481 let result = Array.of(1, 2, 3); 482 expect(JSON.stringify(result)).assertEqual('[1,2,3]'); 483 } catch (err) { 484 console.error(`${TAG} failed, error: ${err.message}`); 485 expect().assertFail(); 486 } 487 }) 488 /** 489 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2500 490 * @tc.name : testOf0003 491 * @tc.desc : Test the function of the interface Of 492 * @tc.size : MediumTest 493 * @tc.type : Function 494 * @tc.level : Level 1 495 */ 496 it('testOf0003', 0, () => { 497 const TAG = "testOf0003"; 498 try { 499 let result = Array.of(undefined); 500 expect(JSON.stringify(result)).assertEqual('[null]'); 501 } catch (err) { 502 console.error(`${TAG} failed, error: ${err.message}`); 503 expect().assertFail(); 504 } 505 }) 506 /** 507 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2600 508 * @tc.name : testOf0004 509 * @tc.desc : Test the function of the interface Of 510 * @tc.size : MediumTest 511 * @tc.type : Function 512 * @tc.level : Level 1 513 */ 514 it('testOf0004', 0, () => { 515 const TAG = "testOf0004"; 516 try { 517 let result = Array.of(null); 518 expect(JSON.stringify(result)).assertEqual('[null]'); 519 } catch (err) { 520 console.error(`${TAG} failed, error: ${err.message}`); 521 expect().assertFail(); 522 } 523 }) 524 /** 525 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2700 526 * @tc.name : testPrototypeConcat0001 527 * @tc.desc : Test the function of the interface PrototypeConcat 528 * @tc.size : MediumTest 529 * @tc.type : Function 530 * @tc.level : Level 1 531 */ 532 it('testPrototypeConcat0001', 0, () => { 533 const TAG = "testPrototypeConcat0001"; 534 try { 535 const letters1 = ["a", "b", "c"]; 536 const letters2 = ["D", "E", "F"]; 537 const alphaNumeric = letters1.concat(letters2); 538 console.log(`${TAG} result:` + JSON.stringify(alphaNumeric)); 539 expect(JSON.stringify(alphaNumeric)).assertEqual('["a","b","c","D","E","F"]'); 540 } catch (err) { 541 console.error(`${TAG} failed, error: ${err.message}`); 542 expect().assertFail(); 543 } 544 }) 545 /** 546 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2800 547 * @tc.name : testPrototypeConcat0002 548 * @tc.desc : Test the function of the interface PrototypeConcat 549 * @tc.size : MediumTest 550 * @tc.type : Function 551 * @tc.level : Level 1 552 */ 553 it('testPrototypeConcat0002', 0, () => { 554 const TAG = "testPrototypeConcat0002"; 555 try { 556 const letters1 = ["a", "b", "c"]; 557 const letters2 = []; 558 const alphaNumeric = letters1.concat(letters2); 559 console.log(`${TAG} result:` + JSON.stringify(alphaNumeric)); 560 expect(JSON.stringify(alphaNumeric)).assertEqual('["a","b","c"]'); 561 } catch (err) { 562 console.error(`${TAG} failed, error: ${err.message}`); 563 expect().assertFail(); 564 } 565 }) 566 /** 567 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_2900 568 * @tc.name : testPrototypeConcat0003 569 * @tc.desc : Test the function of the interface PrototypeConcat 570 * @tc.size : MediumTest 571 * @tc.type : Function 572 * @tc.level : Level 1 573 */ 574 it('testPrototypeConcat0003', 0, () => { 575 const TAG = "testPrototypeConcat0003"; 576 try { 577 const letters1 = ["a", "b", "c"]; 578 const letters2 = ['']; 579 const alphaNumeric = letters1.concat(letters2); 580 console.log(`${TAG} result:` + JSON.stringify(alphaNumeric)); 581 expect(JSON.stringify(alphaNumeric)).assertEqual('["a","b","c",""]'); 582 } catch (err) { 583 console.error(`${TAG} failed, error: ${err.message}`); 584 expect().assertFail(); 585 } 586 }) 587 /** 588 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3000 589 * @tc.name : testPrototypeConcat0004 590 * @tc.desc : Test the function of the interface PrototypeConcat 591 * @tc.size : MediumTest 592 * @tc.type : Function 593 * @tc.level : Level 1 594 */ 595 it('testPrototypeConcat0004', 0, () => { 596 const TAG = "testPrototypeConcat0004"; 597 try { 598 const num1 = [1, 2, 3]; 599 const num2 = [4, 5, 6]; 600 const num3 = [7, 8, 9]; 601 const numbers = num1.concat(num2, num3); 602 console.log(`${TAG} result:` + JSON.stringify(numbers)); 603 expect(JSON.stringify(numbers)).assertEqual('[1,2,3,4,5,6,7,8,9]'); 604 } catch (err) { 605 console.error(`${TAG} failed, error: ${err.message}`); 606 expect().assertFail(); 607 } 608 }) 609 /** 610 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3100 611 * @tc.name : testPrototypeConcat0005 612 * @tc.desc : Test the function of the interface PrototypeConcat 613 * @tc.size : MediumTest 614 * @tc.type : Function 615 * @tc.level : Level 1 616 */ 617 it('testPrototypeConcat0005', 0, () => { 618 const TAG = "testPrototypeConcat0005"; 619 try { 620 const letters = ["a", "b", "c"]; 621 const alphaNumeric = letters.concat('z', ['d', 'e']); 622 console.log(`${TAG} result:` + JSON.stringify(alphaNumeric)); 623 expect(JSON.stringify(alphaNumeric)).assertEqual('["a","b","c","z","d","e"]'); 624 } catch (err) { 625 console.error(`${TAG} failed, error: ${err.message}`); 626 expect().assertFail(); 627 } 628 }) 629 /** 630 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3200 631 * @tc.name : testPrototypeConcat0006 632 * @tc.desc : Test the function of the interface PrototypeConcat 633 * @tc.size : MediumTest 634 * @tc.type : Function 635 * @tc.level : Level 1 636 */ 637 it('testPrototypeConcat0006', 0, () => { 638 const TAG = "testPrototypeConcat0006"; 639 try { 640 const num1 = [[1]]; 641 const num2 = [2, 3]; 642 const obj = num1.concat(num2); 643 console.log(`${TAG} result:` + JSON.stringify(obj)); 644 expect(JSON.stringify(obj)).assertEqual('[[1],2,3]'); 645 } catch (err) { 646 console.error(`${TAG} failed, error: ${err.message}`); 647 expect().assertFail(); 648 } 649 }) 650 /** 651 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3300 652 * @tc.name : testPrototypeConcat0007 653 * @tc.desc : Test the function of the interface PrototypeConcat 654 * @tc.size : MediumTest 655 * @tc.type : Function 656 * @tc.level : Level 1 657 */ 658 it('testPrototypeConcat0007', 0, () => { 659 const TAG = "testPrototypeConcat0007"; 660 try { 661 const num1 = [1, , 3]; 662 const num2 = [4, 5]; 663 const obj = num1.concat(num2); 664 console.log(`${TAG} result:` + JSON.stringify(obj)); 665 expect(JSON.stringify(obj)).assertEqual('[1,null,3,4,5]'); 666 } catch (err) { 667 console.error(`${TAG} failed, error: ${err.message}`); 668 expect().assertFail(); 669 } 670 }) 671 /** 672 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3400 673 * @tc.name : testPrototypeConcat0008 674 * @tc.desc : Test the function of the interface PrototypeConcat 675 * @tc.size : MediumTest 676 * @tc.type : Function 677 * @tc.level : Level 1 678 */ 679 it('testPrototypeConcat0008', 0, () => { 680 const TAG = "testPrototypeConcat0008"; 681 try { 682 const num1 = [1, 2]; 683 const num2 = [3, 4,]; 684 const obj = num1.concat(num2); 685 console.log(`${TAG} result:` + JSON.stringify(obj)); 686 expect(JSON.stringify(obj)).assertEqual('[1,2,3,4]'); 687 } catch (err) { 688 console.error(`${TAG} failed, error: ${err.message}`); 689 expect().assertFail(); 690 } 691 }) 692 /** 693 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3500 694 * @tc.name : testPrototypeCopyWithin0001 695 * @tc.desc : Test the function of the interface PrototypeCopyWithin 696 * @tc.size : MediumTest 697 * @tc.type : Function 698 * @tc.level : Level 1 699 */ 700 it('testPrototypeCopyWithin0001', 0, () => { 701 const TAG = "testPrototypeCopyWithin0001"; 702 try { 703 let arr1 = [1, 2, 3, 4, 5]; 704 const obj = arr1.copyWithin(-2, 1); 705 console.log(`${TAG} result:` + JSON.stringify(obj)); 706 expect(JSON.stringify(obj)).assertEqual('[1,2,3,2,3]'); 707 } catch (err) { 708 console.error(`${TAG} failed, error: ${err.message}`); 709 expect().assertFail(); 710 } 711 }) 712 /** 713 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3600 714 * @tc.name : testPrototypeCopyWithin0002 715 * @tc.desc : Test the function of the interface PrototypeCopyWithin 716 * @tc.size : MediumTest 717 * @tc.type : Function 718 * @tc.level : Level 1 719 */ 720 it('testPrototypeCopyWithin0002', 0, () => { 721 const TAG = "testPrototypeCopyWithin0002"; 722 try { 723 let arr1 = [1, 2, 3, 4, 5]; 724 const obj = arr1.copyWithin(0, 3); 725 console.log(`${TAG} result:` + JSON.stringify(obj)); 726 expect(JSON.stringify(obj)).assertEqual('[4,5,3,4,5]'); 727 } catch (err) { 728 console.error(`${TAG} failed, error: ${err.message}`); 729 expect().assertFail(); 730 } 731 }) 732 /** 733 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3700 734 * @tc.name : testPrototypeCopyWithin0003 735 * @tc.desc : Test the function of the interface PrototypeCopyWithin 736 * @tc.size : MediumTest 737 * @tc.type : Function 738 * @tc.level : Level 1 739 */ 740 it('testPrototypeCopyWithin0003', 0, () => { 741 const TAG = "testPrototypeCopyWithin0003"; 742 try { 743 let arr1 = [1, 2, 3, 4, 5]; 744 const obj = arr1.copyWithin(0, 3, 4); 745 console.log(`${TAG} result:` + JSON.stringify(obj)); 746 expect(JSON.stringify(obj)).assertEqual('[4,2,3,4,5]'); 747 } catch (err) { 748 console.error(`${TAG} failed, error: ${err.message}`); 749 expect().assertFail(); 750 } 751 }) 752 /** 753 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3800 754 * @tc.name : testPrototypeCopyWithin0004 755 * @tc.desc : Test the function of the interface PrototypeCopyWithin 756 * @tc.size : MediumTest 757 * @tc.type : Function 758 * @tc.level : Level 1 759 */ 760 it('testPrototypeCopyWithin0004', 0, () => { 761 const TAG = "testPrototypeCopyWithin0004"; 762 try { 763 let arr1 = [1, 2, 3, 4, 5]; 764 const obj = arr1.copyWithin(-2, -3, -1); 765 console.log(`${TAG} result:` + JSON.stringify(obj)); 766 expect(JSON.stringify(obj)).assertEqual('[1,2,3,3,4]'); 767 } catch (err) { 768 console.error(`${TAG} failed, error: ${err.message}`); 769 expect().assertFail(); 770 } 771 }) 772 /** 773 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_3900 774 * @tc.name : testPrototypeFill0001 775 * @tc.desc : Test the function of the interface PrototypeFill 776 * @tc.size : MediumTest 777 * @tc.type : Function 778 * @tc.level : Level 1 779 */ 780 it('testPrototypeFill0001', 0, () => { 781 const TAG = "testPrototypeFill0001"; 782 try { 783 let arr = [1, 2, 3]; 784 let obj = arr.fill(4); 785 console.log(`${TAG} result:` + JSON.stringify(obj)); 786 expect(JSON.stringify(obj)).assertEqual('[4,4,4]'); 787 } catch (err) { 788 console.error(`${TAG} failed, error: ${err.message}`); 789 expect().assertFail(); 790 } 791 }) 792 /** 793 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4000 794 * @tc.name : testPrototypeFill0002 795 * @tc.desc : Test the function of the interface PrototypeFill 796 * @tc.size : MediumTest 797 * @tc.type : Function 798 * @tc.level : Level 1 799 */ 800 it('testPrototypeFill0002', 0, () => { 801 const TAG = "testPrototypeFill0002"; 802 try { 803 let arr = [1, 2, 3]; 804 let obj = arr.fill(4, 1); 805 console.log(`${TAG} result:` + JSON.stringify(obj)); 806 expect(JSON.stringify(obj)).assertEqual('[1,4,4]'); 807 } catch (err) { 808 console.error(`${TAG} failed, error: ${err.message}`); 809 expect().assertFail(); 810 } 811 }) 812 /** 813 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4100 814 * @tc.name : testPrototypeFill0003 815 * @tc.desc : Test the function of the interface PrototypeFill 816 * @tc.size : MediumTest 817 * @tc.type : Function 818 * @tc.level : Level 1 819 */ 820 it('testPrototypeFill0003', 0, () => { 821 const TAG = "testPrototypeFill0003"; 822 try { 823 let arr = [1, 2, 3]; 824 let obj = arr.fill(4, 1, 2); 825 console.log(`${TAG} result:` + JSON.stringify(obj)); 826 expect(JSON.stringify(obj)).assertEqual('[1,4,3]'); 827 } catch (err) { 828 console.error(`${TAG} failed, error: ${err.message}`); 829 expect().assertFail(); 830 } 831 }) 832 /** 833 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4200 834 * @tc.name : testPrototypeFill0004 835 * @tc.desc : Test the function of the interface PrototypeFill 836 * @tc.size : MediumTest 837 * @tc.type : Function 838 * @tc.level : Level 1 839 */ 840 it('testPrototypeFill0004', 0, () => { 841 const TAG = "testPrototypeFill0004"; 842 try { 843 let arr = [1, 2, 3]; 844 let obj = arr.fill(4, 1, 1); 845 console.log(`${TAG} result:` + JSON.stringify(obj)); 846 expect(JSON.stringify(obj)).assertEqual('[1,2,3]'); 847 } catch (err) { 848 console.error(`${TAG} failed, error: ${err.message}`); 849 expect().assertFail(); 850 } 851 }) 852 /** 853 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4300 854 * @tc.name : testPrototypeFill0005 855 * @tc.desc : Test the function of the interface PrototypeFill 856 * @tc.size : MediumTest 857 * @tc.type : Function 858 * @tc.level : Level 1 859 */ 860 it('testPrototypeFill0005', 0, () => { 861 const TAG = "testPrototypeFill0005"; 862 try { 863 let arr = [1, 2, 3]; 864 let obj = arr.fill(4, 3, 3); 865 console.log(`${TAG} result:` + JSON.stringify(obj)); 866 expect(JSON.stringify(obj)).assertEqual('[1,2,3]'); 867 } catch (err) { 868 console.error(`${TAG} failed, error: ${err.message}`); 869 expect().assertFail(); 870 } 871 }) 872 /** 873 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4400 874 * @tc.name : testPrototypeFill0006 875 * @tc.desc : Test the function of the interface PrototypeFill 876 * @tc.size : MediumTest 877 * @tc.type : Function 878 * @tc.level : Level 1 879 */ 880 it('testPrototypeFill0006', 0, () => { 881 const TAG = "testPrototypeFill0006"; 882 try { 883 let arr = [1, 2, 3]; 884 let obj = arr.fill(4, -3, -2); 885 console.log(`${TAG} result:` + JSON.stringify(obj)); 886 expect(JSON.stringify(obj)).assertEqual('[4,2,3]'); 887 } catch (err) { 888 console.error(`${TAG} failed, error: ${err.message}`); 889 expect().assertFail(); 890 } 891 }) 892 /** 893 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4500 894 * @tc.name : testPrototypeFill0007 895 * @tc.desc : Test the function of the interface PrototypeFill 896 * @tc.size : MediumTest 897 * @tc.type : Function 898 * @tc.level : Level 1 899 */ 900 it('testPrototypeFill0007', 0, () => { 901 const TAG = "testPrototypeFill0007"; 902 try { 903 let arr = [1, 2, 3]; 904 let obj = arr.fill(4, NaN, NaN); 905 console.log(`${TAG} result:` + JSON.stringify(obj)); 906 expect(JSON.stringify(obj)).assertEqual('[1,2,3]'); 907 } catch (err) { 908 console.error(`${TAG} failed, error: ${err.message}`); 909 expect().assertFail(); 910 } 911 }) 912 /** 913 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4600 914 * @tc.name : testPrototypeFill0008 915 * @tc.desc : Test the function of the interface PrototypeFill 916 * @tc.size : MediumTest 917 * @tc.type : Function 918 * @tc.level : Level 1 919 */ 920 it('testPrototypeFill0008', 0, () => { 921 const TAG = "testPrototypeFill0008"; 922 try { 923 let arr = [1, 2, 3]; 924 let obj = arr.fill(4, 3, 5); 925 console.log(`${TAG} result:` + JSON.stringify(obj)); 926 expect(JSON.stringify(obj)).assertEqual('[1,2,3]'); 927 } catch (err) { 928 console.error(`${TAG} failed, error: ${err.message}`); 929 expect().assertFail(); 930 } 931 }) 932 /** 933 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4700 934 * @tc.name : testPrototypeFill0009 935 * @tc.desc : Test the function of the interface PrototypeFill 936 * @tc.size : MediumTest 937 * @tc.type : Function 938 * @tc.level : Level 1 939 */ 940 it('testPrototypeFill0009', 0, () => { 941 const TAG = "testPrototypeFill0009"; 942 try { 943 let arr = [3]; 944 let obj = arr.fill(4); 945 console.log(`${TAG} result:` + JSON.stringify(obj)); 946 expect(JSON.stringify(obj)).assertEqual('[4]'); 947 } catch (err) { 948 console.error(`${TAG} failed, error: ${err.message}`); 949 expect().assertFail(); 950 } 951 }) 952 /** 953 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4800 954 * @tc.name : testPrototypeFill0010 955 * @tc.desc : Test the function of the interface PrototypeFill 956 * @tc.size : MediumTest 957 * @tc.type : Function 958 * @tc.level : Level 1 959 */ 960 it('testPrototypeFill0010', 0, () => { 961 const TAG = "testPrototypeFill0010"; 962 try { 963 let arr = [1, 2, 3]; 964 let obj = arr.fill(4, undefined, undefined); 965 console.log(`${TAG} result:` + JSON.stringify(obj)); 966 expect(JSON.stringify(obj)).assertEqual('[4,4,4]'); 967 } catch (err) { 968 console.error(`${TAG} failed, error: ${err.message}`); 969 expect().assertFail(); 970 } 971 }) 972 /** 973 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_4900 974 * @tc.name : testPrototypeFind0001 975 * @tc.desc : Test the function of the interface PrototypeFind 976 * @tc.size : MediumTest 977 * @tc.type : Function 978 * @tc.level : Level 1 979 */ 980 it('testPrototypeFind0001', 0, () => { 981 const TAG = "testPrototypeFind0001"; 982 try { 983 const array1 = [11, 12]; 984 const found = array1.find((element) => element > 10); 985 console.log(`${TAG} result:` + JSON.stringify(found)); 986 expect(JSON.stringify(found)).assertEqual('11'); 987 } catch (err) { 988 console.error(`${TAG} failed, error: ${err.message}`); 989 expect().assertFail(); 990 } 991 }) 992 /** 993 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5000 994 * @tc.name : testPrototypeFind0002 995 * @tc.desc : Test the function of the interface PrototypeFind 996 * @tc.size : MediumTest 997 * @tc.type : Function 998 * @tc.level : Level 1 999 */ 1000 it('testPrototypeFind0002', 0, () => { 1001 const TAG = "testPrototypeFind0002"; 1002 try { 1003 const array1 = [10, 12, 14]; 1004 const found = array1.find((element) => element > 10); 1005 console.log(`${TAG} result:` + JSON.stringify(found)); 1006 expect(JSON.stringify(found)).assertEqual('12'); 1007 } catch (err) { 1008 console.error(`${TAG} failed, error: ${err.message}`); 1009 expect().assertFail(); 1010 } 1011 }) 1012 /** 1013 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5100 1014 * @tc.name : testPrototypeFind0003 1015 * @tc.desc : Test the function of the interface PrototypeFind 1016 * @tc.size : MediumTest 1017 * @tc.type : Function 1018 * @tc.level : Level 1 1019 */ 1020 it('testPrototypeFind0003', 0, () => { 1021 const TAG = "testPrototypeFind0003"; 1022 try { 1023 const array1 = [10, 12, 14, 255]; 1024 const found = array1.find((element) => element > 100); 1025 console.log(`${TAG} result:` + JSON.stringify(found)); 1026 expect(JSON.stringify(found)).assertEqual('255'); 1027 } catch (err) { 1028 console.error(`${TAG} failed, error: ${err.message}`); 1029 expect().assertFail(); 1030 } 1031 }) 1032 /** 1033 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5200 1034 * @tc.name : testPrototypeFlat0001 1035 * @tc.desc : Test the function of the interface PrototypeFlat 1036 * @tc.size : MediumTest 1037 * @tc.type : Function 1038 * @tc.level : Level 1 1039 */ 1040 it('testPrototypeFlat0001', 0, () => { 1041 const TAG = "testPrototypeFlat0001"; 1042 try { 1043 const arr1 = [0, 1, 2, [3, 4]]; 1044 const found = arr1.flat(); 1045 console.log(`${TAG} result:` + JSON.stringify(found)); 1046 expect(JSON.stringify(found)).assertEqual('[0,1,2,3,4]'); 1047 } catch (err) { 1048 console.error(`${TAG} failed, error: ${err.message}`); 1049 expect().assertFail(); 1050 } 1051 }) 1052 /** 1053 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5300 1054 * @tc.name : testPrototypeFlat0002 1055 * @tc.desc : Test the function of the interface PrototypeFlat 1056 * @tc.size : MediumTest 1057 * @tc.type : Function 1058 * @tc.level : Level 1 1059 */ 1060 it('testPrototypeFlat0002', 0, () => { 1061 const TAG = "testPrototypeFlat0002"; 1062 try { 1063 const arr2 = [1, 2, [3, 4, [5, 6]]]; 1064 arr2.flat(); 1065 console.log(`${TAG} result:` + JSON.stringify(arr2.flat())); 1066 expect(JSON.stringify(arr2.flat())).assertEqual('[1,2,3,4,[5,6]]'); 1067 } catch (err) { 1068 console.error(`${TAG} failed, error: ${err.message}`); 1069 expect().assertFail(); 1070 } 1071 }) 1072 /** 1073 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5400 1074 * @tc.name : testPrototypeFlat0003 1075 * @tc.desc : Test the function of the interface PrototypeFlat 1076 * @tc.size : MediumTest 1077 * @tc.type : Function 1078 * @tc.level : Level 1 1079 */ 1080 it('testPrototypeFlat0003', 0, () => { 1081 const TAG = "testPrototypeFlat0003"; 1082 try { 1083 const arr3 = [1, 2, [3, 4, [5, 6]]]; 1084 arr3.flat(2); 1085 console.log(`${TAG} result:` + JSON.stringify(arr3.flat(2))); 1086 expect(JSON.stringify(arr3.flat(2))).assertEqual('[1,2,3,4,5,6]'); 1087 } catch (err) { 1088 console.error(`${TAG} failed, error: ${err.message}`); 1089 expect().assertFail(); 1090 } 1091 }) 1092 /** 1093 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5500 1094 * @tc.name : testPrototypeFlat0004 1095 * @tc.desc : Test the function of the interface PrototypeFlat 1096 * @tc.size : MediumTest 1097 * @tc.type : Function 1098 * @tc.level : Level 1 1099 */ 1100 it('testPrototypeFlat0004', 0, () => { 1101 const TAG = "testPrototypeFlat0004"; 1102 try { 1103 const arr4 = [1, 2, [3, 4, [5, 6, [7, 8, [9, 10]]]]]; 1104 let obj = arr4.flat(Infinity); 1105 console.log(`${TAG} result:` + JSON.stringify(obj)); 1106 expect(JSON.stringify(obj)).assertEqual('[1,2,3,4,5,6,7,8,9,10]'); 1107 } catch (err) { 1108 console.error(`${TAG} failed, error: ${err.message}`); 1109 expect().assertFail(); 1110 } 1111 }) 1112 /** 1113 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5600 1114 * @tc.name : testPrototypeFlat0005 1115 * @tc.desc : Test the function of the interface PrototypeFlat 1116 * @tc.size : MediumTest 1117 * @tc.type : Function 1118 * @tc.level : Level 1 1119 */ 1120 it('testPrototypeFlat0005', 0, () => { 1121 const TAG = "testPrototypeFlat0005"; 1122 try { 1123 const arr5 = [1, 2, , 4, 5]; 1124 let obj = arr5.flat(); 1125 console.log(`${TAG} result:` + JSON.stringify(obj)); 1126 expect(JSON.stringify(obj)).assertEqual('[1,2,4,5]'); 1127 } catch (err) { 1128 console.error(`${TAG} failed, error: ${err.message}`); 1129 expect().assertFail(); 1130 } 1131 }) 1132 /** 1133 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5700 1134 * @tc.name : testPrototypeFlat0006 1135 * @tc.desc : Test the function of the interface PrototypeFlat 1136 * @tc.size : MediumTest 1137 * @tc.type : Function 1138 * @tc.level : Level 1 1139 */ 1140 it('testPrototypeFlat0006', 0, () => { 1141 const TAG = "testPrototypeFlat0006"; 1142 try { 1143 const arr5 = [1, , 3, ["a", , "c"]]; 1144 let obj = arr5.flat(); 1145 console.log(`${TAG} result:` + JSON.stringify(obj)); 1146 expect(JSON.stringify(obj)).assertEqual('[1,3,"a","c"]'); 1147 } catch (err) { 1148 console.error(`${TAG} failed, error: ${err.message}`); 1149 expect().assertFail(); 1150 } 1151 }) 1152 /** 1153 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5800 1154 * @tc.name : testPrototypeFlat0007 1155 * @tc.desc : Test the function of the interface PrototypeFlat 1156 * @tc.size : MediumTest 1157 * @tc.type : Function 1158 * @tc.level : Level 1 1159 */ 1160 it('testPrototypeFlat0007', 0, () => { 1161 const TAG = "testPrototypeFlat0007"; 1162 try { 1163 const array2 = [1, , 3, ["a", , ["d", , "e"]]]; 1164 let obj = array2.flat(); 1165 console.log(`${TAG} result:` + JSON.stringify(obj)); 1166 expect(JSON.stringify(obj)).assertEqual('[1,3,"a",["d",null,"e"]]'); 1167 } catch (err) { 1168 console.error(`${TAG} failed, error: ${err.message}`); 1169 expect().assertFail(); 1170 } 1171 }) 1172 /** 1173 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_5900 1174 * @tc.name : testPrototypeFlat0008 1175 * @tc.desc : Test the function of the interface PrototypeFlat 1176 * @tc.size : MediumTest 1177 * @tc.type : Function 1178 * @tc.level : Level 1 1179 */ 1180 it('testPrototypeFlat0008', 0, () => { 1181 const TAG = "testPrototypeFlat0008"; 1182 try { 1183 const array2 = [1, , 3, ["a", , ["d", , "e"]]]; 1184 let obj = array2.flat(2); 1185 console.log(`${TAG} result:` + JSON.stringify(obj)); 1186 expect(JSON.stringify(obj)).assertEqual('[1,3,"a","d","e"]'); 1187 } catch (err) { 1188 console.error(`${TAG} failed, error: ${err.message}`); 1189 expect().assertFail(); 1190 } 1191 }) 1192 /** 1193 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6000 1194 * @tc.name : testPrototypeFlat0009 1195 * @tc.desc : Test the function of the interface PrototypeFlat 1196 * @tc.size : MediumTest 1197 * @tc.type : Function 1198 * @tc.level : Level 1 1199 */ 1200 it('testPrototypeFlat0009', 0, () => { 1201 const TAG = "testPrototypeFlat0009"; 1202 try { 1203 const array2 = [1, undefined, 3]; 1204 let obj = array2.flat(); 1205 console.log(`${TAG} result:` + JSON.stringify(obj)); 1206 expect(JSON.stringify(obj)).assertEqual('[1,null,3]'); 1207 } catch (err) { 1208 console.error(`${TAG} failed, error: ${err.message}`); 1209 expect().assertFail(); 1210 } 1211 }) 1212 /** 1213 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6100 1214 * @tc.name : testPrototypeFlat0010 1215 * @tc.desc : Test the function of the interface PrototypeFlat 1216 * @tc.size : MediumTest 1217 * @tc.type : Function 1218 * @tc.level : Level 1 1219 */ 1220 it('testPrototypeFlat0010', 0, () => { 1221 const TAG = "testPrototypeFlat0010"; 1222 try { 1223 const array2 = [undefined, undefined, undefined]; 1224 let obj = array2.flat(); 1225 console.log(`${TAG} result:` + JSON.stringify(obj)); 1226 expect(JSON.stringify(obj)).assertEqual('[null,null,null]'); 1227 } catch (err) { 1228 console.error(`${TAG} failed, error: ${err.message}`); 1229 expect().assertFail(); 1230 } 1231 }) 1232 /** 1233 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6200 1234 * @tc.name : testPrototypeFlatMap0001 1235 * @tc.desc : Test the function of the interface PrototypeFlatMap 1236 * @tc.size : MediumTest 1237 * @tc.type : Function 1238 * @tc.level : Level 1 1239 */ 1240 it('testPrototypeFlatMap0001', 0, () => { 1241 const TAG = "testPrototypeFlatMap0001"; 1242 try { 1243 const arr1 = [1, 2, 1]; 1244 const result = arr1.flatMap((num) => (num === 2 ? [2, 2] : 1)); 1245 expect(JSON.stringify(result)).assertEqual('[1,2,2,1]'); 1246 } catch (err) { 1247 console.error(`${TAG} failed, error: ${err.message}`); 1248 expect().assertFail(); 1249 } 1250 }) 1251 /** 1252 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6300 1253 * @tc.name : testPrototypeFlatMap0002 1254 * @tc.desc : Test the function of the interface PrototypeFlatMap 1255 * @tc.size : MediumTest 1256 * @tc.type : Function 1257 * @tc.level : Level 1 1258 */ 1259 it('testPrototypeFlatMap0002', 0, () => { 1260 const TAG = "testPrototypeFlatMap0002"; 1261 try { 1262 const arr1 = [1, , 1]; 1263 const result = arr1.flatMap((num) => (num === 2 ? [2, 2] : 1)); 1264 expect(JSON.stringify(result)).assertEqual('[1,1]'); 1265 } catch (err) { 1266 console.error(`${TAG} failed, error: ${err.message}`); 1267 expect().assertFail(); 1268 } 1269 }) 1270 /** 1271 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6400 1272 * @tc.name : testPrototypeFlatMap0003 1273 * @tc.desc : Test the function of the interface PrototypeFlatMap 1274 * @tc.size : MediumTest 1275 * @tc.type : Function 1276 * @tc.level : Level 1 1277 */ 1278 it('testPrototypeFlatMap0003', 0, () => { 1279 const TAG = "testPrototypeFlatMap0003"; 1280 try { 1281 const arr1 = [1, undefined, 1]; 1282 const result = arr1.flatMap((num) => (num === 2 ? [2, 2] : 1)); 1283 expect(JSON.stringify(result)).assertEqual('[1,1,1]'); 1284 } catch (err) { 1285 console.error(`${TAG} failed, error: ${err.message}`); 1286 expect().assertFail(); 1287 } 1288 }) 1289 /** 1290 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6500 1291 * @tc.name : testPrototypeIncludes0001 1292 * @tc.desc : Test the function of the interface PrototypeIncludes 1293 * @tc.size : MediumTest 1294 * @tc.type : Function 1295 * @tc.level : Level 1 1296 */ 1297 it('testPrototypeIncludes0001', 0, () => { 1298 const TAG = "testPrototypeIncludes0001"; 1299 try { 1300 const array1 = [1, 2, 3]; 1301 const result = array1.includes(2); 1302 console.log(`${TAG} result:` + result); 1303 expect(result).assertEqual(true); 1304 } catch (err) { 1305 console.error(`${TAG} failed, error: ${err.message}`); 1306 expect().assertFail(); 1307 } 1308 }) 1309 /** 1310 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6600 1311 * @tc.name : testPrototypeIncludes0002 1312 * @tc.desc : Test the function of the interface PrototypeIncludes 1313 * @tc.size : MediumTest 1314 * @tc.type : Function 1315 * @tc.level : Level 1 1316 */ 1317 it('testPrototypeIncludes0002', 0, () => { 1318 const TAG = "testPrototypeIncludes0002"; 1319 try { 1320 let array1 = [1, 2, 3]; 1321 let value = array1.includes(2.1); 1322 console.log(`${TAG} result:` + value); 1323 expect(value).assertEqual(false); 1324 } catch (err) { 1325 console.error(`${TAG} failed, error: ${err.message}`); 1326 expect().assertFail(); 1327 } 1328 }) 1329 /** 1330 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6700 1331 * @tc.name : testPrototypeIncludes0003 1332 * @tc.desc : Test the function of the interface PrototypeIncludes 1333 * @tc.size : MediumTest 1334 * @tc.type : Function 1335 * @tc.level : Level 1 1336 */ 1337 it('testPrototypeIncludes0003', 0, () => { 1338 const TAG = "testPrototypeIncludes0003"; 1339 try { 1340 let array1 = [1, 2, 3]; 1341 let value = array1.includes(1, 2); 1342 console.log(`${TAG} result:` + value); 1343 expect(value).assertEqual(false); 1344 } catch (err) { 1345 console.error(`${TAG} failed, error: ${err.message}`); 1346 expect().assertFail(); 1347 } 1348 }) 1349 /** 1350 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6800 1351 * @tc.name : testPrototypeIncludes0004 1352 * @tc.desc : Test the function of the interface PrototypeIncludes 1353 * @tc.size : MediumTest 1354 * @tc.type : Function 1355 * @tc.level : Level 1 1356 */ 1357 it('testPrototypeIncludes0004', 0, () => { 1358 const TAG = "testPrototypeIncludes0004"; 1359 try { 1360 let array1 = [1, 2, 3]; 1361 let value = array1.includes(-1); 1362 console.log(`${TAG} result:` + value); 1363 expect(value).assertEqual(false); 1364 } catch (err) { 1365 console.error(`${TAG} failed, error: ${err.message}`); 1366 expect().assertFail(); 1367 } 1368 }) 1369 /** 1370 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_6900 1371 * @tc.name : testPrototypeIncludes0005 1372 * @tc.desc : Test the function of the interface PrototypeIncludes 1373 * @tc.size : MediumTest 1374 * @tc.type : Function 1375 * @tc.level : Level 1 1376 */ 1377 it('testPrototypeIncludes0005', 0, () => { 1378 const TAG = "testPrototypeIncludes0005"; 1379 try { 1380 let array1 = [1, 2, 3]; 1381 let value = array1.includes(-1, -2); 1382 console.log(`${TAG} result:` + value); 1383 expect(value).assertEqual(false); 1384 } catch (err) { 1385 console.error(`${TAG} failed, error: ${err.message}`); 1386 expect().assertFail(); 1387 } 1388 }) 1389 /** 1390 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7000 1391 * @tc.name : testPrototypeIncludes0006 1392 * @tc.desc : Test the function of the interface PrototypeIncludes 1393 * @tc.size : MediumTest 1394 * @tc.type : Function 1395 * @tc.level : Level 1 1396 */ 1397 it('testPrototypeIncludes0006', 0, () => { 1398 const TAG = "testPrototypeIncludes0006"; 1399 try { 1400 let array1 = [1, 2, NaN]; 1401 let value = array1.includes(NaN); 1402 console.log(`${TAG} result:` + value); 1403 expect(value).assertEqual(true); 1404 } catch (err) { 1405 console.error(`${TAG} failed, error: ${err.message}`); 1406 expect().assertFail(); 1407 } 1408 }) 1409 /** 1410 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7100 1411 * @tc.name : testPrototypeIncludes0007 1412 * @tc.desc : Test the function of the interface PrototypeIncludes 1413 * @tc.size : MediumTest 1414 * @tc.type : Function 1415 * @tc.level : Level 1 1416 */ 1417 it('testPrototypeIncludes0007', 0, () => { 1418 const TAG = "testPrototypeIncludes0007"; 1419 try { 1420 let array1 = ['1', '2', '3']; 1421 let value = array1.includes('3'); 1422 console.log(`${TAG} result:` + value); 1423 expect(value).assertEqual(true); 1424 } catch (err) { 1425 console.error(`${TAG} failed, error: ${err.message}`); 1426 expect().assertFail(); 1427 } 1428 }) 1429 /** 1430 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7200 1431 * @tc.name : testPrototypeIncludes0008 1432 * @tc.desc : Test the function of the interface PrototypeIncludes 1433 * @tc.size : MediumTest 1434 * @tc.type : Function 1435 * @tc.level : Level 1 1436 */ 1437 it('testPrototypeIncludes0008', 0, () => { 1438 const TAG = "testPrototypeIncludes0008"; 1439 try { 1440 const arr = ["a", "b", "c"]; 1441 let value = arr.includes("c", 3); 1442 console.log(`${TAG} result:` + value); 1443 expect(value).assertEqual(false); 1444 } catch (err) { 1445 console.error(`${TAG} failed, error: ${err.message}`); 1446 expect().assertFail(); 1447 } 1448 }) 1449 /** 1450 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7300 1451 * @tc.name : testPrototypeIncludes0009 1452 * @tc.desc : Test the function of the interface PrototypeIncludes 1453 * @tc.size : MediumTest 1454 * @tc.type : Function 1455 * @tc.level : Level 1 1456 */ 1457 it('testPrototypeIncludes0009', 0, () => { 1458 const TAG = "testPrototypeIncludes0009"; 1459 try { 1460 const arr = ["a", "b", "c"]; 1461 let value = arr.includes("c", 100); 1462 console.log(`${TAG} result:` + value); 1463 expect(value).assertEqual(false); 1464 } catch (err) { 1465 console.error(`${TAG} failed, error: ${err.message}`); 1466 expect().assertFail(); 1467 } 1468 }) 1469 /** 1470 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7400 1471 * @tc.name : testPrototypeIncludes0010 1472 * @tc.desc : Test the function of the interface PrototypeIncludes 1473 * @tc.size : MediumTest 1474 * @tc.type : Function 1475 * @tc.level : Level 1 1476 */ 1477 it('testPrototypeIncludes0010', 0, () => { 1478 const TAG = "testPrototypeIncludes0010"; 1479 try { 1480 const arr = ["a", "b", "c"]; 1481 let value = arr.includes("c", 3); 1482 console.log(`${TAG} result:` + value); 1483 expect(value).assertEqual(false); 1484 } catch (err) { 1485 console.error(`${TAG} failed, error: ${err.message}`); 1486 expect().assertFail(); 1487 } 1488 }) 1489 /** 1490 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7500 1491 * @tc.name : testPrototypeIncludes0011 1492 * @tc.desc : Test the function of the interface PrototypeIncludes 1493 * @tc.size : MediumTest 1494 * @tc.type : Function 1495 * @tc.level : Level 1 1496 */ 1497 it('testPrototypeIncludes0011', 0, () => { 1498 const TAG = "testPrototypeIncludes0011"; 1499 try { 1500 const arr = ["a", "b", "c"]; 1501 let value = arr.includes("c", 100); 1502 console.log(`${TAG} result:` + value); 1503 expect(value).assertEqual(false); 1504 } catch (err) { 1505 console.error(`${TAG} failed, error: ${err.message}`); 1506 expect().assertFail(); 1507 } 1508 }) 1509 /** 1510 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7600 1511 * @tc.name : testPrototypeIncludes0012 1512 * @tc.desc : Test the function of the interface PrototypeIncludes 1513 * @tc.size : MediumTest 1514 * @tc.type : Function 1515 * @tc.level : Level 1 1516 */ 1517 it('testPrototypeIncludes0012', 0, () => { 1518 const TAG = "testPrototypeIncludes0012"; 1519 try { 1520 const arr = ["a", "b", "c"]; 1521 let value = arr.includes("a", -100); 1522 console.log(`${TAG} result:` + value); 1523 expect(value).assertEqual(true); 1524 } catch (err) { 1525 console.error(`${TAG} failed, error: ${err.message}`); 1526 expect().assertFail(); 1527 } 1528 }) 1529 /** 1530 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7700 1531 * @tc.name : testPrototypeIncludes0013 1532 * @tc.desc : Test the function of the interface PrototypeIncludes 1533 * @tc.size : MediumTest 1534 * @tc.type : Function 1535 * @tc.level : Level 1 1536 */ 1537 it('testPrototypeIncludes0013', 0, () => { 1538 const TAG = "testPrototypeIncludes0013"; 1539 try { 1540 const arr = ["a", "b", "c"]; 1541 let value = arr.includes("b", -100); 1542 console.log(`${TAG} result:` + value); 1543 expect(value).assertEqual(true); 1544 } catch (err) { 1545 console.error(`${TAG} failed, error: ${err.message}`); 1546 expect().assertFail(); 1547 } 1548 }) 1549 /** 1550 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7800 1551 * @tc.name : testPrototypeIncludes0014 1552 * @tc.desc : Test the function of the interface PrototypeIncludes 1553 * @tc.size : MediumTest 1554 * @tc.type : Function 1555 * @tc.level : Level 1 1556 */ 1557 it('testPrototypeIncludes0014', 0, () => { 1558 const TAG = "testPrototypeIncludes0014"; 1559 try { 1560 const arr = ["a", "b", "c"]; 1561 let value = arr.includes("c", -100); 1562 console.log(`${TAG} result:` + value); 1563 expect(value).assertEqual(true); 1564 } catch (err) { 1565 console.error(`${TAG} failed, error: ${err.message}`); 1566 expect().assertFail(); 1567 } 1568 }) 1569 /** 1570 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_7900 1571 * @tc.name : testPrototypeIncludes0015 1572 * @tc.desc : Test the function of the interface PrototypeIncludes 1573 * @tc.size : MediumTest 1574 * @tc.type : Function 1575 * @tc.level : Level 1 1576 */ 1577 it('testPrototypeIncludes0015', 0, () => { 1578 const TAG = "testPrototypeIncludes0015"; 1579 try { 1580 const arr = ["a", "b", "c"]; 1581 let value = arr.includes("a", -2); 1582 console.log(`${TAG} result:` + value); 1583 expect(value).assertEqual(false); 1584 } catch (err) { 1585 console.error(`${TAG} failed, error: ${err.message}`); 1586 expect().assertFail(); 1587 } 1588 }) 1589 /** 1590 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8000 1591 * @tc.name : testPrototypeIndexOf0001 1592 * @tc.desc : Test the function of the interface PrototypeIndexOf 1593 * @tc.size : MediumTest 1594 * @tc.type : Function 1595 * @tc.level : Level 1 1596 */ 1597 it('testPrototypeIndexOf0001', 0, () => { 1598 const TAG = "testPrototypeIndexOf0001"; 1599 try { 1600 const array = [2, 9, 9]; 1601 const result = array.indexOf(2); 1602 console.log(`${TAG} result:` + result); 1603 expect(result).assertEqual(0); 1604 } catch (err) { 1605 console.error(`${TAG} failed, error: ${err.message}`); 1606 expect().assertFail(); 1607 } 1608 }) 1609 /** 1610 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8100 1611 * @tc.name : testPrototypeIndexOf0002 1612 * @tc.desc : Test the function of the interface PrototypeIndexOf 1613 * @tc.size : MediumTest 1614 * @tc.type : Function 1615 * @tc.level : Level 1 1616 */ 1617 it('testPrototypeIndexOf0002', 0, () => { 1618 const TAG = "testPrototypeIndexOf0002"; 1619 try { 1620 const array = [2, 9, 9]; 1621 const result = array.indexOf(7); 1622 console.log(`${TAG} result:` + result); 1623 expect(result).assertEqual(-1); 1624 } catch (err) { 1625 console.error(`${TAG} failed, error: ${err.message}`); 1626 expect().assertFail(); 1627 } 1628 }) 1629 /** 1630 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8200 1631 * @tc.name : testPrototypeIndexOf0003 1632 * @tc.desc : Test the function of the interface PrototypeIndexOf 1633 * @tc.size : MediumTest 1634 * @tc.type : Function 1635 * @tc.level : Level 1 1636 */ 1637 it('testPrototypeIndexOf0003', 0, () => { 1638 const TAG = "testPrototypeIndexOf0003"; 1639 try { 1640 const array = [2, 9, 9]; 1641 const result = array.indexOf(9, 2); 1642 console.log(`${TAG} result:` + result); 1643 expect(result).assertEqual(2); 1644 } catch (err) { 1645 console.error(`${TAG} failed, error: ${err.message}`); 1646 expect().assertFail(); 1647 } 1648 }) 1649 /** 1650 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8300 1651 * @tc.name : testPrototypeIndexOf0004 1652 * @tc.desc : Test the function of the interface PrototypeIndexOf 1653 * @tc.size : MediumTest 1654 * @tc.type : Function 1655 * @tc.level : Level 1 1656 */ 1657 it('testPrototypeIndexOf0004', 0, () => { 1658 const TAG = "testPrototypeIndexOf0004"; 1659 try { 1660 const array = [2, 9, 9]; 1661 const result = array.indexOf(2, -1); 1662 console.log(`${TAG} result:` + result); 1663 expect(result).assertEqual(-1); 1664 } catch (err) { 1665 console.error(`${TAG} failed, error: ${err.message}`); 1666 expect().assertFail(); 1667 } 1668 }) 1669 /** 1670 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8400 1671 * @tc.name : testPrototypeIndexOf0005 1672 * @tc.desc : Test the function of the interface PrototypeIndexOf 1673 * @tc.size : MediumTest 1674 * @tc.type : Function 1675 * @tc.level : Level 1 1676 */ 1677 it('testPrototypeIndexOf0005', 0, () => { 1678 const TAG = "testPrototypeIndexOf0005"; 1679 try { 1680 const array = [2, 9, 9]; 1681 const result = array.indexOf(2, -3); 1682 console.log(`${TAG} result:` + result); 1683 expect(result).assertEqual(0); 1684 } catch (err) { 1685 console.error(`${TAG} failed, error: ${err.message}`); 1686 expect().assertFail(); 1687 } 1688 }) 1689 /** 1690 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8500 1691 * @tc.name : testPrototypeIndexOf0006 1692 * @tc.desc : Test the function of the interface PrototypeIndexOf 1693 * @tc.size : MediumTest 1694 * @tc.type : Function 1695 * @tc.level : Level 1 1696 */ 1697 it('testPrototypeIndexOf0006', 0, () => { 1698 const TAG = "testPrototypeIndexOf0006"; 1699 try { 1700 const array = [NaN]; 1701 const result = array.indexOf(NaN); 1702 console.log(`${TAG} result:` + result); 1703 expect(result).assertEqual(-1); 1704 } catch (err) { 1705 console.error(`${TAG} failed, error: ${err.message}`); 1706 expect().assertFail(); 1707 } 1708 }) 1709 /** 1710 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8600 1711 * @tc.name : testPrototypeIndexOf0007 1712 * @tc.desc : Test the function of the interface PrototypeIndexOf 1713 * @tc.size : MediumTest 1714 * @tc.type : Function 1715 * @tc.level : Level 1 1716 */ 1717 it('testPrototypeIndexOf0007', 0, () => { 1718 const TAG = "testPrototypeIndexOf0007"; 1719 try { 1720 const array = ['apple', 'banana', 'cat']; 1721 const result = array.indexOf('1'); 1722 console.log(`${TAG} result:` + result); 1723 expect(result).assertEqual(-1); 1724 } catch (err) { 1725 console.error(`${TAG} failed, error: ${err.message}`); 1726 expect().assertFail(); 1727 } 1728 }) 1729 /** 1730 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8700 1731 * @tc.name : testPrototypeIndexOf0008 1732 * @tc.desc : Test the function of the interface PrototypeIndexOf 1733 * @tc.size : MediumTest 1734 * @tc.type : Function 1735 * @tc.level : Level 1 1736 */ 1737 it('testPrototypeIndexOf0008', 0, () => { 1738 const TAG = "testPrototypeIndexOf0008"; 1739 try { 1740 const array = ['apple', 'banana', 'cat']; 1741 const result = array.indexOf('apple'); 1742 console.log(`${TAG} result:` + result); 1743 expect(result).assertEqual(0); 1744 } catch (err) { 1745 console.error(`${TAG} failed, error: ${err.message}`); 1746 expect().assertFail(); 1747 } 1748 }) 1749 /** 1750 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8800 1751 * @tc.name : testPrototypeIndexOf0009 1752 * @tc.desc : Test the function of the interface PrototypeIndexOf 1753 * @tc.size : MediumTest 1754 * @tc.type : Function 1755 * @tc.level : Level 1 1756 */ 1757 it('testPrototypeIndexOf0009', 0, () => { 1758 const TAG = "testPrototypeIndexOf0009"; 1759 try { 1760 const array = ['apple', 'banana', 'cat']; 1761 const result = array.indexOf('abc', 2); 1762 console.log(`${TAG} result:` + result); 1763 expect(result).assertEqual(-1); 1764 } catch (err) { 1765 console.error(`${TAG} failed, error: ${err.message}`); 1766 expect().assertFail(); 1767 } 1768 }) 1769 /** 1770 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_8900 1771 * @tc.name : testPrototypeIndexOf0010 1772 * @tc.desc : Test the function of the interface PrototypeIndexOf 1773 * @tc.size : MediumTest 1774 * @tc.type : Function 1775 * @tc.level : Level 1 1776 */ 1777 it('testPrototypeIndexOf0010', 0, () => { 1778 const TAG = "testPrototypeIndexOf0010"; 1779 try { 1780 const array = ['apple', 'banana', 'cat']; 1781 const result = array.indexOf('apple', 0); 1782 console.log(`${TAG} result:` + result); 1783 expect(result).assertEqual(0); 1784 } catch (err) { 1785 console.error(`${TAG} failed, error: ${err.message}`); 1786 expect().assertFail(); 1787 } 1788 }) 1789 /** 1790 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_9000 1791 * @tc.name : testPrototypeIndexOf0011 1792 * @tc.desc : Test the function of the interface PrototypeIndexOf 1793 * @tc.size : MediumTest 1794 * @tc.type : Function 1795 * @tc.level : Level 1 1796 */ 1797 it('testPrototypeIndexOf0011', 0, () => { 1798 const TAG = "testPrototypeIndexOf0011"; 1799 try { 1800 const array = ['apple', 'banana', 'cat']; 1801 const result = array.indexOf('banana', 2); 1802 console.log(`${TAG} result:` + result); 1803 expect(result).assertEqual(-1); 1804 } catch (err) { 1805 console.error(`${TAG} failed, error: ${err.message}`); 1806 expect().assertFail(); 1807 } 1808 }) 1809 /** 1810 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_9100 1811 * @tc.name : testPrototypeJoin0001 1812 * @tc.desc : Test the function of the interface PrototypeJoin 1813 * @tc.size : MediumTest 1814 * @tc.type : Function 1815 * @tc.level : Level 1 1816 */ 1817 it('testPrototypeJoin0001', 0, () => { 1818 const TAG = "testPrototypeJoin0001"; 1819 try { 1820 const array = ["Wind", "Water", "Fire"]; 1821 const result = array.join(); 1822 console.log(`${TAG} result:` + result); 1823 expect(result).assertEqual('Wind,Water,Fire'); 1824 } catch (err) { 1825 console.error(`${TAG} failed, error: ${err.message}`); 1826 expect().assertFail(); 1827 } 1828 }) 1829 /** 1830 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_9200 1831 * @tc.name : testPrototypeJoin0002 1832 * @tc.desc : Test the function of the interface PrototypeJoin 1833 * @tc.size : MediumTest 1834 * @tc.type : Function 1835 * @tc.level : Level 1 1836 */ 1837 it('testPrototypeJoin0002', 0, () => { 1838 const TAG = "testPrototypeJoin0002"; 1839 try { 1840 const array = ["Wind", "Water", "Fire"]; 1841 const result = array.join(", "); 1842 console.log(`${TAG} result:` + result); 1843 expect(result).assertEqual('Wind, Water, Fire'); 1844 } catch (err) { 1845 console.error(`${TAG} failed, error: ${err.message}`); 1846 expect().assertFail(); 1847 } 1848 }) 1849 /** 1850 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_9300 1851 * @tc.name : testPrototypeJoin0003 1852 * @tc.desc : Test the function of the interface PrototypeJoin 1853 * @tc.size : MediumTest 1854 * @tc.type : Function 1855 * @tc.level : Level 1 1856 */ 1857 it('testPrototypeJoin0003', 0, () => { 1858 const TAG = "testPrototypeJoin0003"; 1859 try { 1860 const array = ["Wind", "Water", "Fire"]; 1861 const result = array.join(" + "); 1862 console.log(`${TAG} result:` + result); 1863 expect(result).assertEqual('Wind + Water + Fire'); 1864 } catch (err) { 1865 console.error(`${TAG} failed, error: ${err.message}`); 1866 expect().assertFail(); 1867 } 1868 }) 1869 /** 1870 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_9400 1871 * @tc.name : testPrototypeJoin0004 1872 * @tc.desc : Test the function of the interface PrototypeJoin 1873 * @tc.size : MediumTest 1874 * @tc.type : Function 1875 * @tc.level : Level 1 1876 */ 1877 it('testPrototypeJoin0004', 0, () => { 1878 const TAG = "testPrototypeJoin0004"; 1879 try { 1880 const array = ["Wind", "Water", "Fire"]; 1881 const result = array.join(""); 1882 console.log(`${TAG} result:` + result); 1883 expect(result).assertEqual('WindWaterFire'); 1884 } catch (err) { 1885 console.error(`${TAG} failed, error: ${err.message}`); 1886 expect().assertFail(); 1887 } 1888 }) 1889 /** 1890 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_9500 1891 * @tc.name : testPrototypeJoin0005 1892 * @tc.desc : Test the function of the interface PrototypeJoin 1893 * @tc.size : MediumTest 1894 * @tc.type : Function 1895 * @tc.level : Level 1 1896 */ 1897 it('testPrototypeJoin0005', 0, () => { 1898 const TAG = "testPrototypeJoin0005"; 1899 try { 1900 const array = [1, 2, 3]; 1901 const result = array.join(); 1902 console.log(`${TAG} result:` + result); 1903 expect(result).assertEqual('1,2,3'); 1904 } catch (err) { 1905 console.error(`${TAG} failed, error: ${err.message}`); 1906 expect().assertFail(); 1907 } 1908 }) 1909 /** 1910 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_9600 1911 * @tc.name : testPrototypeJoin0006 1912 * @tc.desc : Test the function of the interface PrototypeJoin 1913 * @tc.size : MediumTest 1914 * @tc.type : Function 1915 * @tc.level : Level 1 1916 */ 1917 it('testPrototypeJoin0006', 0, () => { 1918 const TAG = "testPrototypeJoin0006"; 1919 try { 1920 const array = [1, 2, 3]; 1921 const result = array.join(", "); 1922 console.log(`${TAG} result:` + result); 1923 expect(result).assertEqual('1, 2, 3'); 1924 } catch (err) { 1925 console.error(`${TAG} failed, error: ${err.message}`); 1926 expect().assertFail(); 1927 } 1928 }) 1929 /** 1930 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_97000 1931 * @tc.name : testPrototypeJoin0007 1932 * @tc.desc : Test the function of the interface PrototypeJoin 1933 * @tc.size : MediumTest 1934 * @tc.type : Function 1935 * @tc.level : Level 1 1936 */ 1937 it('testPrototypeJoin0007', 0, () => { 1938 const TAG = "testPrototypeJoin0007"; 1939 try { 1940 const array = [1, 2, 3]; 1941 const result = array.join(" + "); 1942 console.log(`${TAG} result:` + result); 1943 expect(result).assertEqual('1 + 2 + 3'); 1944 } catch (err) { 1945 console.error(`${TAG} failed, error: ${err.message}`); 1946 expect().assertFail(); 1947 } 1948 }) 1949 /** 1950 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_98000 1951 * @tc.name : testPrototypeJoin0008 1952 * @tc.desc : Test the function of the interface PrototypeJoin 1953 * @tc.size : MediumTest 1954 * @tc.type : Function 1955 * @tc.level : Level 1 1956 */ 1957 it('testPrototypeJoin0008', 0, () => { 1958 const TAG = "testPrototypeJoin0008"; 1959 try { 1960 const array = [1, 2, 3]; 1961 const result = array.join(""); 1962 console.log(`${TAG} result:` + result); 1963 expect(result).assertEqual('123'); 1964 } catch (err) { 1965 console.error(`${TAG} failed, error: ${err.message}`); 1966 expect().assertFail(); 1967 } 1968 }) 1969 /** 1970 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_99000 1971 * @tc.name : testPrototypeJoin0009 1972 * @tc.desc : Test the function of the interface PrototypeJoin 1973 * @tc.size : MediumTest 1974 * @tc.type : Function 1975 * @tc.level : Level 1 1976 */ 1977 it('testPrototypeJoin0009', 0, () => { 1978 const TAG = "testPrototypeJoin0009"; 1979 try { 1980 const array = [1, undefined, 3]; 1981 const result = array.join(); 1982 console.log(`${TAG} result:` + result); 1983 expect(result).assertEqual('1,,3'); 1984 } catch (err) { 1985 console.error(`${TAG} failed, error: ${err.message}`); 1986 expect().assertFail(); 1987 } 1988 }) 1989 /** 1990 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_100000 1991 * @tc.name : testPrototypeKeys0001 1992 * @tc.desc : Test the function of the interface PrototypeKeys. 1993 * @tc.size : MediumTest 1994 * @tc.type : Function 1995 * @tc.level : Level 1 1996 */ 1997 it('testPrototypeKeys0001', 0, () => { 1998 const TAG = "testPrototypeKeys0001"; 1999 try { 2000 const arr = ["a", "b", "c"]; 2001 const sparseKeys = Object.keys(arr); 2002 console.log(`${TAG} result:` + JSON.stringify(sparseKeys)); 2003 expect(JSON.stringify(sparseKeys)).assertEqual('["0","1","2"]'); 2004 } catch (err) { 2005 console.error(`${TAG} failed, error: ${err.message}`); 2006 expect().assertFail(); 2007 } 2008 }) 2009 /** 2010 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_101000 2011 * @tc.name : testPrototypeKeys0002 2012 * @tc.desc : Test the function of the interface PrototypeKeys. 2013 * @tc.size : MediumTest 2014 * @tc.type : Function 2015 * @tc.level : Level 1 2016 */ 2017 it('testPrototypeKeys0002', 0, () => { 2018 const TAG = "testPrototypeKeys0002"; 2019 try { 2020 const arr = ["a", "", "c"]; 2021 const sparseKeys = Object.keys(arr); 2022 console.log(`${TAG} result:` + JSON.stringify(sparseKeys)); 2023 expect(JSON.stringify(sparseKeys)).assertEqual('["0","1","2"]'); 2024 } catch (err) { 2025 console.error(`${TAG} failed, error: ${err.message}`); 2026 expect().assertFail(); 2027 } 2028 }) 2029 /** 2030 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_102000 2031 * @tc.name : testPrototypeKeys0003 2032 * @tc.desc : Test the function of the interface PrototypeKeys. 2033 * @tc.size : MediumTest 2034 * @tc.type : Function 2035 * @tc.level : Level 1 2036 */ 2037 it('testPrototypeKeys0003', 0, () => { 2038 const TAG = "testPrototypeKeys0003"; 2039 try { 2040 const arr = ["a", , "c"]; 2041 const sparseKeys = Object.keys(arr); 2042 console.log(`${TAG} result:` + JSON.stringify(sparseKeys)); 2043 expect(JSON.stringify(sparseKeys)).assertEqual('["0","2"]'); 2044 } catch (err) { 2045 console.error(`${TAG} failed, error: ${err.message}`); 2046 expect().assertFail(); 2047 } 2048 }) 2049 /** 2050 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_103000 2051 * @tc.name : testPrototypeKeys0004 2052 * @tc.desc : Test the function of the interface PrototypeKeys. 2053 * @tc.size : MediumTest 2054 * @tc.type : Function 2055 * @tc.level : Level 1 2056 */ 2057 it('testPrototypeKeys0004', 0, () => { 2058 const TAG = "testPrototypeKeys0004"; 2059 try { 2060 const arr = ["a", undefined, "c"]; 2061 const sparseKeys = Object.keys(arr); 2062 console.log(`${TAG} result:` + JSON.stringify(sparseKeys)); 2063 expect(JSON.stringify(sparseKeys)).assertEqual('["0","1","2"]'); 2064 } catch (err) { 2065 console.error(`${TAG} failed, error: ${err.message}`); 2066 expect().assertFail(); 2067 } 2068 }) 2069 /** 2070 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_104000 2071 * @tc.name : testPrototypeLastIndexOf0001 2072 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2073 * @tc.size : MediumTest 2074 * @tc.type : Function 2075 * @tc.level : Level 1 2076 */ 2077 it('testPrototypeLastIndexOf0001', 0, () => { 2078 const TAG = "testPrototypeLastIndexOf0001"; 2079 try { 2080 const numbers = [2, 5, 9, 2]; 2081 const result = numbers.lastIndexOf(2); 2082 console.log(`${TAG} result:` + result); 2083 expect(result).assertEqual(3); 2084 } catch (err) { 2085 console.error(`${TAG} failed, error: ${err.message}`); 2086 expect().assertFail(); 2087 } 2088 }) 2089 /** 2090 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_105000 2091 * @tc.name : testPrototypeLastIndexOf0002 2092 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2093 * @tc.size : MediumTest 2094 * @tc.type : Function 2095 * @tc.level : Level 1 2096 */ 2097 it('testPrototypeLastIndexOf0002', 0, () => { 2098 const TAG = "testPrototypeLastIndexOf0002"; 2099 try { 2100 const numbers = [2, 5, 9, 2]; 2101 const result = numbers.lastIndexOf(2.5); 2102 console.log(`${TAG} result:` + result); 2103 expect(result).assertEqual(-1); 2104 } catch (err) { 2105 console.error(`${TAG} failed, error: ${err.message}`); 2106 expect().assertFail(); 2107 } 2108 }) 2109 /** 2110 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_106000 2111 * @tc.name : testPrototypeLastIndexOf0003 2112 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2113 * @tc.size : MediumTest 2114 * @tc.type : Function 2115 * @tc.level : Level 1 2116 */ 2117 it('testPrototypeLastIndexOf0003', 0, () => { 2118 const TAG = "testPrototypeLastIndexOf0003"; 2119 try { 2120 const numbers = [2, 5, 9, 2]; 2121 const result = numbers.lastIndexOf(7); 2122 console.log(`${TAG} result:` + result); 2123 expect(result).assertEqual(-1); 2124 } catch (err) { 2125 console.error(`${TAG} failed, error: ${err.message}`); 2126 expect().assertFail(); 2127 } 2128 }) 2129 /** 2130 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_107000 2131 * @tc.name : testPrototypeLastIndexOf0004 2132 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2133 * @tc.size : MediumTest 2134 * @tc.type : Function 2135 * @tc.level : Level 1 2136 */ 2137 it('testPrototypeLastIndexOf0004', 0, () => { 2138 const TAG = "testPrototypeLastIndexOf0004"; 2139 try { 2140 const numbers = [2, 5, 9, 2]; 2141 const result = numbers.lastIndexOf(2, 3); 2142 console.log(`${TAG} result:` + result); 2143 expect(result).assertEqual(3); 2144 } catch (err) { 2145 console.error(`${TAG} failed, error: ${err.message}`); 2146 expect().assertFail(); 2147 } 2148 }) 2149 /** 2150 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_108000 2151 * @tc.name : testPrototypeLastIndexOf0005 2152 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2153 * @tc.size : MediumTest 2154 * @tc.type : Function 2155 * @tc.level : Level 1 2156 */ 2157 it('testPrototypeLastIndexOf0005', 0, () => { 2158 const TAG = "testPrototypeLastIndexOf0005"; 2159 try { 2160 const numbers = [2, 5, 9, 2]; 2161 const result = numbers.lastIndexOf(2, 2); 2162 console.log(`${TAG} result:` + result); 2163 expect(result).assertEqual(0); 2164 } catch (err) { 2165 console.error(`${TAG} failed, error: ${err.message}`); 2166 expect().assertFail(); 2167 } 2168 }) 2169 /** 2170 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_109000 2171 * @tc.name : testPrototypeLastIndexOf0006 2172 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2173 * @tc.size : MediumTest 2174 * @tc.type : Function 2175 * @tc.level : Level 1 2176 */ 2177 it('testPrototypeLastIndexOf0006', 0, () => { 2178 const TAG = "testPrototypeLastIndexOf0006"; 2179 try { 2180 const numbers = [2, 5, 9, 2]; 2181 const result = numbers.lastIndexOf(2, -2); 2182 console.log(`${TAG} result:` + result); 2183 expect(result).assertEqual(0); 2184 } catch (err) { 2185 console.error(`${TAG} failed, error: ${err.message}`); 2186 expect().assertFail(); 2187 } 2188 }) 2189 /** 2190 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_111000 2191 * @tc.name : testPrototypeLastIndexOf0008 2192 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2193 * @tc.size : MediumTest 2194 * @tc.type : Function 2195 * @tc.level : Level 1 2196 */ 2197 it('testPrototypeLastIndexOf0008', 0, () => { 2198 const TAG = "testPrototypeLastIndexOf0008"; 2199 try { 2200 const numbers = [2, 5, 9, 2]; 2201 const result = numbers.lastIndexOf(-1); 2202 console.log(`${TAG} result:` + result); 2203 expect(result).assertEqual(-1); 2204 } catch (err) { 2205 console.error(`${TAG} failed, error: ${err.message}`); 2206 expect().assertFail(); 2207 } 2208 }) 2209 /** 2210 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_112000 2211 * @tc.name : testPrototypeLastIndexOf0009 2212 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2213 * @tc.size : MediumTest 2214 * @tc.type : Function 2215 * @tc.level : Level 1 2216 */ 2217 it('testPrototypeLastIndexOf0009', 0, () => { 2218 const TAG = "testPrototypeLastIndexOf0009"; 2219 try { 2220 const numbers = [2, 5, 9, 2]; 2221 const result = numbers.lastIndexOf(500); 2222 console.log(`${TAG} result:` + result); 2223 expect(result).assertEqual(-1); 2224 } catch (err) { 2225 console.error(`${TAG} failed, error: ${err.message}`); 2226 expect().assertFail(); 2227 } 2228 }) 2229 /** 2230 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_113000 2231 * @tc.name : testPrototypeLastIndexOf0010 2232 * @tc.desc : Test the function of the interface PrototypeLastIndexOf. 2233 * @tc.size : MediumTest 2234 * @tc.type : Function 2235 * @tc.level : Level 1 2236 */ 2237 it('testPrototypeLastIndexOf0010', 0, () => { 2238 const TAG = "testPrototypeLastIndexOf0010"; 2239 try { 2240 const numbers = [2, 5, 9, 2]; 2241 const result = numbers.lastIndexOf(NaN); 2242 console.log(`${TAG} result:` + result); 2243 expect(result).assertEqual(-1); 2244 } catch (err) { 2245 console.error(`${TAG} failed, error: ${err.message}`); 2246 expect().assertFail(); 2247 } 2248 }) 2249 /** 2250 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_114000 2251 * @tc.name : testPrototypeMap0001 2252 * @tc.desc : Test the function of the interface PrototypeMap. 2253 * @tc.size : MediumTest 2254 * @tc.type : Function 2255 * @tc.level : Level 1 2256 */ 2257 it('testPrototypeMap0001', 0, () => { 2258 const TAG = "testPrototypeMap0001"; 2259 try { 2260 const numbers = [1, 4, 9]; 2261 const roots = numbers.map((num) => Math.sqrt(num)); 2262 console.log(`${TAG} result:` + JSON.stringify(roots)); 2263 expect(JSON.stringify(roots)).assertEqual('[1,2,3]'); 2264 } catch (err) { 2265 console.error(`${TAG} failed, error: ${err.message}`); 2266 expect().assertFail(); 2267 } 2268 }) 2269 /** 2270 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_115000 2271 * @tc.name : testPrototypeMap0002 2272 * @tc.desc : Test the function of the interface PrototypeMap. 2273 * @tc.size : MediumTest 2274 * @tc.type : Function 2275 * @tc.level : Level 1 2276 */ 2277 it('testPrototypeMap0002', 0, () => { 2278 const TAG = "testPrototypeMap0002"; 2279 try { 2280 let roots = ["1", "2", "3"].map(parseInt); 2281 let value = JSON.stringify(roots); 2282 console.log(`${TAG} result:` + value); 2283 expect(value).assertEqual('[1,null,null]'); 2284 } catch (err) { 2285 console.error(`${TAG} failed, error: ${err.message}`); 2286 expect().assertFail(); 2287 } 2288 }) 2289 /** 2290 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_116000 2291 * @tc.name : testPrototypeMap0003 2292 * @tc.desc : Test the function of the interface PrototypeMap. 2293 * @tc.size : MediumTest 2294 * @tc.type : Function 2295 * @tc.level : Level 1 2296 */ 2297 it('testPrototypeMap0003', 0, () => { 2298 const TAG = "testPrototypeMap0003"; 2299 try { 2300 const strings = ["10", "10", "10"]; 2301 const obj = strings.map(parseInt); 2302 console.log(`${TAG} result:` + JSON.stringify(obj)); 2303 expect(JSON.stringify(obj)).assertEqual('[10,null,2]'); 2304 } catch (err) { 2305 console.error(`${TAG} failed, error: ${err.message}`); 2306 expect().assertFail(); 2307 } 2308 }) 2309 /** 2310 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_117000 2311 * @tc.name : testPrototypePop0001 2312 * @tc.desc : Test the function of the interface PrototypePop. 2313 * @tc.size : MediumTest 2314 * @tc.type : Function 2315 * @tc.level : Level 1 2316 */ 2317 it('testPrototypePop0001', 0, () => { 2318 const TAG = "testPrototypePop0001"; 2319 try { 2320 const myFish = ["app", "banana", "cat", "duck"]; 2321 const popped = myFish.pop(); 2322 console.log(`${TAG} result:` + popped + `, length:` + popped?.length); 2323 expect(popped).assertEqual("duck"); 2324 expect(popped?.length).assertEqual(4); 2325 } catch (err) { 2326 console.error(`${TAG} failed, error: ${err.message}`); 2327 expect().assertFail(); 2328 } 2329 }) 2330 /** 2331 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_118000 2332 * @tc.name : testPrototypePop0002 2333 * @tc.desc : Test the function of the interface PrototypePop. 2334 * @tc.size : MediumTest 2335 * @tc.type : Function 2336 * @tc.level : Level 1 2337 */ 2338 it('testPrototypePop0002', 0, () => { 2339 const TAG = "testPrototypePop0002"; 2340 try { 2341 const myFish = ["app", , "cat", "duck"]; 2342 const popped = myFish.pop(); 2343 console.log(`${TAG} result:` + popped + `, length:` + popped?.length); 2344 expect(popped).assertEqual("duck"); 2345 expect(popped?.length).assertEqual(4); 2346 } catch (err) { 2347 console.error(`${TAG} failed, error: ${err.message}`); 2348 expect().assertFail(); 2349 } 2350 }) 2351 /** 2352 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_119000 2353 * @tc.name : testPrototypePop0003 2354 * @tc.desc : Test the function of the interface PrototypePop. 2355 * @tc.size : MediumTest 2356 * @tc.type : Function 2357 * @tc.level : Level 1 2358 */ 2359 it('testPrototypePop0003', 0, () => { 2360 const TAG = "testPrototypePop0003"; 2361 try { 2362 const myFish = ["app", "", "cat", "duck"]; 2363 const popped = myFish.pop(); 2364 console.log(`${TAG} result:` + popped + `, length:` + popped?.length); 2365 expect(popped).assertEqual("duck"); 2366 expect(popped?.length).assertEqual(4); 2367 } catch (err) { 2368 console.error(`${TAG} failed, error: ${err.message}`); 2369 expect().assertFail(); 2370 } 2371 }) 2372 /** 2373 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_120000 2374 * @tc.name : testPrototypePop0004 2375 * @tc.desc : Test the function of the interface PrototypePop. 2376 * @tc.size : MediumTest 2377 * @tc.type : Function 2378 * @tc.level : Level 1 2379 */ 2380 it('testPrototypePop0004', 0, () => { 2381 const TAG = "testPrototypePop0004"; 2382 try { 2383 const myFish = ["app", "banana", "cat", ""]; 2384 const popped = myFish.pop(); 2385 console.log(`${TAG} result:` + popped + `, length:` + popped?.length); 2386 expect(popped).assertEqual(""); 2387 expect(popped?.length).assertEqual(0); 2388 } catch (err) { 2389 console.error(`${TAG} failed, error: ${err.message}`); 2390 expect().assertFail(); 2391 } 2392 }) 2393 /** 2394 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_121000 2395 * @tc.name : testPrototypePop0005 2396 * @tc.desc : Test the function of the interface PrototypePop. 2397 * @tc.size : MediumTest 2398 * @tc.type : Function 2399 * @tc.level : Level 1 2400 */ 2401 it('testPrototypePop0005', 0, () => { 2402 const TAG = "testPrototypePop0005"; 2403 try { 2404 const myFish = ["app", "banana", "cat", undefined]; 2405 const popped = myFish.pop(); 2406 console.log(`${TAG} result:` + popped + `, length:` + popped?.length); 2407 expect(popped).assertEqual(undefined); 2408 expect(popped?.length).assertEqual(undefined); 2409 } catch (err) { 2410 console.error(`${TAG} failed, error: ${err.message}`); 2411 expect().assertFail(); 2412 } 2413 }) 2414 /** 2415 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_122000 2416 * @tc.name : testPrototypePush0001 2417 * @tc.desc : Test the function of the interface PrototypePush. 2418 * @tc.size : MediumTest 2419 * @tc.type : Function 2420 * @tc.level : Level 1 2421 */ 2422 it('testPrototypePush0001', 0, () => { 2423 const TAG = "testPrototypePush0001"; 2424 try { 2425 const sports = ["soccer", "baseball"]; 2426 const total = sports.push("football", "swimming"); 2427 console.log(`${TAG} result:` + JSON.stringify(sports) + `, length:` + total); 2428 expect(JSON.stringify(sports)).assertEqual('["soccer","baseball","football","swimming"]'); 2429 expect(total).assertEqual(4); 2430 } catch (err) { 2431 console.error(`${TAG} failed, error: ${err.message}`); 2432 expect().assertFail(); 2433 } 2434 }) 2435 /** 2436 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_123000 2437 * @tc.name : testPrototypePush0002 2438 * @tc.desc : Test the function of the interface PrototypePush. 2439 * @tc.size : MediumTest 2440 * @tc.type : Function 2441 * @tc.level : Level 1 2442 */ 2443 it('testPrototypePush0002', 0, () => { 2444 const TAG = "testPrototypePush0002"; 2445 try { 2446 const sports = ["soccer", "baseball"]; 2447 const total = sports.push(""); 2448 console.log(`${TAG} result:` + JSON.stringify(sports) + `, length:` + total); 2449 expect(JSON.stringify(sports)).assertEqual('["soccer","baseball",""]'); 2450 expect(total).assertEqual(3); 2451 } catch (err) { 2452 console.error(`${TAG} failed, error: ${err.message}`); 2453 expect().assertFail(); 2454 } 2455 }) 2456 /** 2457 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_124000 2458 * @tc.name : testPrototypeReduce0001 2459 * @tc.desc : Test the function of the interface PrototypeReduce. 2460 * @tc.size : MediumTest 2461 * @tc.type : Function 2462 * @tc.level : Level 1 2463 */ 2464 it('testPrototypeReduce0001', 0, () => { 2465 const TAG = "testPrototypeReduce0001"; 2466 try { 2467 const flattened = [ 2468 [0, 1], 2469 [2, 3], 2470 [4, 5], 2471 ].reduce((accumulator, currentValue) => accumulator.concat(currentValue), []); 2472 console.log(`${TAG} result:` + JSON.stringify(flattened)); 2473 expect(JSON.stringify(flattened)).assertEqual('[0,1,2,3,4,5]'); 2474 } catch (err) { 2475 console.error(`${TAG} failed, error: ${err.message}`); 2476 expect().assertFail(); 2477 } 2478 }) 2479 /** 2480 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_125000 2481 * @tc.name : testPrototypeReduceRight0001 2482 * @tc.desc : Test the function of the interface PrototypeReduceRight. 2483 * @tc.size : MediumTest 2484 * @tc.type : Function 2485 * @tc.level : Level 1 2486 */ 2487 it('testPrototypeReduceRight0001', 0, () => { 2488 const TAG = "testPrototypeReduceRight0001"; 2489 try { 2490 const array1 = [ 2491 [0, 1], 2492 [2, 3], 2493 [4, 5], 2494 ]; 2495 const result = array1.reduceRight((accumulator, currentValue) => 2496 2497 accumulator.concat(currentValue), 2498 2499 ); 2500 console.log(`${TAG} result:` + JSON.stringify(result)); 2501 2502 expect(JSON.stringify(result)).assertEqual('[4,5,2,3,0,1]'); 2503 } catch (err) { 2504 console.error(`${TAG} failed, error: ${err.message}`); 2505 expect().assertFail(); 2506 } 2507 }) 2508 /** 2509 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_126000 2510 * @tc.name : testPrototypeReduceRight0002 2511 * @tc.desc : Test the function of the interface PrototypeReduceRight. 2512 * @tc.size : MediumTest 2513 * @tc.type : Function 2514 * @tc.level : Level 1 2515 */ 2516 it('testPrototypeReduceRight0002', 0, () => { 2517 const TAG = "testPrototypeReduceRight0002"; 2518 try { 2519 const sum = [0, 1, 2, 3].reduceRight((a, b) => a + b); 2520 console.log(`${TAG} result:` + sum); 2521 expect(sum).assertEqual(6); 2522 } catch (err) { 2523 console.error(`${TAG} failed, error: ${err.message}`); 2524 expect().assertFail(); 2525 } 2526 }) 2527 /** 2528 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_127000 2529 * @tc.name : testPrototypeReverse0001 2530 * @tc.desc : Test the function of the interface PrototypeReverse. 2531 * @tc.size : MediumTest 2532 * @tc.type : Function 2533 * @tc.level : Level 1 2534 */ 2535 it('testPrototypeReverse0001', 0, () => { 2536 const TAG = "testPrototypeReverse0001"; 2537 try { 2538 const items = [1, 2, 3]; 2539 const result = items.reverse(); 2540 expect(JSON.stringify(result)).assertEqual('[3,2,1]'); 2541 } catch (err) { 2542 console.error(`${TAG} failed, error: ${err.message}`); 2543 expect().assertFail(); 2544 } 2545 }) 2546 /** 2547 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_128000 2548 * @tc.name : testPrototypeReverse0002 2549 * @tc.desc : Test the function of the interface PrototypeReverse. 2550 * @tc.size : MediumTest 2551 * @tc.type : Function 2552 * @tc.level : Level 1 2553 */ 2554 it('testPrototypeReverse0002', 0, () => { 2555 const TAG = "testPrototypeReverse0002"; 2556 try { 2557 const items = [1, 2, undefined]; 2558 const result = items.reverse(); 2559 expect(JSON.stringify(result)).assertEqual('[null,2,1]'); 2560 } catch (err) { 2561 console.error(`${TAG} failed, error: ${err.message}`); 2562 expect().assertFail(); 2563 } 2564 }) 2565 /** 2566 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_129000 2567 * @tc.name : testPrototypeReverse0003 2568 * @tc.desc : Test the function of the interface PrototypeReverse. 2569 * @tc.size : MediumTest 2570 * @tc.type : Function 2571 * @tc.level : Level 1 2572 */ 2573 it('testPrototypeReverse0003', 0, () => { 2574 const TAG = "testPrototypeReverse0003"; 2575 try { 2576 const items = [1, , 3]; 2577 const result = items.reverse(); 2578 expect(JSON.stringify(result)).assertEqual('[3,null,1]'); 2579 } catch (err) { 2580 console.error(`${TAG} failed, error: ${err.message}`); 2581 expect().assertFail(); 2582 } 2583 }) 2584 /** 2585 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_130000 2586 * @tc.name : testPrototypeShift0001 2587 * @tc.desc : Test the function of the interface PrototypeShift. 2588 * @tc.size : MediumTest 2589 * @tc.type : Function 2590 * @tc.level : Level 1 2591 */ 2592 it('testPrototypeShift0001', 0, () => { 2593 const TAG = "testPrototypeShift0001"; 2594 try { 2595 const array1 = [1, 2, 3]; 2596 const result = array1.shift(); 2597 console.log(`${TAG} result:` + JSON.stringify(array1) + `, value:` + result); 2598 expect(JSON.stringify(array1)).assertEqual('[2,3]'); 2599 expect(result).assertEqual(1); 2600 } catch (err) { 2601 console.error(`${TAG} failed, error: ${err.message}`); 2602 expect().assertFail(); 2603 } 2604 }) 2605 /** 2606 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_131000 2607 * @tc.name : testPrototypeShift0002 2608 * @tc.desc : Test the function of the interface PrototypeShift. 2609 * @tc.size : MediumTest 2610 * @tc.type : Function 2611 * @tc.level : Level 1 2612 */ 2613 it('testPrototypeShift0002', 0, () => { 2614 const TAG = "testPrototypeShift0002"; 2615 try { 2616 const array1 = [null, 2, 3]; 2617 const result = array1.shift(); 2618 console.log(`${TAG} result:` + JSON.stringify(array1) + `, value:` + result); 2619 expect(JSON.stringify(array1)).assertEqual('[2,3]'); 2620 expect(result).assertEqual(null); 2621 } catch (err) { 2622 console.error(`${TAG} failed, error: ${err.message}`); 2623 expect().assertFail(); 2624 } 2625 }) 2626 /** 2627 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_132000 2628 * @tc.name : testPrototypeShift0003 2629 * @tc.desc : Test the function of the interface PrototypeShift. 2630 * @tc.size : MediumTest 2631 * @tc.type : Function 2632 * @tc.level : Level 1 2633 */ 2634 it('testPrototypeShift0003', 0, () => { 2635 const TAG = "testPrototypeShift0003"; 2636 try { 2637 const array1 = [1, null, 3]; 2638 const firstElement = array1.shift(); 2639 console.log(`${TAG} result:` + JSON.stringify(array1) + `, value:` + firstElement); 2640 expect(JSON.stringify(array1)).assertEqual('[null,3]'); 2641 expect(firstElement).assertEqual(1); 2642 } catch (err) { 2643 console.error(`${TAG} failed, error: ${err.message}`); 2644 expect().assertFail(); 2645 } 2646 }) 2647 /** 2648 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_133000 2649 * @tc.name : testPrototypeShift0004 2650 * @tc.desc : Test the function of the interface PrototypeShift. 2651 * @tc.size : MediumTest 2652 * @tc.type : Function 2653 * @tc.level : Level 1 2654 */ 2655 it('testPrototypeShift0004', 0, () => { 2656 const TAG = "testPrototypeShift0004"; 2657 try { 2658 const array1 = [null]; 2659 const firstElement = array1.shift(); 2660 console.log(`${TAG} result:` + JSON.stringify(array1) + `, value:` + firstElement); 2661 expect(JSON.stringify(array1)).assertEqual('[]'); 2662 expect(firstElement).assertEqual(null); 2663 } catch (err) { 2664 console.error(`${TAG} failed, error: ${err.message}`); 2665 expect().assertFail(); 2666 } 2667 }) 2668 /** 2669 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_134000 2670 * @tc.name : testPrototypeShift0005 2671 * @tc.desc : Test the function of the interface PrototypeShift. 2672 * @tc.size : MediumTest 2673 * @tc.type : Function 2674 * @tc.level : Level 1 2675 */ 2676 it('testPrototypeShift0005', 0, () => { 2677 const TAG = "testPrototypeShift0005"; 2678 try { 2679 const array1 = []; 2680 const firstElement = array1.shift(); 2681 console.log(`${TAG} result:` + JSON.stringify(array1) + `, value:` + firstElement); 2682 expect(JSON.stringify(array1)).assertEqual('[]'); 2683 expect(firstElement).assertEqual(undefined); 2684 } catch (err) { 2685 console.error(`${TAG} failed, error: ${err.message}`); 2686 expect().assertFail(); 2687 } 2688 }) 2689 /** 2690 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_135000 2691 * @tc.name : testPrototypeShift0006 2692 * @tc.desc : Test the function of the interface PrototypeShift. 2693 * @tc.size : MediumTest 2694 * @tc.type : Function 2695 * @tc.level : Level 1 2696 */ 2697 it('testPrototypeShift0006', 0, () => { 2698 const TAG = "testPrototypeShift0006"; 2699 try { 2700 const array1 = [undefined]; 2701 const firstElement = array1.shift(); 2702 console.log(`${TAG} result:` + JSON.stringify(array1) + `, value:` + firstElement); 2703 expect(JSON.stringify(array1)).assertEqual('[]'); 2704 expect(firstElement).assertEqual(undefined); 2705 } catch (err) { 2706 console.error(`${TAG} failed, error: ${err.message}`); 2707 expect().assertFail(); 2708 } 2709 }) 2710 /** 2711 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_136000 2712 * @tc.name : testPrototypeSlice0001 2713 * @tc.desc : Test the function of the interface PrototypeSlice. 2714 * @tc.size : MediumTest 2715 * @tc.type : Function 2716 * @tc.level : Level 1 2717 */ 2718 it('testPrototypeSlice0001', 0, () => { 2719 const TAG = "testPrototypeSlice0001"; 2720 try { 2721 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2722 const result = fruits.slice(0); 2723 expect(JSON.stringify(result)).assertEqual('["Banana","Orange","Lemon","Apple","Mango"]'); 2724 } catch (err) { 2725 console.error(`${TAG} failed, error: ${err.message}`); 2726 expect().assertFail(); 2727 } 2728 }) 2729 /** 2730 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_137000 2731 * @tc.name : testPrototypeSlice0002 2732 * @tc.desc : Test the function of the interface PrototypeSlice. 2733 * @tc.size : MediumTest 2734 * @tc.type : Function 2735 * @tc.level : Level 1 2736 */ 2737 it('testPrototypeSlice0002', 0, () => { 2738 const TAG = "testPrototypeSlice0002"; 2739 try { 2740 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2741 const result = fruits.slice(1); 2742 expect(JSON.stringify(result)).assertEqual('["Orange","Lemon","Apple","Mango"]'); 2743 } catch (err) { 2744 console.error(`${TAG} failed, error: ${err.message}`); 2745 expect().assertFail(); 2746 } 2747 }) 2748 /** 2749 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_138000 2750 * @tc.name : testPrototypeSlice0003 2751 * @tc.desc : Test the function of the interface PrototypeSlice. 2752 * @tc.size : MediumTest 2753 * @tc.type : Function 2754 * @tc.level : Level 1 2755 */ 2756 it('testPrototypeSlice0003', 0, () => { 2757 const TAG = "testPrototypeSlice0003"; 2758 try { 2759 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2760 const result = fruits.slice(6); 2761 expect(JSON.stringify(result)).assertEqual('[]'); 2762 } catch (err) { 2763 console.error(`${TAG} failed, error: ${err.message}`); 2764 expect().assertFail(); 2765 } 2766 }) 2767 /** 2768 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_139000 2769 * @tc.name : testPrototypeSlice0004 2770 * @tc.desc : Test the function of the interface PrototypeSlice. 2771 * @tc.size : MediumTest 2772 * @tc.type : Function 2773 * @tc.level : Level 1 2774 */ 2775 it('testPrototypeSlice0004', 0, () => { 2776 const TAG = "testPrototypeSlice0004"; 2777 try { 2778 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2779 const result = fruits.slice(-1); 2780 expect(JSON.stringify(result)).assertEqual('["Mango"]'); 2781 } catch (err) { 2782 console.error(`${TAG} failed, error: ${err.message}`); 2783 expect().assertFail(); 2784 } 2785 }) 2786 /** 2787 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_140000 2788 * @tc.name : testPrototypeSlice0005 2789 * @tc.desc : Test the function of the interface PrototypeSlice. 2790 * @tc.size : MediumTest 2791 * @tc.type : Function 2792 * @tc.level : Level 1 2793 */ 2794 it('testPrototypeSlice0005', 0, () => { 2795 const TAG = "testPrototypeSlice0005"; 2796 try { 2797 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2798 const result = fruits.slice(2, 4); 2799 expect(JSON.stringify(result)).assertEqual('["Lemon","Apple"]'); 2800 } catch (err) { 2801 console.error(`${TAG} failed, error: ${err.message}`); 2802 expect().assertFail(); 2803 } 2804 }) 2805 /** 2806 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_141000 2807 * @tc.name : testPrototypeSlice0006 2808 * @tc.desc : Test the function of the interface PrototypeSlice. 2809 * @tc.size : MediumTest 2810 * @tc.type : Function 2811 * @tc.level : Level 1 2812 */ 2813 it('testPrototypeSlice0006', 0, () => { 2814 const TAG = "testPrototypeSlice0006"; 2815 try { 2816 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2817 const result = fruits.slice(1, 5); 2818 expect(JSON.stringify(result)).assertEqual('["Orange","Lemon","Apple","Mango"]'); 2819 } catch (err) { 2820 console.error(`${TAG} failed, error: ${err.message}`); 2821 expect().assertFail(); 2822 } 2823 }) 2824 /** 2825 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_142000 2826 * @tc.name : testPrototypeSlice0007 2827 * @tc.desc : Test the function of the interface PrototypeSlice. 2828 * @tc.size : MediumTest 2829 * @tc.type : Function 2830 * @tc.level : Level 1 2831 */ 2832 it('testPrototypeSlice0007', 0, () => { 2833 const TAG = "testPrototypeSlice0007"; 2834 try { 2835 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2836 const result = fruits.slice(2, -1); 2837 expect(JSON.stringify(result)).assertEqual('["Lemon","Apple"]'); 2838 } catch (err) { 2839 console.error(`${TAG} failed, error: ${err.message}`); 2840 expect().assertFail(); 2841 } 2842 }) 2843 /** 2844 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_143000 2845 * @tc.name : testPrototypeSlice0008 2846 * @tc.desc : Test the function of the interface PrototypeSlice. 2847 * @tc.size : MediumTest 2848 * @tc.type : Function 2849 * @tc.level : Level 1 2850 */ 2851 it('testPrototypeSlice0008', 0, () => { 2852 const TAG = "testPrototypeSlice0008"; 2853 try { 2854 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2855 const result = fruits.slice(); 2856 expect(JSON.stringify(result)).assertEqual('["Banana","Orange","Lemon","Apple","Mango"]'); 2857 } catch (err) { 2858 console.error(`${TAG} failed, error: ${err.message}`); 2859 expect().assertFail(); 2860 } 2861 }) 2862 /** 2863 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_144000 2864 * @tc.name : testPrototypeSlice0009 2865 * @tc.desc : Test the function of the interface PrototypeSlice. 2866 * @tc.size : MediumTest 2867 * @tc.type : Function 2868 * @tc.level : Level 1 2869 */ 2870 it('testPrototypeSlice0009', 0, () => { 2871 const TAG = "testPrototypeSlice0009"; 2872 try { 2873 const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; 2874 const result = fruits.slice(undefined); 2875 expect(JSON.stringify(result)).assertEqual('["Banana","Orange","Lemon","Apple","Mango"]'); 2876 } catch (err) { 2877 console.error(`${TAG} failed, error: ${err.message}`); 2878 expect().assertFail(); 2879 } 2880 }) 2881 /** 2882 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_145000 2883 * @tc.name : testPrototypeSlice0010 2884 * @tc.desc : Test the function of the interface PrototypeSlice. 2885 * @tc.size : MediumTest 2886 * @tc.type : Function 2887 * @tc.level : Level 1 2888 */ 2889 it('testPrototypeSlice0010', 0, () => { 2890 const TAG = "testPrototypeSlice0010"; 2891 try { 2892 const fruits = ["Banana", "Orange", "", "Apple", "Mango"]; 2893 const result = fruits.slice(1); 2894 expect(JSON.stringify(result)).assertEqual('["Orange","","Apple","Mango"]'); 2895 } catch (err) { 2896 console.error(`${TAG} failed, error: ${err.message}`); 2897 expect().assertFail(); 2898 } 2899 }) 2900 /** 2901 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_146000 2902 * @tc.name : testPrototypeSlice0011 2903 * @tc.desc : Test the function of the interface PrototypeSlice. 2904 * @tc.size : MediumTest 2905 * @tc.type : Function 2906 * @tc.level : Level 1 2907 */ 2908 it('testPrototypeSlice0011', 0, () => { 2909 const TAG = "testPrototypeSlice0011"; 2910 try { 2911 const fruits = ["Banana", "Orange", "", "Apple", "Mango"]; 2912 const result = fruits.slice(2, 4); 2913 expect(JSON.stringify(result)).assertEqual('["","Apple"]'); 2914 } catch (err) { 2915 console.error(`${TAG} failed, error: ${err.message}`); 2916 expect().assertFail(); 2917 } 2918 }) 2919 /** 2920 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_147000 2921 * @tc.name : testPrototypeSlice0012 2922 * @tc.desc : Test the function of the interface PrototypeSlice. 2923 * @tc.size : MediumTest 2924 * @tc.type : Function 2925 * @tc.level : Level 1 2926 */ 2927 it('testPrototypeSlice0012', 0, () => { 2928 const TAG = "testPrototypeSlice0012"; 2929 try { 2930 const fruits = ["Banana", "Orange", "", "Apple", "Mango"]; 2931 const result = fruits.slice(-1); 2932 expect(JSON.stringify(result)).assertEqual('["Mango"]'); 2933 } catch (err) { 2934 console.error(`${TAG} failed, error: ${err.message}`); 2935 expect().assertFail(); 2936 } 2937 }) 2938 /** 2939 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_148000 2940 * @tc.name : testPrototypeSlice0013 2941 * @tc.desc : Test the function of the interface PrototypeSlice. 2942 * @tc.size : MediumTest 2943 * @tc.type : Function 2944 * @tc.level : Level 1 2945 */ 2946 it('testPrototypeSlice0013', 0, () => { 2947 const TAG = "testPrototypeSlice0013"; 2948 try { 2949 const fruits = ["Banana", "Orange", "", "Apple", "Mango"]; 2950 const result = fruits.slice(); 2951 expect(JSON.stringify(result)).assertEqual('["Banana","Orange","","Apple","Mango"]'); 2952 } catch (err) { 2953 console.error(`${TAG} failed, error: ${err.message}`); 2954 expect().assertFail(); 2955 } 2956 }) 2957 /** 2958 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_149000 2959 * @tc.name : testPrototypeSlice0014 2960 * @tc.desc : Test the function of the interface PrototypeSlice. 2961 * @tc.size : MediumTest 2962 * @tc.type : Function 2963 * @tc.level : Level 1 2964 */ 2965 it('testPrototypeSlice0014', 0, () => { 2966 const TAG = "testPrototypeSlice0014"; 2967 try { 2968 const fruits = ["Banana", "Orange", "", "Apple", "Mango"]; 2969 const result = fruits.slice(undefined); 2970 expect(JSON.stringify(result)).assertEqual('["Banana","Orange","","Apple","Mango"]'); 2971 } catch (err) { 2972 console.error(`${TAG} failed, error: ${err.message}`); 2973 expect().assertFail(); 2974 } 2975 }) 2976 /** 2977 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_150000 2978 * @tc.name : testPrototypeSlice0015 2979 * @tc.desc : Test the function of the interface PrototypeSlice. 2980 * @tc.size : MediumTest 2981 * @tc.type : Function 2982 * @tc.level : Level 1 2983 */ 2984 it('testPrototypeSlice0015', 0, () => { 2985 const TAG = "testPrototypeSlice0015"; 2986 try { 2987 const fruits = ["Banana", "Orange", undefined, "Apple", "Mango"]; 2988 const result = fruits.slice(1); 2989 expect(JSON.stringify(result)).assertEqual('["Orange",null,"Apple","Mango"]'); 2990 } catch (err) { 2991 console.error(`${TAG} failed, error: ${err.message}`); 2992 expect().assertFail(); 2993 } 2994 }) 2995 /** 2996 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_151000 2997 * @tc.name : testPrototypeSlice0016 2998 * @tc.desc : Test the function of the interface PrototypeSlice. 2999 * @tc.size : MediumTest 3000 * @tc.type : Function 3001 * @tc.level : Level 1 3002 */ 3003 it('testPrototypeSlice0016', 0, () => { 3004 const TAG = "testPrototypeSlice0016"; 3005 try { 3006 const fruits = ["Banana", "Orange", undefined, "Apple", "Mango"]; 3007 const result = fruits.slice(3, 5); 3008 expect(JSON.stringify(result)).assertEqual('["Apple","Mango"]'); 3009 } catch (err) { 3010 console.error(`${TAG} failed, error: ${err.message}`); 3011 expect().assertFail(); 3012 } 3013 }) 3014 /** 3015 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_152000 3016 * @tc.name : testPrototypeSlice0017 3017 * @tc.desc : Test the function of the interface PrototypeSlice. 3018 * @tc.size : MediumTest 3019 * @tc.type : Function 3020 * @tc.level : Level 1 3021 */ 3022 it('testPrototypeSlice0017', 0, () => { 3023 const TAG = "testPrototypeSlice0017"; 3024 try { 3025 const fruits = ["Banana", "Orange", undefined, "Apple", "Mango"]; 3026 const result = fruits.slice(-2); 3027 expect(JSON.stringify(result)).assertEqual('["Apple","Mango"]'); 3028 } catch (err) { 3029 console.error(`${TAG} failed, error: ${err.message}`); 3030 expect().assertFail(); 3031 } 3032 }) 3033 /** 3034 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_153000 3035 * @tc.name : testPrototypeSlice0018 3036 * @tc.desc : Test the function of the interface PrototypeSlice. 3037 * @tc.size : MediumTest 3038 * @tc.type : Function 3039 * @tc.level : Level 1 3040 */ 3041 it('testPrototypeSlice0018', 0, () => { 3042 const TAG = "testPrototypeSlice0018"; 3043 try { 3044 const fruits = ["Banana", "Orange", undefined, "Apple", "Mango"]; 3045 const result = fruits.slice(); 3046 expect(JSON.stringify(result)).assertEqual('["Banana","Orange",null,"Apple","Mango"]'); 3047 } catch (err) { 3048 console.error(`${TAG} failed, error: ${err.message}`); 3049 expect().assertFail(); 3050 } 3051 }) 3052 /** 3053 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_154000 3054 * @tc.name : testPrototypeSlice0019 3055 * @tc.desc : Test the function of the interface PrototypeSlice. 3056 * @tc.size : MediumTest 3057 * @tc.type : Function 3058 * @tc.level : Level 1 3059 */ 3060 it('testPrototypeSlice0019', 0, () => { 3061 const TAG = "testPrototypeSlice0019"; 3062 try { 3063 const fruits = ["Banana", "Orange", undefined, "Apple", "Mango"]; 3064 const result = fruits.slice(undefined); 3065 expect(JSON.stringify(result)).assertEqual('["Banana","Orange",null,"Apple","Mango"]'); 3066 } catch (err) { 3067 console.error(`${TAG} failed, error: ${err.message}`); 3068 expect().assertFail(); 3069 } 3070 }) 3071 /** 3072 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_155000 3073 * @tc.name : testPrototypeSlice0020 3074 * @tc.desc : Test the function of the interface PrototypeSlice. 3075 * @tc.size : MediumTest 3076 * @tc.type : Function 3077 * @tc.level : Level 1 3078 */ 3079 it('testPrototypeSlice0020', 0, () => { 3080 const TAG = "testPrototypeSlice0020"; 3081 try { 3082 const fruits = [, "Orange", "Lemon", "Apple", "Mango"] 3083 ; 3084 const result = fruits.slice(1); 3085 expect(JSON.stringify(result)).assertEqual('["Orange","Lemon","Apple","Mango"]'); 3086 } catch (err) { 3087 console.error(`${TAG} failed, error: ${err.message}`); 3088 expect().assertFail(); 3089 } 3090 }) 3091 /** 3092 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_156000 3093 * @tc.name : testPrototypeSlice0021 3094 * @tc.desc : Test the function of the interface PrototypeSlice. 3095 * @tc.size : MediumTest 3096 * @tc.type : Function 3097 * @tc.level : Level 1 3098 */ 3099 it('testPrototypeSlice0021', 0, () => { 3100 const TAG = "testPrototypeSlice0021"; 3101 try { 3102 const fruits = [, "Orange", "Lemon", "Apple", "Mango"] 3103 ; 3104 const result = fruits.slice(2, 4); 3105 expect(JSON.stringify(result)).assertEqual('["Lemon","Apple"]'); 3106 } catch (err) { 3107 console.error(`${TAG} failed, error: ${err.message}`); 3108 expect().assertFail(); 3109 } 3110 }) 3111 /** 3112 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_157000 3113 * @tc.name : testPrototypeSlice0022 3114 * @tc.desc : Test the function of the interface PrototypeSlice. 3115 * @tc.size : MediumTest 3116 * @tc.type : Function 3117 * @tc.level : Level 1 3118 */ 3119 it('testPrototypeSlice0022', 0, () => { 3120 const TAG = "testPrototypeSlice0022"; 3121 try { 3122 const fruits = [, "Orange", "Lemon", "Apple", "Mango"] 3123 ; 3124 const result = fruits.slice(-1); 3125 expect(JSON.stringify(result)).assertEqual('["Mango"]'); 3126 } catch (err) { 3127 console.error(`${TAG} failed, error: ${err.message}`); 3128 expect().assertFail(); 3129 } 3130 }) 3131 /** 3132 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_158000 3133 * @tc.name : testPrototypeSlice0023 3134 * @tc.desc : Test the function of the interface PrototypeSlice. 3135 * @tc.size : MediumTest 3136 * @tc.type : Function 3137 * @tc.level : Level 1 3138 */ 3139 it('testPrototypeSlice0023', 0, () => { 3140 const TAG = "testPrototypeSlice0023"; 3141 try { 3142 const fruits = [, "Orange", "Lemon", "Apple", "Mango"] 3143 ; 3144 const result = fruits.slice(); 3145 expect(JSON.stringify(result)).assertEqual('[null,"Orange","Lemon","Apple","Mango"]'); 3146 } catch (err) { 3147 console.error(`${TAG} failed, error: ${err.message}`); 3148 expect().assertFail(); 3149 } 3150 }) 3151 /** 3152 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_159000 3153 * @tc.name : testPrototypeSlice0024 3154 * @tc.desc : Test the function of the interface PrototypeSlice. 3155 * @tc.size : MediumTest 3156 * @tc.type : Function 3157 * @tc.level : Level 1 3158 */ 3159 it('testPrototypeSlice0024', 0, () => { 3160 const TAG = "testPrototypeSlice0024"; 3161 try { 3162 const fruits = [, "Orange", "Lemon", "Apple", "Mango"] 3163 ; 3164 const result = fruits.slice(undefined); 3165 expect(JSON.stringify(result)).assertEqual('[null,"Orange","Lemon","Apple","Mango"]'); 3166 } catch (err) { 3167 console.error(`${TAG} failed, error: ${err.message}`); 3168 expect().assertFail(); 3169 } 3170 }) 3171 /** 3172 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_160000 3173 * @tc.name : testPrototypeSome0001 3174 * @tc.desc : Test the function of the interface PrototypeSome. 3175 * @tc.size : MediumTest 3176 * @tc.type : Function 3177 * @tc.level : Level 1 3178 */ 3179 it('testPrototypeSome0001', 0, () => { 3180 const TAG = "testPrototypeSome0001"; 3181 try { 3182 let array = [1, 2, 3] 3183 ; 3184 const result = array.some((x) => x === 1); 3185 console.log(`${TAG} result:` + result); 3186 expect(result).assertEqual(true); 3187 } catch (err) { 3188 console.error(`${TAG} failed, error: ${err.message}`); 3189 expect().assertFail(); 3190 } 3191 }) 3192 /** 3193 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_161000 3194 * @tc.name : testPrototypeSome0002 3195 * @tc.desc : Test the function of the interface PrototypeSome. 3196 * @tc.size : MediumTest 3197 * @tc.type : Function 3198 * @tc.level : Level 1 3199 */ 3200 it('testPrototypeSome0002', 0, () => { 3201 const TAG = "testPrototypeSome0002"; 3202 try { 3203 let array = [1, 2, 3] 3204 ; 3205 const result = array.some((x) => x === -1); 3206 console.log(`${TAG} result:` + result); 3207 expect(result).assertEqual(false); 3208 } catch (err) { 3209 console.error(`${TAG} failed, error: ${err.message}`); 3210 expect().assertFail(); 3211 } 3212 }) 3213 /** 3214 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_162000 3215 * @tc.name : testPrototypeSome0003 3216 * @tc.desc : Test the function of the interface PrototypeSome. 3217 * @tc.size : MediumTest 3218 * @tc.type : Function 3219 * @tc.level : Level 1 3220 */ 3221 it('testPrototypeSome0003', 0, () => { 3222 const TAG = "testPrototypeSome0003"; 3223 try { 3224 let array = [1, 2, 3] 3225 ; 3226 const result = array.some((x) => x === undefined); 3227 console.log(`${TAG} result:` + result); 3228 expect(result).assertEqual(false); 3229 } catch (err) { 3230 console.error(`${TAG} failed, error: ${err.message}`); 3231 expect().assertFail(); 3232 } 3233 }) 3234 /** 3235 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_163000 3236 * @tc.name : testPrototypeSome0004 3237 * @tc.desc : Test the function of the interface PrototypeSome. 3238 * @tc.size : MediumTest 3239 * @tc.type : Function 3240 * @tc.level : Level 1 3241 */ 3242 it('testPrototypeSome0004', 0, () => { 3243 const TAG = "testPrototypeSome0004"; 3244 try { 3245 let array = [1, , 3]; 3246 const result = array.some((x) => x === 1); 3247 console.log(`${TAG} result:` + result); 3248 expect(result).assertEqual(true); 3249 } catch (err) { 3250 console.error(`${TAG} failed, error: ${err.message}`); 3251 expect().assertFail(); 3252 } 3253 }) 3254 /** 3255 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_164000 3256 * @tc.name : testPrototypeSome0005 3257 * @tc.desc : Test the function of the interface PrototypeSome. 3258 * @tc.size : MediumTest 3259 * @tc.type : Function 3260 * @tc.level : Level 1 3261 */ 3262 it('testPrototypeSome0005', 0, () => { 3263 const TAG = "testPrototypeSome0005"; 3264 try { 3265 let array = [1, , 3]; 3266 const result = array.some((x) => x === -2); 3267 console.log(`${TAG} result:` + result); 3268 expect(result).assertEqual(false); 3269 } catch (err) { 3270 console.error(`${TAG} failed, error: ${err.message}`); 3271 expect().assertFail(); 3272 } 3273 }) 3274 /** 3275 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_165000 3276 * @tc.name : testPrototypeSome0006 3277 * @tc.desc : Test the function of the interface PrototypeSome. 3278 * @tc.size : MediumTest 3279 * @tc.type : Function 3280 * @tc.level : Level 1 3281 */ 3282 it('testPrototypeSome0006', 0, () => { 3283 const TAG = "testPrototypeSome0006"; 3284 try { 3285 let array = [1, , 3]; 3286 const result = array.some((x) => x === undefined); 3287 console.log(`${TAG} result:` + result); 3288 expect(result).assertEqual(false); 3289 } catch (err) { 3290 console.error(`${TAG} failed, error: ${err.message}`); 3291 expect().assertFail(); 3292 } 3293 }) 3294 /** 3295 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_166000 3296 * @tc.name : testPrototypeSome0007 3297 * @tc.desc : Test the function of the interface PrototypeSome. 3298 * @tc.size : MediumTest 3299 * @tc.type : Function 3300 * @tc.level : Level 1 3301 */ 3302 it('testPrototypeSome0007', 0, () => { 3303 const TAG = "testPrototypeSome0007"; 3304 try { 3305 let array = [1, '2', 3] 3306 ; 3307 const result = array.some((x) => x === 3); 3308 console.log(`${TAG} result:` + result); 3309 expect(result).assertEqual(true); 3310 } catch (err) { 3311 console.error(`${TAG} failed, error: ${err.message}`); 3312 expect().assertFail(); 3313 } 3314 }) 3315 /** 3316 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_167000 3317 * @tc.name : testPrototypeSome0008 3318 * @tc.desc : Test the function of the interface PrototypeSome. 3319 * @tc.size : MediumTest 3320 * @tc.type : Function 3321 * @tc.level : Level 1 3322 */ 3323 it('testPrototypeSome0008', 0, () => { 3324 const TAG = "testPrototypeSome0008"; 3325 try { 3326 let array = [1, '2', 3] 3327 ; 3328 const result = array.some((x) => x === undefined); 3329 console.log(`${TAG} result:` + result); 3330 expect(result).assertEqual(false); 3331 } catch (err) { 3332 console.error(`${TAG} failed, error: ${err.message}`); 3333 expect().assertFail(); 3334 } 3335 }) 3336 /** 3337 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_168000 3338 * @tc.name : testPrototypeSome0009 3339 * @tc.desc : Test the function of the interface PrototypeSome. 3340 * @tc.size : MediumTest 3341 * @tc.type : Function 3342 * @tc.level : Level 1 3343 */ 3344 it('testPrototypeSome0009', 0, () => { 3345 const TAG = "testPrototypeSome0009"; 3346 try { 3347 let array = [1, '2', 3] 3348 ; 3349 const result = array.some((x) => x === -5); 3350 console.log(`${TAG} result:` + result); 3351 expect(result).assertEqual(false); 3352 } catch (err) { 3353 console.error(`${TAG} failed, error: ${err.message}`); 3354 expect().assertFail(); 3355 } 3356 }) 3357 /** 3358 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_169000 3359 * @tc.name : testPrototypeSome0010 3360 * @tc.desc : Test the function of the interface PrototypeSome. 3361 * @tc.size : MediumTest 3362 * @tc.type : Function 3363 * @tc.level : Level 1 3364 */ 3365 it('testPrototypeSome0010', 0, () => { 3366 const TAG = "testPrototypeSome0010"; 3367 try { 3368 let array = [1, 2, undefined] 3369 ; 3370 const result = array.some((x) => x === 2); 3371 console.log(`${TAG} result:` + result); 3372 expect(result).assertEqual(true); 3373 } catch (err) { 3374 console.error(`${TAG} failed, error: ${err.message}`); 3375 expect().assertFail(); 3376 } 3377 }) 3378 /** 3379 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_170000 3380 * @tc.name : testPrototypeSome0011 3381 * @tc.desc : Test the function of the interface PrototypeSome. 3382 * @tc.size : MediumTest 3383 * @tc.type : Function 3384 * @tc.level : Level 1 3385 */ 3386 it('testPrototypeSome0011', 0, () => { 3387 const TAG = "testPrototypeSome0011"; 3388 try { 3389 let array = [1, 2, undefined] 3390 ; 3391 const result = array.some((x) => x === -10); 3392 console.log(`${TAG} result:` + result); 3393 expect(result).assertEqual(false); 3394 } catch (err) { 3395 console.error(`${TAG} failed, error: ${err.message}`); 3396 expect().assertFail(); 3397 } 3398 }) 3399 /** 3400 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_171000 3401 * @tc.name : testPrototypeSome0012 3402 * @tc.desc : Test the function of the interface PrototypeSome. 3403 * @tc.size : MediumTest 3404 * @tc.type : Function 3405 * @tc.level : Level 1 3406 */ 3407 it('testPrototypeSome0012', 0, () => { 3408 const TAG = "testPrototypeSome0012"; 3409 try { 3410 let array = [1, 2, undefined] 3411 ; 3412 const result = array.some((x) => x === undefined); 3413 console.log(`${TAG} result:` + result); 3414 expect(result).assertEqual(true); 3415 } catch (err) { 3416 console.error(`${TAG} failed, error: ${err.message}`); 3417 expect().assertFail(); 3418 } 3419 }) 3420 /** 3421 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_172000 3422 * @tc.name : testPrototypeSort0001 3423 * @tc.desc : Test the function of the interface PrototypeSome. 3424 * @tc.size : MediumTest 3425 * @tc.type : Function 3426 * @tc.level : Level 1 3427 */ 3428 it('testPrototypeSort0001', 0, () => { 3429 const TAG = "testPrototypeSort0001"; 3430 try { 3431 const value = ['Cat', 'Duck', 'Zoo', 'Apple', 'Desk']; 3432 const result = value.sort(); 3433 expect(JSON.stringify(result)).assertEqual('["Apple","Cat","Desk","Duck","Zoo"]'); 3434 } catch (err) { 3435 console.error(`${TAG} failed, error: ${err.message}`); 3436 expect().assertFail(); 3437 } 3438 }) 3439 /** 3440 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_173000 3441 * @tc.name : testPrototypeSort0002 3442 * @tc.desc : Test the function of the interface PrototypeSome. 3443 * @tc.size : MediumTest 3444 * @tc.type : Function 3445 * @tc.level : Level 1 3446 */ 3447 it('testPrototypeSort0002', 0, () => { 3448 const TAG = "testPrototypeSort0002"; 3449 try { 3450 const value = ['Cat', '', 'Zoo', 'Apple', 'Desk']; 3451 const result = value.sort(); 3452 expect(JSON.stringify(result)).assertEqual('["","Apple","Cat","Desk","Zoo"]'); 3453 } catch (err) { 3454 console.error(`${TAG} failed, error: ${err.message}`); 3455 expect().assertFail(); 3456 } 3457 }) 3458 /** 3459 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_174000 3460 * @tc.name : testPrototypeSort0003 3461 * @tc.desc : Test the function of the interface PrototypeSome. 3462 * @tc.size : MediumTest 3463 * @tc.type : Function 3464 * @tc.level : Level 1 3465 */ 3466 it('testPrototypeSort0003', 0, () => { 3467 const TAG = "testPrototypeSort0003"; 3468 try { 3469 const value = ['Cat', undefined, 'Zoo', 'Apple', 'Desk']; 3470 const result = value.sort(); 3471 expect(JSON.stringify(result)).assertEqual('["Apple","Cat","Desk","Zoo",null]'); 3472 } catch (err) { 3473 console.error(`${TAG} failed, error: ${err.message}`); 3474 expect().assertFail(); 3475 } 3476 }) 3477 /** 3478 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_175000 3479 * @tc.name : testPrototypeSort0004 3480 * @tc.desc : Test the function of the interface PrototypeSome. 3481 * @tc.size : MediumTest 3482 * @tc.type : Function 3483 * @tc.level : Level 1 3484 */ 3485 it('testPrototypeSort0004', 0, () => { 3486 const TAG = "testPrototypeSort0004"; 3487 try { 3488 const value = ['Cat', , 'Zoo', 'Apple', 'Desk']; 3489 const result = value.sort(); 3490 expect(JSON.stringify(result)).assertEqual('["Apple","Cat","Desk","Zoo",null]'); 3491 } catch (err) { 3492 console.error(`${TAG} failed, error: ${err.message}`); 3493 expect().assertFail(); 3494 } 3495 }) 3496 /** 3497 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_176000 3498 * @tc.name : testPrototypeSplice0001 3499 * @tc.desc : Test the function of the interface PrototypeSplice. 3500 * @tc.size : MediumTest 3501 * @tc.type : Function 3502 * @tc.level : Level 1 3503 */ 3504 it('testPrototypeSplice0001', 0, () => { 3505 const TAG = "testPrototypeSplice0001"; 3506 try { 3507 const months = ['Jan', 'March', 'April', 'June']; 3508 months.splice(1, 0, 'Feb'); 3509 console.log(`${TAG} result:` + JSON.stringify(months)); 3510 expect(JSON.stringify(months)).assertEqual('["Jan","Feb","March","April","June"]'); 3511 } catch (err) { 3512 console.error(`${TAG} failed, error: ${err.message}`); 3513 expect().assertFail(); 3514 } 3515 }) 3516 /** 3517 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_177000 3518 * @tc.name : testPrototypeSplice0002 3519 * @tc.desc : Test the function of the interface PrototypeSplice. 3520 * @tc.size : MediumTest 3521 * @tc.type : Function 3522 * @tc.level : Level 1 3523 */ 3524 it('testPrototypeSplice0002', 0, () => { 3525 const TAG = "testPrototypeSplice0002"; 3526 try { 3527 const months = ['Jan', 'March', 'April', 'June']; 3528 months.splice(4, 1, 'May'); 3529 console.log(`${TAG} result:` + JSON.stringify(months)); 3530 expect(JSON.stringify(months)).assertEqual('["Jan","March","April","June","May"]'); 3531 } catch (err) { 3532 console.error(`${TAG} failed, error: ${err.message}`); 3533 expect().assertFail(); 3534 } 3535 }) 3536 /** 3537 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_178000 3538 * @tc.name : testPrototypeSplice0003 3539 * @tc.desc : Test the function of the interface PrototypeSplice. 3540 * @tc.size : MediumTest 3541 * @tc.type : Function 3542 * @tc.level : Level 1 3543 */ 3544 it('testPrototypeSplice0003', 0, () => { 3545 const TAG = "testPrototypeSplice0003"; 3546 try { 3547 const myFish = ["angel", "clown", "mandarin", "sturgeon"]; 3548 myFish.splice(2, 0, "drum"); 3549 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3550 expect(JSON.stringify(myFish)).assertEqual('["angel","clown","drum","mandarin","sturgeon"]'); 3551 } catch (err) { 3552 console.error(`${TAG} failed, error: ${err.message}`); 3553 expect().assertFail(); 3554 } 3555 }) 3556 /** 3557 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_179000 3558 * @tc.name : testPrototypeSplice0004 3559 * @tc.desc : Test the function of the interface PrototypeSplice. 3560 * @tc.size : MediumTest 3561 * @tc.type : Function 3562 * @tc.level : Level 1 3563 */ 3564 it('testPrototypeSplice0004', 0, () => { 3565 const TAG = "testPrototypeSplice0004"; 3566 try { 3567 const myFish = ["angel", "clown", "mandarin", "sturgeon"]; 3568 myFish.splice(2, 0, "drum", "guitar"); 3569 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3570 expect(JSON.stringify(myFish)).assertEqual('["angel","clown","drum","guitar","mandarin","sturgeon"]'); 3571 } catch (err) { 3572 console.error(`${TAG} failed, error: ${err.message}`); 3573 expect().assertFail(); 3574 } 3575 }) 3576 /** 3577 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_180000 3578 * @tc.name : testPrototypeSplice0005 3579 * @tc.desc : Test the function of the interface PrototypeSplice. 3580 * @tc.size : MediumTest 3581 * @tc.type : Function 3582 * @tc.level : Level 1 3583 */ 3584 it('testPrototypeSplice0005', 0, () => { 3585 const TAG = "testPrototypeSplice0005"; 3586 try { 3587 const myFish = ["clown", "mandarin", "sturgeon"] 3588 ; 3589 myFish.splice(0, 0, "angel"); 3590 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3591 expect(JSON.stringify(myFish)).assertEqual('["angel","clown","mandarin","sturgeon"]'); 3592 } catch (err) { 3593 console.error(`${TAG} failed, error: ${err.message}`); 3594 expect().assertFail(); 3595 } 3596 }) 3597 /** 3598 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_181000 3599 * @tc.name : testPrototypeSplice0006 3600 * @tc.desc : Test the function of the interface PrototypeSplice. 3601 * @tc.size : MediumTest 3602 * @tc.type : Function 3603 * @tc.level : Level 1 3604 */ 3605 it('testPrototypeSplice0006', 0, () => { 3606 const TAG = "testPrototypeSplice0006"; 3607 try { 3608 const myFish = ["angel", "clown", "mandarin"]; 3609 myFish.splice(myFish.length, 0, "sturgeon"); 3610 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3611 expect(JSON.stringify(myFish)).assertEqual('["angel","clown","mandarin","sturgeon"]'); 3612 } catch (err) { 3613 console.error(`${TAG} failed, error: ${err.message}`); 3614 expect().assertFail(); 3615 } 3616 }) 3617 /** 3618 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_182000 3619 * @tc.name : testPrototypeSplice0007 3620 * @tc.desc : Test the function of the interface PrototypeSplice. 3621 * @tc.size : MediumTest 3622 * @tc.type : Function 3623 * @tc.level : Level 1 3624 */ 3625 it('testPrototypeSplice0007', 0, () => { 3626 const TAG = "testPrototypeSplice0007"; 3627 try { 3628 const myFish = ["angel", "clown", "drum", "mandarin", "sturgeon"]; 3629 myFish.splice(3, 1); 3630 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3631 expect(JSON.stringify(myFish)).assertEqual('["angel","clown","drum","sturgeon"]'); 3632 } catch (err) { 3633 console.error(`${TAG} failed, error: ${err.message}`); 3634 expect().assertFail(); 3635 } 3636 }) 3637 /** 3638 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_183000 3639 * @tc.name : testPrototypeSplice0008 3640 * @tc.desc : Test the function of the interface PrototypeSplice. 3641 * @tc.size : MediumTest 3642 * @tc.type : Function 3643 * @tc.level : Level 1 3644 */ 3645 it('testPrototypeSplice0008', 0, () => { 3646 const TAG = "testPrototypeSplice0008"; 3647 try { 3648 const myFish = ["angel", "clown", "drum", "sturgeon"]; 3649 myFish.splice(2, 1, "trumpet"); 3650 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3651 expect(JSON.stringify(myFish)).assertEqual('["angel","clown","trumpet","sturgeon"]'); 3652 } catch (err) { 3653 console.error(`${TAG} failed, error: ${err.message}`); 3654 expect().assertFail(); 3655 } 3656 }) 3657 /** 3658 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_184000 3659 * @tc.name : testPrototypeSplice0009 3660 * @tc.desc : Test the function of the interface PrototypeSplice. 3661 * @tc.size : MediumTest 3662 * @tc.type : Function 3663 * @tc.level : Level 1 3664 */ 3665 it('testPrototypeSplice0009', 0, () => { 3666 const TAG = "testPrototypeSplice0009"; 3667 try { 3668 const myFish = ["angel", "clown", "trumpet", "sturgeon"]; 3669 myFish.splice(0, 2, "parrot", "anemone", "blue"); 3670 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3671 expect(JSON.stringify(myFish)).assertEqual('["parrot","anemone","blue","trumpet","sturgeon"]'); 3672 } catch (err) { 3673 console.error(`${TAG} failed, error: ${err.message}`); 3674 expect().assertFail(); 3675 } 3676 }) 3677 /** 3678 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_185000 3679 * @tc.name : testPrototypeSplice0010 3680 * @tc.desc : Test the function of the interface PrototypeSplice. 3681 * @tc.size : MediumTest 3682 * @tc.type : Function 3683 * @tc.level : Level 1 3684 */ 3685 it('testPrototypeSplice0010', 0, () => { 3686 const TAG = "testPrototypeSplice0010"; 3687 try { 3688 const myFish = ["parrot", "anemone", "blue", "trumpet", "sturgeon"]; 3689 myFish.splice(2, 2); 3690 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3691 expect(JSON.stringify(myFish)).assertEqual('["parrot","anemone","sturgeon"]'); 3692 } catch (err) { 3693 console.error(`${TAG} failed, error: ${err.message}`); 3694 expect().assertFail(); 3695 } 3696 }) 3697 /** 3698 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_186000 3699 * @tc.name : testPrototypeSplice0011 3700 * @tc.desc : Test the function of the interface PrototypeSplice. 3701 * @tc.size : MediumTest 3702 * @tc.type : Function 3703 * @tc.level : Level 1 3704 */ 3705 it('testPrototypeSplice0011', 0, () => { 3706 const TAG = "testPrototypeSplice0011"; 3707 try { 3708 const myFish = ["angel", "clown", "mandarin", "sturgeon"]; 3709 myFish.splice(-2, 1); 3710 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3711 expect(JSON.stringify(myFish)).assertEqual('["angel","clown","sturgeon"]'); 3712 } catch (err) { 3713 console.error(`${TAG} failed, error: ${err.message}`); 3714 expect().assertFail(); 3715 } 3716 }) 3717 /** 3718 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_187000 3719 * @tc.name : testPrototypeSplice0012 3720 * @tc.desc : Test the function of the interface PrototypeSplice. 3721 * @tc.size : MediumTest 3722 * @tc.type : Function 3723 * @tc.level : Level 1 3724 */ 3725 it('testPrototypeSplice0012', 0, () => { 3726 const TAG = "testPrototypeSplice0012"; 3727 try { 3728 const myFish = ["angel", "clown", "mandarin", "sturgeon"]; 3729 myFish.splice(2); 3730 console.log(`${TAG} result:` + JSON.stringify(myFish)); 3731 expect(JSON.stringify(myFish)).assertEqual('["angel","clown"]'); 3732 } catch (err) { 3733 console.error(`${TAG} failed, error: ${err.message}`); 3734 expect().assertFail(); 3735 } 3736 }) 3737 /** 3738 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_188000 3739 * @tc.name : testPrototypeSplice0013 3740 * @tc.desc : Test the function of the interface PrototypeSplice. 3741 * @tc.size : MediumTest 3742 * @tc.type : Function 3743 * @tc.level : Level 1 3744 */ 3745 it('testPrototypeSplice0013', 0, () => { 3746 const TAG = "testPrototypeSplice0013"; 3747 try { 3748 const arr = [1, , 3, 4, , 6]; 3749 arr.splice(1, 2); 3750 console.log(`${TAG} result:` + JSON.stringify(arr)); 3751 expect(JSON.stringify(arr)).assertEqual('[1,4,null,6]'); 3752 } catch (err) { 3753 console.error(`${TAG} failed, error: ${err.message}`); 3754 expect().assertFail(); 3755 } 3756 }) 3757 /** 3758 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_189000 3759 * @tc.name : testPrototypeSymboliterator0001 3760 * @tc.desc : Test the function of the interface Prototype[Symbol.iterator]. 3761 * @tc.size : MediumTest 3762 * @tc.type : Function 3763 * @tc.level : Level 1 3764 */ 3765 it('testPrototypeSymboliterator0001', 0, () => { 3766 const TAG = "testPrototypeSymboliterator0001"; 3767 try { 3768 const array1 = ['a', 'b', 'c']; 3769 const iterator1 = array1[Symbol.iterator](); 3770 expect(JSON.stringify(iterator1.next())).assertEqual('{"value":"a","done":false}'); 3771 } catch (err) { 3772 console.error(`${TAG} failed, error: ${err.message}`); 3773 expect().assertFail(); 3774 } 3775 }) 3776 /** 3777 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_190000 3778 * @tc.name : testPrototypeToLocaleString0002 3779 * @tc.desc : Test the function of the interface PrototypeToLocaleString. 3780 * @tc.size : MediumTest 3781 * @tc.type : Function 3782 * @tc.level : Level 1 3783 */ 3784 it('testPrototypeToLocaleString0002', 0, () => { 3785 const TAG = "testPrototypeToLocaleString0002"; 3786 try { 3787 const array1 = []; 3788 const iterator1 = array1.toLocaleString(); 3789 console.log(`${TAG} result:` + iterator1); 3790 expect(iterator1).assertEqual(''); 3791 } catch (err) { 3792 console.error(`${TAG} failed, error: ${err.message}`); 3793 expect().assertFail(); 3794 } 3795 }) 3796 /** 3797 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_191000 3798 * @tc.name : testPrototypeToLocaleString0003 3799 * @tc.desc : Test the function of the interface PrototypeToLocaleString. 3800 * @tc.size : MediumTest 3801 * @tc.type : Function 3802 * @tc.level : Level 1 3803 */ 3804 it('testPrototypeToLocaleString0003', 0, () => { 3805 const TAG = "testPrototypeToLocaleString0003"; 3806 try { 3807 const array1 = [undefined]; 3808 const iterator1 = array1.toLocaleString(); 3809 console.log(`${TAG} result:` + iterator1); 3810 expect(iterator1).assertEqual(''); 3811 } catch (err) { 3812 console.error(`${TAG} failed, error: ${err.message}`); 3813 expect().assertFail(); 3814 } 3815 }) 3816 /** 3817 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_192000 3818 * @tc.name : testPrototypeToLocaleString0004 3819 * @tc.desc : Test the function of the interface PrototypeToLocaleString. 3820 * @tc.size : MediumTest 3821 * @tc.type : Function 3822 * @tc.level : Level 1 3823 */ 3824 it('testPrototypeToLocaleString0004', 0, () => { 3825 const TAG = "testPrototypeToLocaleString0004"; 3826 try { 3827 const array1 = [null]; 3828 const iterator1 = array1.toLocaleString(); 3829 console.log(`${TAG} result:` + iterator1); 3830 expect(iterator1).assertEqual(''); 3831 } catch (err) { 3832 console.error(`${TAG} failed, error: ${err.message}`); 3833 expect().assertFail(); 3834 } 3835 }) 3836 /** 3837 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_193000 3838 * @tc.name : testPrototypeToLocaleString0005 3839 * @tc.desc : Test the function of the interface PrototypeToLocaleString. 3840 * @tc.size : MediumTest 3841 * @tc.type : Function 3842 * @tc.level : Level 1 3843 */ 3844 it('testPrototypeToLocaleString0005', 0, () => { 3845 const TAG = "testPrototypeToLocaleString0005"; 3846 try { 3847 const array1 = [1]; 3848 const iterator1 = array1.toLocaleString(); 3849 console.log(`${TAG} result:` + iterator1); 3850 expect(iterator1).assertEqual('1'); 3851 } catch (err) { 3852 console.error(`${TAG} failed, error: ${err.message}`); 3853 expect().assertFail(); 3854 } 3855 }) 3856 /** 3857 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_194000 3858 * @tc.name : testPrototypeToLocaleString0006 3859 * @tc.desc : Test the function of the interface PrototypeToLocaleString. 3860 * @tc.size : MediumTest 3861 * @tc.type : Function 3862 * @tc.level : Level 1 3863 */ 3864 it('testPrototypeToLocaleString0006', 0, () => { 3865 const TAG = "testPrototypeToLocaleString0006"; 3866 try { 3867 const array1 = ['Test']; 3868 const iterator1 = array1.toLocaleString(); 3869 console.log(`${TAG} result:` + iterator1); 3870 expect(iterator1).assertEqual('Test'); 3871 } catch (err) { 3872 console.error(`${TAG} failed, error: ${err.message}`); 3873 expect().assertFail(); 3874 } 3875 }) 3876 /** 3877 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_195000 3878 * @tc.name : testPrototypeToString0001 3879 * @tc.desc : Test the function of the interface PrototypeToString. 3880 * @tc.size : MediumTest 3881 * @tc.type : Function 3882 * @tc.level : Level 1 3883 */ 3884 it('testPrototypeToString0001', 0, () => { 3885 const TAG = "testPrototypeToString0001"; 3886 try { 3887 const array1 = [1, 2, 'a', '1a']; 3888 const result = array1.toString(); 3889 console.log(`${TAG} result:` + result); 3890 expect(result).assertEqual('1,2,a,1a'); 3891 } catch (err) { 3892 console.error(`${TAG} failed, error: ${err.message}`); 3893 expect().assertFail(); 3894 } 3895 }) 3896 /** 3897 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_196000 3898 * @tc.name : testPrototypeToString0002 3899 * @tc.desc : Test the function of the interface PrototypeToString. 3900 * @tc.size : MediumTest 3901 * @tc.type : Function 3902 * @tc.level : Level 1 3903 */ 3904 it('testPrototypeToString0002', 0, () => { 3905 const TAG = "testPrototypeToString0002"; 3906 try { 3907 const array1 = ['1a']; 3908 let value = array1.toString(); 3909 console.log(`${TAG} result:` + value); 3910 expect(value).assertEqual('1a'); 3911 } catch (err) { 3912 console.error(`${TAG} failed, error: ${err.message}`); 3913 expect().assertFail(); 3914 } 3915 }) 3916 /** 3917 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_197000 3918 * @tc.name : testPrototypeToString0003 3919 * @tc.desc : Test the function of the interface PrototypeToString. 3920 * @tc.size : MediumTest 3921 * @tc.type : Function 3922 * @tc.level : Level 1 3923 */ 3924 it('testPrototypeToString0003', 0, () => { 3925 const TAG = "testPrototypeToString0003"; 3926 try { 3927 const array1 = ['']; 3928 let value = array1.toString(); 3929 console.log(`${TAG} result:` + value); 3930 expect(value).assertEqual(''); 3931 } catch (err) { 3932 console.error(`${TAG} failed, error: ${err.message}`); 3933 expect().assertFail(); 3934 } 3935 }) 3936 /** 3937 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_198000 3938 * @tc.name : testPrototypeToString0004 3939 * @tc.desc : Test the function of the interface PrototypeToString. 3940 * @tc.size : MediumTest 3941 * @tc.type : Function 3942 * @tc.level : Level 1 3943 */ 3944 it('testPrototypeToString0004', 0, () => { 3945 const TAG = "testPrototypeToString0004"; 3946 try { 3947 const array1 = [null]; 3948 let value = array1.toString(); 3949 console.log(`${TAG} result:` + value); 3950 expect(value).assertEqual(''); 3951 } catch (err) { 3952 console.error(`${TAG} failed, error: ${err.message}`); 3953 expect().assertFail(); 3954 } 3955 }) 3956 /** 3957 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_199000 3958 * @tc.name : testPrototypeToString0005 3959 * @tc.desc : Test the function of the interface PrototypeToString. 3960 * @tc.size : MediumTest 3961 * @tc.type : Function 3962 * @tc.level : Level 1 3963 */ 3964 it('testPrototypeToString0005', 0, () => { 3965 const TAG = "testPrototypeToString0005"; 3966 try { 3967 const array1 = [undefined]; 3968 let value = array1.toString(); 3969 console.log(`${TAG} result:` + value); 3970 expect(value).assertEqual(''); 3971 } catch (err) { 3972 console.error(`${TAG} failed, error: ${err.message}`); 3973 expect().assertFail(); 3974 } 3975 }) 3976 /** 3977 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_200000 3978 * @tc.name : testPrototypeUnshift0001 3979 * @tc.desc : Test the function of the interface PrototypeUnshift. 3980 * @tc.size : MediumTest 3981 * @tc.type : Function 3982 * @tc.level : Level 1 3983 */ 3984 it('testPrototypeUnshift0001', 0, () => { 3985 const TAG = "testPrototypeUnshift0001"; 3986 try { 3987 let arr = [4, 5, 6]; 3988 let value = arr.unshift(1, 2, 3); 3989 console.log(`${TAG} result:` + JSON.stringify(arr) + 'length:' + value); 3990 expect(JSON.stringify(arr)).assertEqual('[1,2,3,4,5,6]'); 3991 expect(value).assertEqual(6); 3992 } catch (err) { 3993 console.error(`${TAG} failed, error: ${err.message}`); 3994 expect().assertFail(); 3995 } 3996 }) 3997 /** 3998 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_201000 3999 * @tc.name : testPrototypeUnshift0002 4000 * @tc.desc : Test the function of the interface PrototypeUnshift. 4001 * @tc.size : MediumTest 4002 * @tc.type : Function 4003 * @tc.level : Level 1 4004 */ 4005 it('testPrototypeUnshift0002', 0, () => { 4006 const TAG = "testPrototypeUnshift0002"; 4007 try { 4008 const arr = [1, 2]; 4009 let value = arr.unshift(0); 4010 console.log(`${TAG} result:` + JSON.stringify(arr) + 'length:' + value); 4011 expect(JSON.stringify(arr)).assertEqual('[0,1,2]'); 4012 expect(value).assertEqual(3); 4013 } catch (err) { 4014 console.error(`${TAG} failed, error: ${err.message}`); 4015 expect().assertFail(); 4016 } 4017 }) 4018 /** 4019 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_202000 4020 * @tc.name : testPrototypeUnshift0003 4021 * @tc.desc : Test the function of the interface PrototypeUnshift. 4022 * @tc.size : MediumTest 4023 * @tc.type : Function 4024 * @tc.level : Level 1 4025 */ 4026 it('testPrototypeUnshift0003', 0, () => { 4027 const TAG = "testPrototypeUnshift0003"; 4028 try { 4029 const arr = [1, 2]; 4030 let value = arr.unshift(-2, -1); 4031 console.log(`${TAG} result:` + JSON.stringify(arr) + 'length:' + value); 4032 expect(JSON.stringify(arr)).assertEqual('[-2,-1,1,2]'); 4033 expect(value).assertEqual(4); 4034 } catch (err) { 4035 console.error(`${TAG} failed, error: ${err.message}`); 4036 expect().assertFail(); 4037 } 4038 }) 4039 /** 4040 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_203000 4041 * @tc.name : testPrototypeValues0001 4042 * @tc.desc : Test the function of the interface PrototypeValues. 4043 * @tc.size : MediumTest 4044 * @tc.type : Function 4045 * @tc.level : Level 1 4046 */ 4047 it('testPrototypeValues0001', 0, () => { 4048 const TAG = "testPrototypeValues0001"; 4049 try { 4050 const arr = ["a", "b", "c", "d", "e"]; 4051 const iterator = arr.values(); 4052 let val1 = iterator.next(); 4053 expect(JSON.stringify(val1)).assertEqual('{"value":"a","done":false}'); 4054 let val2 = iterator.next(); 4055 expect(JSON.stringify(val2)).assertEqual('{"value":"b","done":false}'); 4056 let val3 = iterator.next(); 4057 expect(JSON.stringify(val3)).assertEqual('{"value":"c","done":false}'); 4058 let val4 = iterator.next(); 4059 expect(JSON.stringify(val4)).assertEqual('{"value":"d","done":false}'); 4060 let val5 = iterator.next(); 4061 expect(JSON.stringify(val5)).assertEqual('{"value":"e","done":false}'); 4062 } catch (err) { 4063 console.error(`${TAG} failed, error: ${err.message}`); 4064 expect().assertFail(); 4065 } 4066 }) 4067 /** 4068 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_204000 4069 * @tc.name : testPrototypeValues0002 4070 * @tc.desc : Test the function of the interface PrototypeValues. 4071 * @tc.size : MediumTest 4072 * @tc.type : Function 4073 * @tc.level : Level 1 4074 */ 4075 it('testPrototypeValues0002', 0, () => { 4076 const TAG = "testPrototypeValues0002"; 4077 try { 4078 const arr = ["a", undefined, "c", "d", "e"]; 4079 const iterator = arr.values(); 4080 let val1 = iterator.next(); 4081 expect(JSON.stringify(val1)).assertEqual('{"value":"a","done":false}'); 4082 let val2 = iterator.next(); 4083 expect(JSON.stringify(val2)).assertEqual('{"done":false}'); 4084 let val3 = iterator.next(); 4085 expect(JSON.stringify(val3)).assertEqual('{"value":"c","done":false}'); 4086 let val4 = iterator.next(); 4087 expect(JSON.stringify(val4)).assertEqual('{"value":"d","done":false}'); 4088 let val5 = iterator.next(); 4089 expect(JSON.stringify(val5)).assertEqual('{"value":"e","done":false}'); 4090 } catch (err) { 4091 console.error(`${TAG} failed, error: ${err.message}`); 4092 expect().assertFail(); 4093 } 4094 }) 4095 /** 4096 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_205000 4097 * @tc.name : testPrototypeValues0003 4098 * @tc.desc : Test the function of the interface PrototypeValues. 4099 * @tc.size : MediumTest 4100 * @tc.type : Function 4101 * @tc.level : Level 1 4102 */ 4103 it('testPrototypeValues0003', 0, () => { 4104 const TAG = "testPrototypeValues0003"; 4105 try { 4106 const arr = ["a", null]; 4107 const iterator = arr.values(); 4108 let val1 = iterator.next(); 4109 expect(JSON.stringify(val1)).assertEqual('{"value":"a","done":false}'); 4110 let val2 = iterator.next(); 4111 expect(JSON.stringify(val2)).assertEqual('{"value":null,"done":false}'); 4112 } catch (err) { 4113 console.error(`${TAG} failed, error: ${err.message}`); 4114 expect().assertFail(); 4115 } 4116 }) 4117 /** 4118 * @tc.number : SUB_COMMONLIBRARY_UTIL_BASE_ARRAY_206000 4119 * @tc.name : testPrototypeValues0004 4120 * @tc.desc : Test the function of the interface PrototypeValues. 4121 * @tc.size : MediumTest 4122 * @tc.type : Function 4123 * @tc.level : Level 1 4124 */ 4125 it('testPrototypeValues0004', 0, () => { 4126 const TAG = "testPrototypeValues0004"; 4127 try { 4128 const arr = []; 4129 const iterator = arr.values(); 4130 let val1 = iterator.next(); 4131 expect(JSON.stringify(val1)).assertEqual('{"done":true}'); 4132 } catch (err) { 4133 console.error(`${TAG} failed, error: ${err.message}`); 4134 expect().assertFail(); 4135 } 4136 }); 4137 }); 4138}