1425bb815Sopenharmony_ci/* Copyright JS Foundation and other contributors, http://js.foundation 2425bb815Sopenharmony_ci * 3425bb815Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4425bb815Sopenharmony_ci * you may not use this file except in compliance with the License. 5425bb815Sopenharmony_ci * You may obtain a copy of the License at 6425bb815Sopenharmony_ci * 7425bb815Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8425bb815Sopenharmony_ci * 9425bb815Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10425bb815Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS 11425bb815Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12425bb815Sopenharmony_ci * See the License for the specific language governing permissions and 13425bb815Sopenharmony_ci * limitations under the License. 14425bb815Sopenharmony_ci */ 15425bb815Sopenharmony_ci 16425bb815Sopenharmony_civar uint8 = new Uint8Array(4); 17425bb815Sopenharmony_ci 18425bb815Sopenharmony_ciuint8.set([10, "11", 12]); 19425bb815Sopenharmony_ciassert(uint8[0] === 10 && uint8[1] === 11 && uint8[2] === 12); 20425bb815Sopenharmony_ci 21425bb815Sopenharmony_ciuint8.set([13, 14.3, 15], 1); 22425bb815Sopenharmony_ciassert(uint8[0] === 10 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 23425bb815Sopenharmony_ci 24425bb815Sopenharmony_ciuint8.set([16], NaN); 25425bb815Sopenharmony_ciassert(uint8[0] === 16 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 26425bb815Sopenharmony_ci 27425bb815Sopenharmony_ciuint8.set([17], ""); 28425bb815Sopenharmony_ciassert(uint8[0] === 17 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 29425bb815Sopenharmony_ci 30425bb815Sopenharmony_ciuint8.set([18], "0"); 31425bb815Sopenharmony_ciassert(uint8[0] === 18 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 32425bb815Sopenharmony_ci 33425bb815Sopenharmony_ciuint8.set([19], false); 34425bb815Sopenharmony_ciassert(uint8[0] === 19 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 35425bb815Sopenharmony_ci 36425bb815Sopenharmony_ciuint8.set([20], 0.2); 37425bb815Sopenharmony_ciassert(uint8[0] === 20 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 38425bb815Sopenharmony_ci 39425bb815Sopenharmony_ciuint8.set([21], 0.9); 40425bb815Sopenharmony_ciassert(uint8[0] === 21 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 41425bb815Sopenharmony_ci 42425bb815Sopenharmony_ciuint8.set([22], null); 43425bb815Sopenharmony_ciassert(uint8[0] === 22 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 44425bb815Sopenharmony_ci 45425bb815Sopenharmony_ciuint8.set([23], {}); 46425bb815Sopenharmony_ciassert(uint8[0] === 23 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 47425bb815Sopenharmony_ci 48425bb815Sopenharmony_ciuint8.set([24], []); 49425bb815Sopenharmony_ciassert(uint8[0] === 24 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15); 50425bb815Sopenharmony_ci 51425bb815Sopenharmony_ciuint8.set([25], true); 52425bb815Sopenharmony_ciassert(uint8[0] === 24 && uint8[1] === 25 && uint8[2] === 14 && uint8[3] === 15); 53425bb815Sopenharmony_ci 54