OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script src="../resources/testharness-helpers.js"></script> | 4 <script src="../resources/testharness-helpers.js"></script> |
5 <script src="../resources/mojo-helpers.js"></script> | 5 <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></scr
ipt> |
| 6 <script src="file:///gen/mojo/public/interfaces/bindings/tests/test_structs.mojo
m.js"></script> |
6 <script> | 7 <script> |
7 'use strict'; | 8 |
8 | 9 test(() => { |
9 setup({ explicit_done: true }); | 10 var r = new mojo.test.Rect(); |
10 | 11 assert_weak_equals(r, new mojo.test.Rect({x:0, y:0, width:0, height:0})); |
11 define([ | 12 assert_weak_equals(r, new mojo.test.Rect({foo:100, bar:200})); |
12 "mojo/public/interfaces/bindings/tests/rect.mojom", | 13 |
13 "mojo/public/interfaces/bindings/tests/test_structs.mojom", | 14 r.x = 10; |
14 "mojo/public/js/codec", | 15 r.y = 20; |
15 "mojo/public/js/validator", | 16 r.width = 30; |
16 ], function(rect, testStructs, codec, validator) { | 17 r.height = 40; |
17 | 18 var rp = new mojo.test.RectPair({first: r, second: r}); |
18 test(() => { | 19 assert_weak_equals(rp.first, r); |
19 var r = new rect.Rect(); | 20 assert_weak_equals(rp.second, r); |
20 assert_weak_equals(r, new rect.Rect({x:0, y:0, width:0, height:0})); | 21 |
21 assert_weak_equals(r, new rect.Rect({foo:100, bar:200})); | 22 assert_equals(new mojo.test.RectPair({second: r}).first, null); |
22 | 23 |
23 r.x = 10; | 24 var nr = new mojo.test.NamedRegion(); |
24 r.y = 20; | 25 assert_equals(nr.name, null); |
25 r.width = 30; | 26 assert_equals(nr.rects, null); |
26 r.height = 40; | 27 assert_weak_equals(nr, new mojo.test.NamedRegion({})); |
27 var rp = new testStructs.RectPair({first: r, second: r}); | 28 |
28 assert_weak_equals(rp.first, r); | 29 nr.name = "foo"; |
29 assert_weak_equals(rp.second, r); | 30 nr.rects = [r, r, r]; |
30 | 31 assert_weak_equals(nr, new mojo.test.NamedRegion({ |
31 assert_equals(new testStructs.RectPair({second: r}).first, null); | 32 name: "foo", |
32 | 33 rects: [r, r, r], |
33 var nr = new testStructs.NamedRegion(); | 34 })); |
34 assert_equals(nr.name, null); | 35 |
35 assert_equals(nr.rects, null); | 36 var e = new mojo.test.EmptyStruct(); |
36 assert_weak_equals(nr, new testStructs.NamedRegion({})); | 37 assert_weak_equals(e, new mojo.test.EmptyStruct({foo:123})); |
37 | 38 }, 'constructors'); |
38 nr.name = "foo"; | 39 |
39 nr.rects = [r, r, r]; | 40 test(() => { |
40 assert_weak_equals(nr, new testStructs.NamedRegion({ | 41 var s = new mojo.test.NoDefaultFieldValues(); |
41 name: "foo", | 42 assert_false(s.f0); |
42 rects: [r, r, r], | 43 |
43 })); | 44 // f1 - f10, number type fields |
44 | 45 for (var i = 1; i <= 10; i++) |
45 var e = new testStructs.EmptyStruct(); | 46 assert_equals(s["f" + i], 0); |
46 assert_weak_equals(e, new testStructs.EmptyStruct({foo:123})); | 47 |
47 }, 'constructors'); | 48 // f11,12 strings, f13-22 handles, f23-f26 arrays, f27,28 structs |
48 | 49 for (var i = 11; i <= 28; i++) |
49 test(() => { | 50 assert_equals(s["f" + i], null); |
50 var s = new testStructs.NoDefaultFieldValues(); | 51 |
51 assert_false(s.f0); | 52 }, 'no default field values'); |
52 | 53 |
53 // f1 - f10, number type fields | 54 test(() => { |
54 for (var i = 1; i <= 10; i++) | 55 var s = new mojo.test.DefaultFieldValues(); |
55 assert_equals(s["f" + i], 0); | 56 assert_true(s.f0); |
56 | 57 |
57 // f11,12 strings, f13-22 handles, f23-f26 arrays, f27,28 structs | 58 // f1 - f12, number type fields |
58 for (var i = 11; i <= 28; i++) | 59 for (var i = 1; i <= 12; i++) |
59 assert_equals(s["f" + i], null); | 60 assert_equals(s["f" + i], 100); |
60 | 61 |
61 }, 'no default field values'); | 62 // f13,14 "foo" |
62 | 63 for (var i = 13; i <= 14; i++) |
63 test(() => { | 64 assert_equals(s["f" + i], "foo"); |
64 var s = new testStructs.DefaultFieldValues(); | 65 |
65 assert_true(s.f0); | 66 // f15,16 a default instance of Rect |
66 | 67 var r = new mojo.test.Rect(); |
67 // f1 - f12, number type fields | 68 assert_weak_equals(s.f15, r); |
68 for (var i = 1; i <= 12; i++) | 69 assert_weak_equals(s.f16, r); |
69 assert_equals(s["f" + i], 100); | 70 }, 'default field values'); |
70 | 71 |
71 // f13,14 "foo" | 72 test(() => { |
72 for (var i = 13; i <= 14; i++) | 73 assert_equals(mojo.test.ScopedConstants.TEN, 10); |
73 assert_equals(s["f" + i], "foo"); | 74 assert_equals(mojo.test.ScopedConstants.ALSO_TEN, 10); |
74 | 75 |
75 // f15,16 a default instance of Rect | 76 assert_equals(mojo.test.ScopedConstants.EType.E0, 0); |
76 var r = new rect.Rect(); | 77 assert_equals(mojo.test.ScopedConstants.EType.E1, 1); |
77 assert_weak_equals(s.f15, r); | 78 assert_equals(mojo.test.ScopedConstants.EType.E2, 10); |
78 assert_weak_equals(s.f16, r); | 79 assert_equals(mojo.test.ScopedConstants.EType.E3, 10); |
79 }, 'default field values'); | 80 assert_equals(mojo.test.ScopedConstants.EType.E4, 11); |
80 | 81 |
81 test(() => { | 82 var s = new mojo.test.ScopedConstants(); |
82 assert_equals(testStructs.ScopedConstants.TEN, 10); | 83 assert_equals(s.f0, 0); |
83 assert_equals(testStructs.ScopedConstants.ALSO_TEN, 10); | 84 assert_equals(s.f1, 1); |
84 | 85 assert_equals(s.f2, 10); |
85 assert_equals(testStructs.ScopedConstants.EType.E0, 0); | 86 assert_equals(s.f3, 10); |
86 assert_equals(testStructs.ScopedConstants.EType.E1, 1); | 87 assert_equals(s.f4, 11); |
87 assert_equals(testStructs.ScopedConstants.EType.E2, 10); | 88 assert_equals(s.f5, 10); |
88 assert_equals(testStructs.ScopedConstants.EType.E3, 10); | 89 assert_equals(s.f6, 10); |
89 assert_equals(testStructs.ScopedConstants.EType.E4, 11); | 90 }, 'scoped constants'); |
90 | 91 |
91 var s = new testStructs.ScopedConstants(); | 92 function structEncodeDecode(struct) { |
92 assert_equals(s.f0, 0); | 93 var structClass = struct.constructor; |
93 assert_equals(s.f1, 1); | 94 var builder = new mojo.internal.MessageV0Builder(1234, |
94 assert_equals(s.f2, 10); | 95 structClass.encodedSize); |
95 assert_equals(s.f3, 10); | 96 builder.encodeStruct(structClass, struct); |
96 assert_equals(s.f4, 11); | 97 var message = builder.finish(); |
97 assert_equals(s.f5, 10); | 98 |
98 assert_equals(s.f6, 10); | 99 var messageValidator = new mojo.internal.Validator(message); |
99 }, 'scoped constants'); | 100 var err = structClass.validate(messageValidator, |
100 | 101 mojo.internal.kMessageV0HeaderSize); |
101 function structEncodeDecode(struct) { | 102 assert_equals(err, mojo.internal.validationError.NONE); |
102 var structClass = struct.constructor; | 103 |
103 var builder = new codec.MessageV0Builder(1234, structClass.encodedSize); | 104 var reader = new mojo.internal.MessageReader(message); |
104 builder.encodeStruct(structClass, struct); | 105 return reader.decodeStruct(structClass); |
105 var message = builder.finish(); | 106 } |
106 | 107 |
107 var messageValidator = new validator.Validator(message); | 108 test(() => { |
108 var err = structClass.validate(messageValidator, codec.kMessageV0HeaderSize)
; | 109 var mapFieldsStruct = new mojo.test.MapKeyTypes({ |
109 assert_equals(err, validator.validationError.NONE); | 110 f0: new Map([[true, false], [false, true]]), // map<bool, bool> |
110 | 111 f1: new Map([[0, 0], [1, 127], [-1, -128]]), // map<int8, int8> |
111 var reader = new codec.MessageReader(message); | 112 f2: new Map([[0, 0], [1, 127], [2, 255]]), // map<uint8, uint8> |
112 return reader.decodeStruct(structClass); | 113 f3: new Map([[0, 0], [1, 32767], [2, -32768]]), // map<int16, int16> |
113 } | 114 f4: new Map([[0, 0], [1, 32768], [2, 0xFFFF]]), // map<uint16, uint16> |
114 | 115 f5: new Map([[0, 0], [1, 32767], [2, -32768]]), // map<int32, int32> |
115 test(() => { | 116 f6: new Map([[0, 0], [1, 32768], [2, 0xFFFF]]), // map<uint32, uint32> |
116 var mapFieldsStruct = new testStructs.MapKeyTypes({ | 117 f7: new Map([[0, 0], [1, 32767], [2, -32768]]), // map<int64, int64> |
117 f0: new Map([[true, false], [false, true]]), // map<bool, bool> | 118 f8: new Map([[0, 0], [1, 32768], [2, 0xFFFF]]), // map<uint64, uint64> |
118 f1: new Map([[0, 0], [1, 127], [-1, -128]]), // map<int8, int8> | 119 f9: new Map([[1000.5, -50000], [100.5, 5000]]), // map<float, float> |
119 f2: new Map([[0, 0], [1, 127], [2, 255]]), // map<uint8, uint8> | 120 f10: new Map([[-100.5, -50000], [0, 50000000]]), // map<double, double> |
120 f3: new Map([[0, 0], [1, 32767], [2, -32768]]), // map<int16, int16> | 121 f11: new Map([["one", "two"], ["free", "four"]]), // map<string, string> |
121 f4: new Map([[0, 0], [1, 32768], [2, 0xFFFF]]), // map<uint16, uint16> | 122 }); |
122 f5: new Map([[0, 0], [1, 32767], [2, -32768]]), // map<int32, int32> | 123 var decodedStruct = structEncodeDecode(mapFieldsStruct); |
123 f6: new Map([[0, 0], [1, 32768], [2, 0xFFFF]]), // map<uint32, uint32> | 124 assert_weak_equals(decodedStruct, mapFieldsStruct); |
124 f7: new Map([[0, 0], [1, 32767], [2, -32768]]), // map<int64, int64> | 125 }, 'map key types'); |
125 f8: new Map([[0, 0], [1, 32768], [2, 0xFFFF]]), // map<uint64, uint64> | 126 |
126 f9: new Map([[1000.5, -50000], [100.5, 5000]]), // map<float, float> | 127 test(() => { |
127 f10: new Map([[-100.5, -50000], [0, 50000000]]), // map<double, double> | 128 var mapFieldsStruct = new mojo.test.MapValueTypes({ |
128 f11: new Map([["one", "two"], ["free", "four"]]), // map<string, string> | 129 // map<string, array<string>> |
129 }); | 130 f0: new Map([["a", ["b", "c"]], ["d", ["e"]]]), |
130 var decodedStruct = structEncodeDecode(mapFieldsStruct); | 131 // map<string, array<string>?> |
131 assert_weak_equals(decodedStruct, mapFieldsStruct); | 132 f1: new Map([["a", null], ["b", ["c", "d"]]]), |
132 }, 'map key types'); | 133 // map<string, array<string?>> |
133 | 134 f2: new Map([["a", [null]], ["b", [null, "d"]]]), |
134 test(() => { | 135 // map<string, array<string,2>> |
135 var mapFieldsStruct = new testStructs.MapValueTypes({ | 136 f3: new Map([["a", ["1", "2"]], ["b", ["1", "2"]]]), |
136 // map<string, array<string>> | 137 // map<string, array<array<string, 2>?>> |
137 f0: new Map([["a", ["b", "c"]], ["d", ["e"]]]), | 138 f4: new Map([["a", [["1", "2"]]], ["b", [null]]]), |
138 // map<string, array<string>?> | 139 // map<string, array<array<string, 2>, 1>> |
139 f1: new Map([["a", null], ["b", ["c", "d"]]]), | 140 f5: new Map([["a", [["1", "2"]]]]), |
140 // map<string, array<string?>> | 141 // map<string, Rect?> |
141 f2: new Map([["a", [null]], ["b", [null, "d"]]]), | 142 f6: new Map([["a", null]]), |
142 // map<string, array<string,2>> | 143 // map<string, map<string, string>> |
143 f3: new Map([["a", ["1", "2"]], ["b", ["1", "2"]]]), | 144 f7: new Map([["a", new Map([["b", "c"]])]]), |
144 // map<string, array<array<string, 2>?>> | 145 // map<string, array<map<string, string>>> |
145 f4: new Map([["a", [["1", "2"]]], ["b", [null]]]), | 146 f8: new Map([["a", [new Map([["b", "c"]])]]]), |
146 // map<string, array<array<string, 2>, 1>> | 147 // map<string, handle> |
147 f5: new Map([["a", [["1", "2"]]]]), | 148 f9: new Map([["a", 1234]]), |
148 // map<string, Rect?> | 149 // map<string, array<handle>> |
149 f6: new Map([["a", null]]), | 150 f10: new Map([["a", [1234, 5678]]]), |
150 // map<string, map<string, string>> | 151 // map<string, map<string, handle>> |
151 f7: new Map([["a", new Map([["b", "c"]])]]), | 152 f11: new Map([["a", new Map([["b", 1234]])]]), |
152 // map<string, array<map<string, string>>> | 153 }); |
153 f8: new Map([["a", [new Map([["b", "c"]])]]]), | 154 var decodedStruct = structEncodeDecode(mapFieldsStruct); |
154 // map<string, handle> | 155 assert_weak_equals(decodedStruct, mapFieldsStruct); |
155 f9: new Map([["a", 1234]]), | 156 }, 'map value types'); |
156 // map<string, array<handle>> | 157 |
157 f10: new Map([["a", [1234, 5678]]]), | 158 test(() => { |
158 // map<string, map<string, handle>> | 159 var decodedStruct = structEncodeDecode(new mojo.test.FloatNumberValues); |
159 f11: new Map([["a", new Map([["b", 1234]])]]), | 160 assert_equals(decodedStruct.f0, mojo.test.FloatNumberValues.V0); |
160 }); | 161 assert_equals(decodedStruct.f1, mojo.test.FloatNumberValues.V1); |
161 var decodedStruct = structEncodeDecode(mapFieldsStruct); | 162 assert_equals(decodedStruct.f2, mojo.test.FloatNumberValues.V2); |
162 assert_weak_equals(decodedStruct, mapFieldsStruct); | 163 assert_equals(decodedStruct.f3, mojo.test.FloatNumberValues.V3); |
163 }, 'map value types'); | 164 assert_equals(decodedStruct.f4, mojo.test.FloatNumberValues.V4); |
164 | 165 assert_equals(decodedStruct.f5, mojo.test.FloatNumberValues.V5); |
165 test(() => { | 166 assert_equals(decodedStruct.f6, mojo.test.FloatNumberValues.V6); |
166 var decodedStruct = structEncodeDecode(new testStructs.FloatNumberValues); | 167 assert_equals(decodedStruct.f7, mojo.test.FloatNumberValues.V7); |
167 assert_equals(decodedStruct.f0, testStructs.FloatNumberValues.V0); | 168 assert_equals(decodedStruct.f8, mojo.test.FloatNumberValues.V8); |
168 assert_equals(decodedStruct.f1, testStructs.FloatNumberValues.V1); | 169 assert_equals(decodedStruct.f9, mojo.test.FloatNumberValues.V9); |
169 assert_equals(decodedStruct.f2, testStructs.FloatNumberValues.V2); | 170 }, 'float number values'); |
170 assert_equals(decodedStruct.f3, testStructs.FloatNumberValues.V3); | 171 |
171 assert_equals(decodedStruct.f4, testStructs.FloatNumberValues.V4); | 172 test(() => { |
172 assert_equals(decodedStruct.f5, testStructs.FloatNumberValues.V5); | 173 var decodedStruct = structEncodeDecode(new mojo.test.IntegerNumberValues); |
173 assert_equals(decodedStruct.f6, testStructs.FloatNumberValues.V6); | 174 assert_equals(decodedStruct.f0, mojo.test.IntegerNumberValues.V0); |
174 assert_equals(decodedStruct.f7, testStructs.FloatNumberValues.V7); | 175 assert_equals(decodedStruct.f1, mojo.test.IntegerNumberValues.V1); |
175 assert_equals(decodedStruct.f8, testStructs.FloatNumberValues.V8); | 176 assert_equals(decodedStruct.f2, mojo.test.IntegerNumberValues.V2); |
176 assert_equals(decodedStruct.f9, testStructs.FloatNumberValues.V9); | 177 assert_equals(decodedStruct.f3, mojo.test.IntegerNumberValues.V3); |
177 }, 'float number values'); | 178 assert_equals(decodedStruct.f4, mojo.test.IntegerNumberValues.V4); |
178 | 179 assert_equals(decodedStruct.f5, mojo.test.IntegerNumberValues.V5); |
179 test(() => { | 180 assert_equals(decodedStruct.f6, mojo.test.IntegerNumberValues.V6); |
180 var decodedStruct = structEncodeDecode(new testStructs.IntegerNumberValues); | 181 assert_equals(decodedStruct.f7, mojo.test.IntegerNumberValues.V7); |
181 assert_equals(decodedStruct.f0, testStructs.IntegerNumberValues.V0); | 182 assert_equals(decodedStruct.f8, mojo.test.IntegerNumberValues.V8); |
182 assert_equals(decodedStruct.f1, testStructs.IntegerNumberValues.V1); | 183 assert_equals(decodedStruct.f9, mojo.test.IntegerNumberValues.V9); |
183 assert_equals(decodedStruct.f2, testStructs.IntegerNumberValues.V2); | 184 assert_equals(decodedStruct.f10, mojo.test.IntegerNumberValues.V10); |
184 assert_equals(decodedStruct.f3, testStructs.IntegerNumberValues.V3); | 185 assert_equals(decodedStruct.f11, mojo.test.IntegerNumberValues.V11); |
185 assert_equals(decodedStruct.f4, testStructs.IntegerNumberValues.V4); | 186 assert_equals(decodedStruct.f12, mojo.test.IntegerNumberValues.V12); |
186 assert_equals(decodedStruct.f5, testStructs.IntegerNumberValues.V5); | 187 assert_equals(decodedStruct.f13, mojo.test.IntegerNumberValues.V13); |
187 assert_equals(decodedStruct.f6, testStructs.IntegerNumberValues.V6); | 188 assert_equals(decodedStruct.f14, mojo.test.IntegerNumberValues.V14); |
188 assert_equals(decodedStruct.f7, testStructs.IntegerNumberValues.V7); | 189 assert_equals(decodedStruct.f15, mojo.test.IntegerNumberValues.V15); |
189 assert_equals(decodedStruct.f8, testStructs.IntegerNumberValues.V8); | 190 assert_equals(decodedStruct.f16, mojo.test.IntegerNumberValues.V16); |
190 assert_equals(decodedStruct.f9, testStructs.IntegerNumberValues.V9); | 191 assert_equals(decodedStruct.f17, mojo.test.IntegerNumberValues.V17); |
191 assert_equals(decodedStruct.f10, testStructs.IntegerNumberValues.V10); | 192 assert_equals(decodedStruct.f18, mojo.test.IntegerNumberValues.V18); |
192 assert_equals(decodedStruct.f11, testStructs.IntegerNumberValues.V11); | 193 assert_equals(decodedStruct.f19, mojo.test.IntegerNumberValues.V19); |
193 assert_equals(decodedStruct.f12, testStructs.IntegerNumberValues.V12); | 194 }, 'integer number values'); |
194 assert_equals(decodedStruct.f13, testStructs.IntegerNumberValues.V13); | 195 |
195 assert_equals(decodedStruct.f14, testStructs.IntegerNumberValues.V14); | 196 test(() => { |
196 assert_equals(decodedStruct.f15, testStructs.IntegerNumberValues.V15); | 197 var decodedStruct = |
197 assert_equals(decodedStruct.f16, testStructs.IntegerNumberValues.V16); | 198 structEncodeDecode(new mojo.test.UnsignedNumberValues); |
198 assert_equals(decodedStruct.f17, testStructs.IntegerNumberValues.V17); | 199 assert_equals(decodedStruct.f0, mojo.test.UnsignedNumberValues.V0); |
199 assert_equals(decodedStruct.f18, testStructs.IntegerNumberValues.V18); | 200 assert_equals(decodedStruct.f1, mojo.test.UnsignedNumberValues.V1); |
200 assert_equals(decodedStruct.f19, testStructs.IntegerNumberValues.V19); | 201 assert_equals(decodedStruct.f2, mojo.test.UnsignedNumberValues.V2); |
201 }, 'integer number values'); | 202 assert_equals(decodedStruct.f3, mojo.test.UnsignedNumberValues.V3); |
202 | 203 assert_equals(decodedStruct.f4, mojo.test.UnsignedNumberValues.V4); |
203 test(() => { | 204 assert_equals(decodedStruct.f5, mojo.test.UnsignedNumberValues.V5); |
204 var decodedStruct = | 205 assert_equals(decodedStruct.f6, mojo.test.UnsignedNumberValues.V6); |
205 structEncodeDecode(new testStructs.UnsignedNumberValues); | 206 assert_equals(decodedStruct.f7, mojo.test.UnsignedNumberValues.V7); |
206 assert_equals(decodedStruct.f0, testStructs.UnsignedNumberValues.V0); | 207 assert_equals(decodedStruct.f8, mojo.test.UnsignedNumberValues.V8); |
207 assert_equals(decodedStruct.f1, testStructs.UnsignedNumberValues.V1); | 208 assert_equals(decodedStruct.f9, mojo.test.UnsignedNumberValues.V9); |
208 assert_equals(decodedStruct.f2, testStructs.UnsignedNumberValues.V2); | 209 assert_equals(decodedStruct.f10, mojo.test.UnsignedNumberValues.V10); |
209 assert_equals(decodedStruct.f3, testStructs.UnsignedNumberValues.V3); | 210 assert_equals(decodedStruct.f11, mojo.test.UnsignedNumberValues.V11); |
210 assert_equals(decodedStruct.f4, testStructs.UnsignedNumberValues.V4); | 211 }, 'unsigned number values'); |
211 assert_equals(decodedStruct.f5, testStructs.UnsignedNumberValues.V5); | 212 |
212 assert_equals(decodedStruct.f6, testStructs.UnsignedNumberValues.V6); | 213 test(() => { |
213 assert_equals(decodedStruct.f7, testStructs.UnsignedNumberValues.V7); | 214 var bitArraysStruct = new mojo.test.BitArrayValues({ |
214 assert_equals(decodedStruct.f8, testStructs.UnsignedNumberValues.V8); | 215 // array<bool, 1> f0; |
215 assert_equals(decodedStruct.f9, testStructs.UnsignedNumberValues.V9); | 216 f0: [true], |
216 assert_equals(decodedStruct.f10, testStructs.UnsignedNumberValues.V10); | 217 // array<bool, 7> f1; |
217 assert_equals(decodedStruct.f11, testStructs.UnsignedNumberValues.V11); | 218 f1: [true, false, true, false, true, false, true], |
218 }, 'unsigned number values'); | 219 // array<bool, 9> f2; |
219 | 220 f2: [true, false, true, false, true, false, true, false, true], |
220 test(() => { | 221 // array<bool> f3; |
221 var bitArraysStruct = new testStructs.BitArrayValues({ | 222 f3: [true, false, true, false, true, false, true, false], |
222 // array<bool, 1> f0; | 223 // array<array<bool>> f4; |
223 f0: [true], | 224 f4: [[true], [false], [true, false], [true, false, true, false]], |
224 // array<bool, 7> f1; | 225 // array<array<bool>?> f5; |
225 f1: [true, false, true, false, true, false, true], | 226 f5: [[true], null, null, [true, false, true, false]], |
226 // array<bool, 9> f2; | 227 // array<array<bool, 2>?> f6; |
227 f2: [true, false, true, false, true, false, true, false, true], | 228 f6: [[true, false], [true, false], [true, false]], |
228 // array<bool> f3; | 229 }); |
229 f3: [true, false, true, false, true, false, true, false], | 230 var decodedStruct = structEncodeDecode(bitArraysStruct); |
230 // array<array<bool>> f4; | 231 assert_weak_equals(decodedStruct, bitArraysStruct); |
231 f4: [[true], [false], [true, false], [true, false, true, false]], | 232 }, 'bit array values'); |
232 // array<array<bool>?> f5; | 233 |
233 f5: [[true], null, null, [true, false, true, false]], | |
234 // array<array<bool, 2>?> f6; | |
235 f6: [[true, false], [true, false], [true, false]], | |
236 }); | |
237 var decodedStruct = structEncodeDecode(bitArraysStruct); | |
238 assert_weak_equals(decodedStruct, bitArraysStruct); | |
239 }, 'bit array values'); | |
240 | |
241 done(); | |
242 }); | |
243 </script> | 234 </script> |
OLD | NEW |