14514f5e3Sopenharmony_ci/* 24514f5e3Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License. 54514f5e3Sopenharmony_ci * You may obtain a copy of the License at 64514f5e3Sopenharmony_ci * 74514f5e3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 84514f5e3Sopenharmony_ci * 94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and 134514f5e3Sopenharmony_ci * limitations under the License. 144514f5e3Sopenharmony_ci */ 154514f5e3Sopenharmony_ci 164514f5e3Sopenharmony_ci/* 174514f5e3Sopenharmony_ci * @tc.name:builtins 184514f5e3Sopenharmony_ci * @tc.desc:test builtins 194514f5e3Sopenharmony_ci * @tc.type: FUNC 204514f5e3Sopenharmony_ci * @tc.require: issueI5NO8G 214514f5e3Sopenharmony_ci */ 224514f5e3Sopenharmony_ciprint("builtins ir start"); 234514f5e3Sopenharmony_civar str1 = "wpydejkl"; 244514f5e3Sopenharmony_ciprint(str1.charCodeAt(1.231)); 254514f5e3Sopenharmony_ciprint(str1.charCodeAt(undefined)); 264514f5e3Sopenharmony_ciprint(str1.charCodeAt(new Date())); 274514f5e3Sopenharmony_ciprint(str1.charCodeAt(14)); 284514f5e3Sopenharmony_ciprint(str1.charCodeAt(3)); 294514f5e3Sopenharmony_ciprint(str1.indexOf("wpy")); 304514f5e3Sopenharmony_ciprint(str1.indexOf("py", 0)); 314514f5e3Sopenharmony_ciprint(str1.indexOf("py", 5)); 324514f5e3Sopenharmony_ciprint(str1.indexOf("hhh", 0)); 334514f5e3Sopenharmony_ciprint(str1.indexOf("hjs", 19)); 344514f5e3Sopenharmony_ciprint(str1.indexOf("jk", 3)); 354514f5e3Sopenharmony_ciprint(str1.indexOf(undefined)); 364514f5e3Sopenharmony_ciprint(str1.indexOf(null)); 374514f5e3Sopenharmony_civar person = { 384514f5e3Sopenharmony_cifullName: function(city, country) { 394514f5e3Sopenharmony_ci return this.firstName + " " + this.lastName + "," + city + "," + country; 404514f5e3Sopenharmony_ci} 414514f5e3Sopenharmony_ci} 424514f5e3Sopenharmony_civar person1 = { 434514f5e3Sopenharmony_cifirstName:"Bill", 444514f5e3Sopenharmony_cilastName: "Gates" 454514f5e3Sopenharmony_ci} 464514f5e3Sopenharmony_civar a = new Uint32Array([1,2]); 474514f5e3Sopenharmony_ciprint(person.fullName.apply(person1, a)); 484514f5e3Sopenharmony_ci// xxxConstructor 494514f5e3Sopenharmony_civar a = { 504514f5e3Sopenharmony_ci test() { 514514f5e3Sopenharmony_ci this.foo(); 524514f5e3Sopenharmony_ci } 534514f5e3Sopenharmony_ci} 544514f5e3Sopenharmony_cia.foo = Array; 554514f5e3Sopenharmony_cia.test(); 564514f5e3Sopenharmony_cia.foo = Boolean; 574514f5e3Sopenharmony_cia.test(); 584514f5e3Sopenharmony_cia.foo = Date; 594514f5e3Sopenharmony_cia.test(); 604514f5e3Sopenharmony_ci 614514f5e3Sopenharmony_civar obj = { 624514f5e3Sopenharmony_ci number: Number, 634514f5e3Sopenharmony_ci date: Date, 644514f5e3Sopenharmony_ci bool: Boolean 654514f5e3Sopenharmony_ci}; 664514f5e3Sopenharmony_ciprint(obj.number(1)); 674514f5e3Sopenharmony_ciprint(obj.number(1, 2)); 684514f5e3Sopenharmony_ciprint(obj.number(1, 2, 3)); 694514f5e3Sopenharmony_ciprint(obj.number(1, 2, 3, 4)); 704514f5e3Sopenharmony_ciprint(obj.number([1])); 714514f5e3Sopenharmony_ciprint(obj.number([1, 2])); 724514f5e3Sopenharmony_ciobj.date(0); 734514f5e3Sopenharmony_ciobj.date(0, 1); 744514f5e3Sopenharmony_ciobj.date(0, 1, 2); 754514f5e3Sopenharmony_ciobj.date(0, 1, 2, 3); 764514f5e3Sopenharmony_ciprint(obj.bool(0)); 774514f5e3Sopenharmony_ciprint(obj.bool(0, 1)); 784514f5e3Sopenharmony_ciprint(obj.bool(0, 1, 2)); 794514f5e3Sopenharmony_ciprint(obj.bool(0, 1, 2, 3)); 804514f5e3Sopenharmony_ciprint("builtins ir end"); 81