OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../js/resources/js-test-pre.js"></script> | 3 <script src="../../js/resources/js-test-pre.js"></script> |
4 <script src="resources/webgl-test.js"></script> | 4 <script src="resources/webgl-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="description"></div> | 7 <div id="description"></div> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 | 9 |
10 <script> | 10 <script> |
(...skipping 26 matching lines...) Expand all Loading... | |
37 var buffer = new ArrayBuffer(4); | 37 var buffer = new ArrayBuffer(4); |
38 var array; | 38 var array; |
39 try { | 39 try { |
40 array = new type(buffer, 4, -2147483648); | 40 array = new type(buffer, 4, -2147483648); |
41 testFailed("Construction of " + name + " with negative out-of-range valu es should throw exception"); | 41 testFailed("Construction of " + name + " with negative out-of-range valu es should throw exception"); |
42 } catch (e) { | 42 } catch (e) { |
43 testPassed("Construction of " + name + " with negative out-of-range valu es threw exception"); | 43 testPassed("Construction of " + name + " with negative out-of-range valu es threw exception"); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 /* | |
47 function testConstructionOfHugeArray(type, name, sz) { | 48 function testConstructionOfHugeArray(type, name, sz) { |
48 if (sz == 1) | 49 if (sz == 1) |
49 return; | 50 return; |
50 try { | 51 try { |
51 // Construction of huge arrays must fail because byteLength is | 52 // Construction of huge arrays must fail because byteLength is |
52 // an unsigned long | 53 // an unsigned long |
53 array = new type(3000000000); | 54 array = new type(3000000000); |
54 testFailed("Construction of huge " + name + " should throw exception"); | 55 testFailed("Construction of huge " + name + " should throw exception"); |
55 } catch (e) { | 56 } catch (e) { |
56 testPassed("Construction of huge " + name + " threw exception"); | 57 testPassed("Construction of huge " + name + " threw exception"); |
57 } | 58 } |
58 } | 59 } |
60 */ | |
Dmitry Lomov (no reviews)
2013/07/15 16:58:05
See huge array comment elsewhere
| |
59 | 61 |
60 // These need to be global for shouldBe to see them | 62 // These need to be global for shouldBe to see them |
61 var array; | 63 var array; |
62 var typeSize; | 64 var typeSize; |
63 | 65 |
64 function testSubarrayWithOutOfRangeValues(type, name, sz) { | 66 function testSubarrayWithOutOfRangeValues(type, name, sz) { |
65 debug("Testing subarray of " + name); | 67 debug("Testing subarray of " + name); |
66 try { | 68 try { |
67 var buffer = new ArrayBuffer(32); | 69 var buffer = new ArrayBuffer(32); |
68 array = new type(buffer); | 70 array = new type(buffer); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 | 133 |
132 for (var i = 0; i < typeNames.length; i++) { | 134 for (var i = 0; i < typeNames.length; i++) { |
133 var name = typeNames[i]; | 135 var name = typeNames[i]; |
134 var type = window[name]; | 136 var type = window[name]; |
135 if (!type) { | 137 if (!type) { |
136 testFailed("Could not find array type " + name); | 138 testFailed("Could not find array type " + name); |
137 } else { | 139 } else { |
138 testConstructionWithNullBuffer(type, name); | 140 testConstructionWithNullBuffer(type, name); |
139 testConstructionWithOutOfRangeValues(type, name); | 141 testConstructionWithOutOfRangeValues(type, name); |
140 testConstructionWithNegativeOutOfRangeValues(type, name); | 142 testConstructionWithNegativeOutOfRangeValues(type, name); |
141 testConstructionOfHugeArray(type, name, typeSizes[i]); | 143 //testConstructionOfHugeArray(type, name, typeSizes[i]); |
142 testSubarrayWithOutOfRangeValues(type, name, typeSizes[i]); | 144 testSubarrayWithOutOfRangeValues(type, name, typeSizes[i]); |
143 testSettingFromArrayWithOutOfRangeOffset(type, name); | 145 testSettingFromArrayWithOutOfRangeOffset(type, name); |
144 testSettingFromFakeArrayWithOutOfRangeLength(type, name); | 146 testSettingFromFakeArrayWithOutOfRangeLength(type, name); |
145 testSettingFromWebGLArrayWithOutOfRangeOffset(type, name); | 147 testSettingFromWebGLArrayWithOutOfRangeOffset(type, name); |
146 } | 148 } |
147 } | 149 } |
148 | 150 |
149 buffer = new ArrayBuffer(40); | 151 buffer = new ArrayBuffer(40); |
150 ints = new Int32Array(buffer, 0, 10); | 152 ints = new Int32Array(buffer, 0, 10); |
151 floats = new Float32Array(buffer, 0, 10); | 153 floats = new Float32Array(buffer, 0, 10); |
152 // Plant a NaN into the buffer | 154 // Plant a NaN into the buffer |
153 ints[0]=-0x7ffff; | 155 ints[0]=-0x7ffff; |
154 // Read the NaN out as a float | 156 // Read the NaN out as a float |
155 shouldBeTrue("isNaN(floats[0])"); | 157 shouldBeTrue("isNaN(floats[0])"); |
156 | 158 |
157 </script> | 159 </script> |
158 <script src="../../js/resources/js-test-post.js"></script> | 160 <script src="../../js/resources/js-test-post.js"></script> |
159 | 161 |
160 </body> | 162 </body> |
161 </html> | 163 </html> |
OLD | NEW |