1/* Copyright JS Foundation and other contributors, http://js.foundation 2 * 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 */ 15 16var uint8 = new Uint8Array(4); 17 18// 22.2.3.22 19assert(uint8.set.length === 1) 20 21try 22{ 23 uint8.set([1], -1); 24 assert(false); 25} catch (e) 26{ 27 assert(e instanceof RangeError); 28} 29 30try 31{ 32 uint8.set([1], - (Math.pow(2, 32) + 1)); 33 assert(false); 34} catch (e) 35{ 36 assert(e instanceof RangeError); 37} 38 39try 40{ 41 uint8.set([1], -Infinity); 42 assert(false); 43} catch (e) 44{ 45 assert(e instanceof RangeError); 46} 47 48try 49{ 50 uint8.set([1], Infinity); 51 assert(false); 52} catch (e) 53{ 54 assert(e instanceof RangeError); 55} 56 57try 58{ 59 uint8.set([1], (Math.pow(2, 32) + 1)); 60 assert(false); 61} catch (e) 62{ 63 assert(e instanceof RangeError); 64} 65 66try 67{ 68 // 22.2.3.22.1 step 20 69 uint8.set([17, 18, 19], 2); 70 assert(false); 71} catch (e) 72{ 73 assert(e instanceof RangeError) 74} 75