Lines Matching refs:msg

73     var msg = new proto.jspb.test.TestProto3();
75 assertEquals(msg.getOptionalInt32(), 0);
76 assertEquals(msg.getOptionalInt64(), 0);
77 assertEquals(msg.getOptionalUint32(), 0);
78 assertEquals(msg.getOptionalUint64(), 0);
79 assertEquals(msg.getOptionalSint32(), 0);
80 assertEquals(msg.getOptionalSint64(), 0);
81 assertEquals(msg.getOptionalFixed32(), 0);
82 assertEquals(msg.getOptionalFixed64(), 0);
83 assertEquals(msg.getOptionalSfixed32(), 0);
84 assertEquals(msg.getOptionalSfixed64(), 0);
85 assertEquals(msg.getOptionalFloat(), 0);
86 assertEquals(msg.getOptionalDouble(), 0);
87 assertEquals(msg.getOptionalString(), '');
91 assertEquals(typeof msg.getOptionalBytes(), 'string');
92 assertEquals(msg.getOptionalBytes_asU8() instanceof Uint8Array, true);
93 assertEquals(typeof msg.getOptionalBytes_asB64(), 'string');
94 assertEquals(msg.getOptionalBytes().length, 0);
95 assertEquals(msg.getOptionalBytes_asU8().length, 0);
96 assertEquals(msg.getOptionalBytes_asB64(), '');
98 assertEquals(msg.getOptionalForeignEnum(),
100 assertEquals(msg.getOptionalForeignMessage(), undefined);
101 assertEquals(msg.getOptionalForeignMessage(), undefined);
103 assertEquals(msg.getRepeatedInt32List().length, 0);
104 assertEquals(msg.getRepeatedInt64List().length, 0);
105 assertEquals(msg.getRepeatedUint32List().length, 0);
106 assertEquals(msg.getRepeatedUint64List().length, 0);
107 assertEquals(msg.getRepeatedSint32List().length, 0);
108 assertEquals(msg.getRepeatedSint64List().length, 0);
109 assertEquals(msg.getRepeatedFixed32List().length, 0);
110 assertEquals(msg.getRepeatedFixed64List().length, 0);
111 assertEquals(msg.getRepeatedSfixed32List().length, 0);
112 assertEquals(msg.getRepeatedSfixed64List().length, 0);
113 assertEquals(msg.getRepeatedFloatList().length, 0);
114 assertEquals(msg.getRepeatedDoubleList().length, 0);
115 assertEquals(msg.getRepeatedStringList().length, 0);
116 assertEquals(msg.getRepeatedBytesList().length, 0);
117 assertEquals(msg.getRepeatedForeignEnumList().length, 0);
118 assertEquals(msg.getRepeatedForeignMessageList().length, 0);
127 var msg = new proto.jspb.test.TestProto3();
129 msg.setOptionalInt32(-42);
130 msg.setOptionalInt64(-0x7fffffff00000000);
131 msg.setOptionalUint32(0x80000000);
132 msg.setOptionalUint64(0xf000000000000000);
133 msg.setOptionalSint32(-100);
134 msg.setOptionalSint64(-0x8000000000000000);
135 msg.setOptionalFixed32(1234);
136 msg.setOptionalFixed64(0x1234567800000000);
137 msg.setOptionalSfixed32(-1234);
138 msg.setOptionalSfixed64(-0x1234567800000000);
139 msg.setOptionalFloat(1.5);
140 msg.setOptionalDouble(-1.5);
141 msg.setOptionalBool(true);
142 msg.setOptionalString('hello world');
143 msg.setOptionalBytes(BYTES);
146 msg.setOptionalForeignMessage(submsg);
147 msg.setOptionalForeignEnum(proto.jspb.test.Proto3Enum.PROTO3_BAR);
149 msg.setRepeatedInt32List([-42]);
150 msg.setRepeatedInt64List([-0x7fffffff00000000]);
151 msg.setRepeatedUint32List([0x80000000]);
152 msg.setRepeatedUint64List([0xf000000000000000]);
153 msg.setRepeatedSint32List([-100]);
154 msg.setRepeatedSint64List([-0x8000000000000000]);
155 msg.setRepeatedFixed32List([1234]);
156 msg.setRepeatedFixed64List([0x1234567800000000]);
157 msg.setRepeatedSfixed32List([-1234]);
158 msg.setRepeatedSfixed64List([-0x1234567800000000]);
159 msg.setRepeatedFloatList([1.5]);
160 msg.setRepeatedDoubleList([-1.5]);
161 msg.setRepeatedBoolList([true]);
162 msg.setRepeatedStringList(['hello world']);
163 msg.setRepeatedBytesList([BYTES]);
166 msg.setRepeatedForeignMessageList([submsg]);
167 msg.setRepeatedForeignEnumList([proto.jspb.test.Proto3Enum.PROTO3_BAR]);
169 msg.setOneofString('asdf');
171 var serialized = msg.serializeBinary();
172 msg = proto.jspb.test.TestProto3.deserializeBinary(serialized);
174 assertEquals(msg.getOptionalInt32(), -42);
175 assertEquals(msg.getOptionalInt64(), -0x7fffffff00000000);
176 assertEquals(msg.getOptionalUint32(), 0x80000000);
177 assertEquals(msg.getOptionalUint64(), 0xf000000000000000);
178 assertEquals(msg.getOptionalSint32(), -100);
179 assertEquals(msg.getOptionalSint64(), -0x8000000000000000);
180 assertEquals(msg.getOptionalFixed32(), 1234);
181 assertEquals(msg.getOptionalFixed64(), 0x1234567800000000);
182 assertEquals(msg.getOptionalSfixed32(), -1234);
183 assertEquals(msg.getOptionalSfixed64(), -0x1234567800000000);
184 assertEquals(msg.getOptionalFloat(), 1.5);
185 assertEquals(msg.getOptionalDouble(), -1.5);
186 assertEquals(msg.getOptionalBool(), true);
187 assertEquals(msg.getOptionalString(), 'hello world');
188 assertEquals(true, bytesCompare(msg.getOptionalBytes(), BYTES));
189 assertEquals(msg.getOptionalForeignMessage().getC(), 16);
190 assertEquals(msg.getOptionalForeignEnum(),
193 assertElementsEquals(msg.getRepeatedInt32List(), [-42]);
194 assertElementsEquals(msg.getRepeatedInt64List(), [-0x7fffffff00000000]);
195 assertElementsEquals(msg.getRepeatedUint32List(), [0x80000000]);
196 assertElementsEquals(msg.getRepeatedUint64List(), [0xf000000000000000]);
197 assertElementsEquals(msg.getRepeatedSint32List(), [-100]);
198 assertElementsEquals(msg.getRepeatedSint64List(), [-0x8000000000000000]);
199 assertElementsEquals(msg.getRepeatedFixed32List(), [1234]);
200 assertElementsEquals(msg.getRepeatedFixed64List(), [0x1234567800000000]);
201 assertElementsEquals(msg.getRepeatedSfixed32List(), [-1234]);
202 assertElementsEquals(msg.getRepeatedSfixed64List(), [-0x1234567800000000]);
203 assertElementsEquals(msg.getRepeatedFloatList(), [1.5]);
204 assertElementsEquals(msg.getRepeatedDoubleList(), [-1.5]);
205 assertElementsEquals(msg.getRepeatedBoolList(), [true]);
206 assertElementsEquals(msg.getRepeatedStringList(), ['hello world']);
207 assertEquals(msg.getRepeatedBytesList().length, 1);
208 assertEquals(true, bytesCompare(msg.getRepeatedBytesList()[0], BYTES));
209 assertEquals(msg.getRepeatedForeignMessageList().length, 1);
210 assertEquals(msg.getRepeatedForeignMessageList()[0].getC(), 1000);
211 assertElementsEquals(msg.getRepeatedForeignEnumList(),
214 assertEquals(msg.getOneofString(), 'asdf');
222 var msg = new proto.jspb.test.TestProto3();
224 assertEquals(msg.getOneofUint32(), undefined);
225 assertEquals(msg.getOneofForeignMessage(), undefined);
226 assertEquals(msg.getOneofString(), undefined);
227 assertEquals(msg.getOneofBytes(), undefined);
229 msg.setOneofUint32(42);
230 assertEquals(msg.getOneofUint32(), 42);
231 assertEquals(msg.getOneofForeignMessage(), undefined);
232 assertEquals(msg.getOneofString(), undefined);
233 assertEquals(msg.getOneofBytes(), undefined);
237 msg.setOneofForeignMessage(submsg);
238 assertEquals(msg.getOneofUint32(), undefined);
239 assertEquals(msg.getOneofForeignMessage(), submsg);
240 assertEquals(msg.getOneofString(), undefined);
241 assertEquals(msg.getOneofBytes(), undefined);
243 msg.setOneofString('hello');
244 assertEquals(msg.getOneofUint32(), undefined);
245 assertEquals(msg.getOneofForeignMessage(), undefined);
246 assertEquals(msg.getOneofString(), 'hello');
247 assertEquals(msg.getOneofBytes(), undefined);
249 msg.setOneofBytes(goog.crypt.base64.encodeString('\u00FF\u00FF'));
250 assertEquals(msg.getOneofUint32(), undefined);
251 assertEquals(msg.getOneofForeignMessage(), undefined);
252 assertEquals(msg.getOneofString(), undefined);
253 assertEquals(msg.getOneofBytes_asB64(),
262 var msg = new proto.jspb.test.TestProto3();
267 msg.setOptionalInt32(42);
268 msg.setOptionalInt32(0);
269 msg.setOptionalDouble(3.14);
270 msg.setOptionalDouble(0.0);
271 msg.setOptionalBool(true);
272 msg.setOptionalBool(false);
273 msg.setOptionalString('hello world');
274 msg.setOptionalString('');
275 msg.setOptionalBytes(goog.crypt.base64.encodeString('\u00FF\u00FF'));
276 msg.setOptionalBytes('');
277 msg.setOptionalForeignMessage(new proto.jspb.test.ForeignMessage());
278 msg.setOptionalForeignMessage(null);
279 msg.setOptionalForeignEnum(proto.jspb.test.Proto3Enum.PROTO3_BAR);
280 msg.setOptionalForeignEnum(proto.jspb.test.Proto3Enum.PROTO3_FOO);
281 msg.setOneofUint32(32);
282 msg.setOneofUint32(null);
285 var serialized = msg.serializeBinary();
293 var msg = new proto.jspb.test.TestProto3();
295 msg.setOptionalBytes(BYTES_B64);
296 assertTrue(bytesCompare(msg.getOptionalBytes_asU8(), BYTES));
297 assertTrue(bytesCompare(msg.getOptionalBytes_asB64(), BYTES));
298 assertTrue(bytesCompare(msg.getOptionalBytes(), BYTES));
301 msg = proto.jspb.test.TestProto3.deserializeBinary(msg.serializeBinary());
302 assertTrue(bytesCompare(msg.getOptionalBytes_asU8(), BYTES));
303 assertTrue(bytesCompare(msg.getOptionalBytes_asB64(), BYTES));
304 assertTrue(bytesCompare(msg.getOptionalBytes(), BYTES));
306 msg = new proto.jspb.test.TestProto3();
308 msg.setOptionalBytes(BYTES);
309 assertTrue(bytesCompare(msg.getOptionalBytes_asU8(), BYTES));
310 assertTrue(bytesCompare(msg.getOptionalBytes_asB64(), BYTES));
311 assertTrue(bytesCompare(msg.getOptionalBytes(), BYTES));