• Home
  • Raw
  • Download

Lines Matching refs:arr

17         $arr = new MapField(GPBType::INT32, GPBType::INT32);
20 $arr[MAX_INT32] = MAX_INT32;
21 $this->assertSame(MAX_INT32, $arr[MAX_INT32]);
22 $arr[MIN_INT32] = MIN_INT32;
23 $this->assertSame(MIN_INT32, $arr[MIN_INT32]);
24 $this->assertEquals(2, count($arr));
25 $this->assertTrue(isset($arr[MAX_INT32]));
26 $this->assertTrue(isset($arr[MIN_INT32]));
27 unset($arr[MAX_INT32]);
28 unset($arr[MIN_INT32]);
29 $this->assertEquals(0, count($arr));
32 $arr[1.9] = 1.9;
33 $arr[2.1] = 2.1;
34 $this->assertSame(1, $arr[1]);
35 $this->assertSame(2, $arr[2]);
36 $arr[MAX_INT32_FLOAT] = MAX_INT32_FLOAT;
37 $this->assertSame(MAX_INT32, $arr[MAX_INT32]);
38 $arr[MIN_INT32_FLOAT] = MIN_INT32_FLOAT;
39 $this->assertSame(MIN_INT32, $arr[MIN_INT32]);
40 $this->assertEquals(4, count($arr));
41 unset($arr[1.9]);
42 unset($arr[2.9]);
43 unset($arr[MAX_INT32_FLOAT]);
44 unset($arr[MIN_INT32_FLOAT]);
45 $this->assertEquals(0, count($arr));
48 $arr['2'] = '2';
49 $this->assertSame(2, $arr[2]);
50 $arr['3.1'] = '3.1';
51 $this->assertSame(3, $arr[3]);
52 $arr[MAX_INT32_STRING] = MAX_INT32_STRING;
53 $this->assertSame(MAX_INT32, $arr[MAX_INT32]);
54 $this->assertEquals(3, count($arr));
55 unset($arr['2']);
56 unset($arr['3.1']);
57 unset($arr[MAX_INT32_STRING]);
58 $this->assertEquals(0, count($arr));
61 $arr = new MapField(GPBType::INT32, GPBType::INT32);
63 $arr[$i] = $i;
67 foreach ($arr as $key => $val) {
83 $arr = new MapField(GPBType::UINT32, GPBType::UINT32);
86 $arr[MAX_UINT32] = MAX_UINT32;
87 $this->assertSame(-1, $arr[-1]);
88 $this->assertEquals(1, count($arr));
89 unset($arr[MAX_UINT32]);
90 $this->assertEquals(0, count($arr));
92 $arr[-1] = -1;
93 $this->assertSame(-1, $arr[-1]);
94 $arr[MIN_UINT32] = MIN_UINT32;
95 $this->assertSame(MIN_UINT32, $arr[MIN_UINT32]);
96 $this->assertEquals(2, count($arr));
97 unset($arr[-1]);
98 unset($arr[MIN_UINT32]);
99 $this->assertEquals(0, count($arr));
102 $arr[MAX_UINT32_FLOAT] = MAX_UINT32_FLOAT;
103 $this->assertSame(-1, $arr[-1]);
104 $this->assertEquals(1, count($arr));
105 unset($arr[MAX_UINT32_FLOAT]);
106 $this->assertEquals(0, count($arr));
108 $arr[3.1] = 3.1;
109 $this->assertSame(3, $arr[3]);
110 $arr[-1.0] = -1.0;
111 $this->assertSame(-1, $arr[-1]);
112 $arr[MIN_UINT32_FLOAT] = MIN_UINT32_FLOAT;
113 $this->assertSame(MIN_UINT32, $arr[MIN_UINT32]);
114 $this->assertEquals(3, count($arr));
115 unset($arr[3.1]);
116 unset($arr[-1.0]);
117 unset($arr[MIN_UINT32_FLOAT]);
118 $this->assertEquals(0, count($arr));
121 $arr[MAX_UINT32_STRING] = MAX_UINT32_STRING;
122 $this->assertSame(-1, $arr[-1]);
123 $this->assertEquals(1, count($arr));
124 unset($arr[MAX_UINT32_STRING]);
125 $this->assertEquals(0, count($arr));
127 $arr['7'] = '7';
128 $this->assertSame(7, $arr[7]);
129 $arr['3.1'] = '3.1';
130 $this->assertSame(3, $arr[3]);
131 $arr['-1.0'] = '-1.0';
132 $this->assertSame(-1, $arr[-1]);
133 $arr[MIN_UINT32_STRING] = MIN_UINT32_STRING;
134 $this->assertSame(MIN_UINT32, $arr[MIN_UINT32]);
135 $this->assertEquals(4, count($arr));
136 unset($arr['7']);
137 unset($arr['3.1']);
138 unset($arr['-1.0']);
139 unset($arr[MIN_UINT32_STRING]);
140 $this->assertEquals(0, count($arr));
148 $arr = new MapField(GPBType::INT64, GPBType::INT64);
151 $arr[MAX_INT64] = MAX_INT64;
152 $arr[MIN_INT64] = MIN_INT64;
154 $this->assertSame(MAX_INT64_STRING, $arr[MAX_INT64_STRING]);
155 $this->assertSame(MIN_INT64_STRING, $arr[MIN_INT64_STRING]);
157 $this->assertSame(MAX_INT64, $arr[MAX_INT64]);
158 $this->assertSame(MIN_INT64, $arr[MIN_INT64]);
160 $this->assertEquals(2, count($arr));
161 unset($arr[MAX_INT64]);
162 unset($arr[MIN_INT64]);
163 $this->assertEquals(0, count($arr));
166 $arr[1.1] = 1.1;
168 $this->assertSame('1', $arr['1']);
170 $this->assertSame(1, $arr[1]);
172 $this->assertEquals(1, count($arr));
173 unset($arr[1.1]);
174 $this->assertEquals(0, count($arr));
177 $arr['2'] = '2';
178 $arr['3.1'] = '3.1';
179 $arr[MAX_INT64_STRING] = MAX_INT64_STRING;
180 $arr[MIN_INT64_STRING] = MIN_INT64_STRING;
182 $this->assertSame('2', $arr['2']);
183 $this->assertSame('3', $arr['3']);
184 $this->assertSame(MAX_INT64_STRING, $arr[MAX_INT64_STRING]);
185 $this->assertSame(MIN_INT64_STRING, $arr[MIN_INT64_STRING]);
187 $this->assertSame(2, $arr[2]);
188 $this->assertSame(3, $arr[3]);
189 $this->assertSame(MAX_INT64, $arr[MAX_INT64]);
190 $this->assertSame(MIN_INT64, $arr[MIN_INT64]);
192 $this->assertEquals(4, count($arr));
193 unset($arr['2']);
194 unset($arr['3.1']);
195 unset($arr[MAX_INT64_STRING]);
196 unset($arr[MIN_INT64_STRING]);
197 $this->assertEquals(0, count($arr));
205 $arr = new MapField(GPBType::UINT64, GPBType::UINT64);
208 $arr[MAX_UINT64] = MAX_UINT64;
210 $this->assertSame(MAX_UINT64_STRING, $arr[MAX_UINT64_STRING]);
212 $this->assertSame(MAX_UINT64, $arr[MAX_UINT64]);
214 $this->assertEquals(1, count($arr));
215 unset($arr[MAX_UINT64]);
216 $this->assertEquals(0, count($arr));
219 $arr[1.1] = 1.1;
221 $this->assertSame('1', $arr['1']);
223 $this->assertSame(1, $arr[1]);
225 $this->assertEquals(1, count($arr));
226 unset($arr[1.1]);
227 $this->assertEquals(0, count($arr));
230 $arr['2'] = '2';
231 $arr['3.1'] = '3.1';
232 $arr[MAX_UINT64_STRING] = MAX_UINT64_STRING;
235 $this->assertSame('2', $arr['2']);
236 $this->assertSame('3', $arr['3']);
237 $this->assertSame(MAX_UINT64_STRING, $arr[MAX_UINT64_STRING]);
239 $this->assertSame(2, $arr[2]);
240 $this->assertSame(3, $arr[3]);
241 $this->assertSame(MAX_UINT64, $arr[MAX_UINT64]);
244 $this->assertEquals(3, count($arr));
245 unset($arr['2']);
246 unset($arr['3.1']);
247 unset($arr[MAX_UINT64_STRING]);
248 $this->assertEquals(0, count($arr));
256 $arr = new MapField(GPBType::INT32, GPBType::FLOAT);
259 $arr[0] = 1;
260 $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
262 $arr[1] = 1.1;
263 $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
265 $arr[2] = '2';
266 $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
267 $arr[3] = '3.1';
268 $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
270 $this->assertEquals(4, count($arr));
278 $arr = new MapField(GPBType::INT32, GPBType::DOUBLE);
281 $arr[0] = 1;
282 $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
284 $arr[1] = 1.1;
285 $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
287 $arr[2] = '2';
288 $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
289 $arr[3] = '3.1';
290 $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
292 $this->assertEquals(4, count($arr));
300 $arr = new MapField(GPBType::BOOL, GPBType::BOOL);
303 $arr[True] = True;
304 $this->assertSame(True, $arr[True]);
305 $this->assertEquals(1, count($arr));
306 unset($arr[True]);
307 $this->assertEquals(0, count($arr));
309 $arr[False] = False;
310 $this->assertSame(False, $arr[False]);
311 $this->assertEquals(1, count($arr));
312 unset($arr[False]);
313 $this->assertEquals(0, count($arr));
316 $arr[-1] = -1;
317 $this->assertSame(True, $arr[True]);
318 $this->assertEquals(1, count($arr));
319 unset($arr[-1]);
320 $this->assertEquals(0, count($arr));
322 $arr[0] = 0;
323 $this->assertSame(False, $arr[False]);
324 $this->assertEquals(1, count($arr));
325 unset($arr[0]);
326 $this->assertEquals(0, count($arr));
329 $arr[1.1] = 1.1;
330 $this->assertSame(True, $arr[True]);
331 $this->assertEquals(1, count($arr));
332 unset($arr[1.1]);
333 $this->assertEquals(0, count($arr));
335 $arr[0.0] = 0.0;
336 $this->assertSame(False, $arr[False]);
337 $this->assertEquals(1, count($arr));
338 unset($arr[0.0]);
339 $this->assertEquals(0, count($arr));
342 $arr['a'] = 'a';
343 $this->assertSame(True, $arr[True]);
344 $this->assertEquals(1, count($arr));
345 unset($arr['a']);
346 $this->assertEquals(0, count($arr));
348 $arr[''] = '';
349 $this->assertSame(False, $arr[False]);
350 $this->assertEquals(1, count($arr));
351 unset($arr['']);
352 $this->assertEquals(0, count($arr));
360 $arr = new MapField(GPBType::STRING, GPBType::STRING);
363 $arr['abc'] = 'abc';
364 $this->assertSame('abc', $arr['abc']);
365 $this->assertEquals(1, count($arr));
366 unset($arr['abc']);
367 $this->assertEquals(0, count($arr));
369 $arr[1] = 1;
370 $this->assertSame('1', $arr['1']);
371 $this->assertEquals(1, count($arr));
372 unset($arr[1]);
373 $this->assertEquals(0, count($arr));
375 $arr[1.1] = 1.1;
376 $this->assertSame('1.1', $arr['1.1']);
377 $this->assertEquals(1, count($arr));
378 unset($arr[1.1]);
379 $this->assertEquals(0, count($arr));
381 $arr[True] = True;
382 $this->assertSame('1', $arr['1']);
383 $this->assertEquals(1, count($arr));
384 unset($arr[True]);
385 $this->assertEquals(0, count($arr));
388 $arr = new MapField(GPBType::STRING, GPBType::STRING);
390 $arr[$i] = $i;
394 foreach ($arr as $key => $val) {
410 $arr = new MapField(GPBType::INT32,
416 $arr[0] = $sub_m;
417 $this->assertSame(1, $arr[0]->getA());
419 $this->assertEquals(1, count($arr));
422 $arr = new MapField(GPBType::INT32,
425 $arr[$i] = new Sub();;
426 $arr[$i]->setA($i);
431 foreach ($arr as $key => $val) {