1--TEST--
2Test parsing of binary quantities
3--EXTENSIONS--
4zend_test
5--FILE--
6<?php
7
8// This test checks valid formats do not throw any warnings.
9foreach (['', ' '] as $leadingWS) {
10  foreach (['', '+', '-'] as $sign) {
11    foreach (['', ' '] as $midWS) {
12      // Ignore G due to overflow on 32bits
13      foreach (['', 'K', 'k', 'M', 'm'] as $exp) {
14        foreach (['', ' '] as $trailingWS) {
15          $setting = sprintf('%s%s0b11%s%s%s',
16                             $leadingWS, $sign, $midWS, $exp, $trailingWS);
17          printf("# \"%s\"\n", $setting);
18          var_dump(zend_test_zend_ini_parse_quantity($setting));
19          print "\n";
20
21          $setting = sprintf('%s%s0B11%s%s%s',
22                             $leadingWS, $sign, $midWS, $exp, $trailingWS);
23          printf("# \"%s\"\n", $setting);
24          var_dump(zend_test_zend_ini_parse_quantity($setting));
25          print "\n";
26        }
27      }
28    }
29  }
30}
31--EXPECT--
32# "0b11"
33int(3)
34
35# "0B11"
36int(3)
37
38# "0b11 "
39int(3)
40
41# "0B11 "
42int(3)
43
44# "0b11K"
45int(3072)
46
47# "0B11K"
48int(3072)
49
50# "0b11K "
51int(3072)
52
53# "0B11K "
54int(3072)
55
56# "0b11k"
57int(3072)
58
59# "0B11k"
60int(3072)
61
62# "0b11k "
63int(3072)
64
65# "0B11k "
66int(3072)
67
68# "0b11M"
69int(3145728)
70
71# "0B11M"
72int(3145728)
73
74# "0b11M "
75int(3145728)
76
77# "0B11M "
78int(3145728)
79
80# "0b11m"
81int(3145728)
82
83# "0B11m"
84int(3145728)
85
86# "0b11m "
87int(3145728)
88
89# "0B11m "
90int(3145728)
91
92# "0b11 "
93int(3)
94
95# "0B11 "
96int(3)
97
98# "0b11  "
99int(3)
100
101# "0B11  "
102int(3)
103
104# "0b11 K"
105int(3072)
106
107# "0B11 K"
108int(3072)
109
110# "0b11 K "
111int(3072)
112
113# "0B11 K "
114int(3072)
115
116# "0b11 k"
117int(3072)
118
119# "0B11 k"
120int(3072)
121
122# "0b11 k "
123int(3072)
124
125# "0B11 k "
126int(3072)
127
128# "0b11 M"
129int(3145728)
130
131# "0B11 M"
132int(3145728)
133
134# "0b11 M "
135int(3145728)
136
137# "0B11 M "
138int(3145728)
139
140# "0b11 m"
141int(3145728)
142
143# "0B11 m"
144int(3145728)
145
146# "0b11 m "
147int(3145728)
148
149# "0B11 m "
150int(3145728)
151
152# "+0b11"
153int(3)
154
155# "+0B11"
156int(3)
157
158# "+0b11 "
159int(3)
160
161# "+0B11 "
162int(3)
163
164# "+0b11K"
165int(3072)
166
167# "+0B11K"
168int(3072)
169
170# "+0b11K "
171int(3072)
172
173# "+0B11K "
174int(3072)
175
176# "+0b11k"
177int(3072)
178
179# "+0B11k"
180int(3072)
181
182# "+0b11k "
183int(3072)
184
185# "+0B11k "
186int(3072)
187
188# "+0b11M"
189int(3145728)
190
191# "+0B11M"
192int(3145728)
193
194# "+0b11M "
195int(3145728)
196
197# "+0B11M "
198int(3145728)
199
200# "+0b11m"
201int(3145728)
202
203# "+0B11m"
204int(3145728)
205
206# "+0b11m "
207int(3145728)
208
209# "+0B11m "
210int(3145728)
211
212# "+0b11 "
213int(3)
214
215# "+0B11 "
216int(3)
217
218# "+0b11  "
219int(3)
220
221# "+0B11  "
222int(3)
223
224# "+0b11 K"
225int(3072)
226
227# "+0B11 K"
228int(3072)
229
230# "+0b11 K "
231int(3072)
232
233# "+0B11 K "
234int(3072)
235
236# "+0b11 k"
237int(3072)
238
239# "+0B11 k"
240int(3072)
241
242# "+0b11 k "
243int(3072)
244
245# "+0B11 k "
246int(3072)
247
248# "+0b11 M"
249int(3145728)
250
251# "+0B11 M"
252int(3145728)
253
254# "+0b11 M "
255int(3145728)
256
257# "+0B11 M "
258int(3145728)
259
260# "+0b11 m"
261int(3145728)
262
263# "+0B11 m"
264int(3145728)
265
266# "+0b11 m "
267int(3145728)
268
269# "+0B11 m "
270int(3145728)
271
272# "-0b11"
273int(-3)
274
275# "-0B11"
276int(-3)
277
278# "-0b11 "
279int(-3)
280
281# "-0B11 "
282int(-3)
283
284# "-0b11K"
285int(-3072)
286
287# "-0B11K"
288int(-3072)
289
290# "-0b11K "
291int(-3072)
292
293# "-0B11K "
294int(-3072)
295
296# "-0b11k"
297int(-3072)
298
299# "-0B11k"
300int(-3072)
301
302# "-0b11k "
303int(-3072)
304
305# "-0B11k "
306int(-3072)
307
308# "-0b11M"
309int(-3145728)
310
311# "-0B11M"
312int(-3145728)
313
314# "-0b11M "
315int(-3145728)
316
317# "-0B11M "
318int(-3145728)
319
320# "-0b11m"
321int(-3145728)
322
323# "-0B11m"
324int(-3145728)
325
326# "-0b11m "
327int(-3145728)
328
329# "-0B11m "
330int(-3145728)
331
332# "-0b11 "
333int(-3)
334
335# "-0B11 "
336int(-3)
337
338# "-0b11  "
339int(-3)
340
341# "-0B11  "
342int(-3)
343
344# "-0b11 K"
345int(-3072)
346
347# "-0B11 K"
348int(-3072)
349
350# "-0b11 K "
351int(-3072)
352
353# "-0B11 K "
354int(-3072)
355
356# "-0b11 k"
357int(-3072)
358
359# "-0B11 k"
360int(-3072)
361
362# "-0b11 k "
363int(-3072)
364
365# "-0B11 k "
366int(-3072)
367
368# "-0b11 M"
369int(-3145728)
370
371# "-0B11 M"
372int(-3145728)
373
374# "-0b11 M "
375int(-3145728)
376
377# "-0B11 M "
378int(-3145728)
379
380# "-0b11 m"
381int(-3145728)
382
383# "-0B11 m"
384int(-3145728)
385
386# "-0b11 m "
387int(-3145728)
388
389# "-0B11 m "
390int(-3145728)
391
392# " 0b11"
393int(3)
394
395# " 0B11"
396int(3)
397
398# " 0b11 "
399int(3)
400
401# " 0B11 "
402int(3)
403
404# " 0b11K"
405int(3072)
406
407# " 0B11K"
408int(3072)
409
410# " 0b11K "
411int(3072)
412
413# " 0B11K "
414int(3072)
415
416# " 0b11k"
417int(3072)
418
419# " 0B11k"
420int(3072)
421
422# " 0b11k "
423int(3072)
424
425# " 0B11k "
426int(3072)
427
428# " 0b11M"
429int(3145728)
430
431# " 0B11M"
432int(3145728)
433
434# " 0b11M "
435int(3145728)
436
437# " 0B11M "
438int(3145728)
439
440# " 0b11m"
441int(3145728)
442
443# " 0B11m"
444int(3145728)
445
446# " 0b11m "
447int(3145728)
448
449# " 0B11m "
450int(3145728)
451
452# " 0b11 "
453int(3)
454
455# " 0B11 "
456int(3)
457
458# " 0b11  "
459int(3)
460
461# " 0B11  "
462int(3)
463
464# " 0b11 K"
465int(3072)
466
467# " 0B11 K"
468int(3072)
469
470# " 0b11 K "
471int(3072)
472
473# " 0B11 K "
474int(3072)
475
476# " 0b11 k"
477int(3072)
478
479# " 0B11 k"
480int(3072)
481
482# " 0b11 k "
483int(3072)
484
485# " 0B11 k "
486int(3072)
487
488# " 0b11 M"
489int(3145728)
490
491# " 0B11 M"
492int(3145728)
493
494# " 0b11 M "
495int(3145728)
496
497# " 0B11 M "
498int(3145728)
499
500# " 0b11 m"
501int(3145728)
502
503# " 0B11 m"
504int(3145728)
505
506# " 0b11 m "
507int(3145728)
508
509# " 0B11 m "
510int(3145728)
511
512# " +0b11"
513int(3)
514
515# " +0B11"
516int(3)
517
518# " +0b11 "
519int(3)
520
521# " +0B11 "
522int(3)
523
524# " +0b11K"
525int(3072)
526
527# " +0B11K"
528int(3072)
529
530# " +0b11K "
531int(3072)
532
533# " +0B11K "
534int(3072)
535
536# " +0b11k"
537int(3072)
538
539# " +0B11k"
540int(3072)
541
542# " +0b11k "
543int(3072)
544
545# " +0B11k "
546int(3072)
547
548# " +0b11M"
549int(3145728)
550
551# " +0B11M"
552int(3145728)
553
554# " +0b11M "
555int(3145728)
556
557# " +0B11M "
558int(3145728)
559
560# " +0b11m"
561int(3145728)
562
563# " +0B11m"
564int(3145728)
565
566# " +0b11m "
567int(3145728)
568
569# " +0B11m "
570int(3145728)
571
572# " +0b11 "
573int(3)
574
575# " +0B11 "
576int(3)
577
578# " +0b11  "
579int(3)
580
581# " +0B11  "
582int(3)
583
584# " +0b11 K"
585int(3072)
586
587# " +0B11 K"
588int(3072)
589
590# " +0b11 K "
591int(3072)
592
593# " +0B11 K "
594int(3072)
595
596# " +0b11 k"
597int(3072)
598
599# " +0B11 k"
600int(3072)
601
602# " +0b11 k "
603int(3072)
604
605# " +0B11 k "
606int(3072)
607
608# " +0b11 M"
609int(3145728)
610
611# " +0B11 M"
612int(3145728)
613
614# " +0b11 M "
615int(3145728)
616
617# " +0B11 M "
618int(3145728)
619
620# " +0b11 m"
621int(3145728)
622
623# " +0B11 m"
624int(3145728)
625
626# " +0b11 m "
627int(3145728)
628
629# " +0B11 m "
630int(3145728)
631
632# " -0b11"
633int(-3)
634
635# " -0B11"
636int(-3)
637
638# " -0b11 "
639int(-3)
640
641# " -0B11 "
642int(-3)
643
644# " -0b11K"
645int(-3072)
646
647# " -0B11K"
648int(-3072)
649
650# " -0b11K "
651int(-3072)
652
653# " -0B11K "
654int(-3072)
655
656# " -0b11k"
657int(-3072)
658
659# " -0B11k"
660int(-3072)
661
662# " -0b11k "
663int(-3072)
664
665# " -0B11k "
666int(-3072)
667
668# " -0b11M"
669int(-3145728)
670
671# " -0B11M"
672int(-3145728)
673
674# " -0b11M "
675int(-3145728)
676
677# " -0B11M "
678int(-3145728)
679
680# " -0b11m"
681int(-3145728)
682
683# " -0B11m"
684int(-3145728)
685
686# " -0b11m "
687int(-3145728)
688
689# " -0B11m "
690int(-3145728)
691
692# " -0b11 "
693int(-3)
694
695# " -0B11 "
696int(-3)
697
698# " -0b11  "
699int(-3)
700
701# " -0B11  "
702int(-3)
703
704# " -0b11 K"
705int(-3072)
706
707# " -0B11 K"
708int(-3072)
709
710# " -0b11 K "
711int(-3072)
712
713# " -0B11 K "
714int(-3072)
715
716# " -0b11 k"
717int(-3072)
718
719# " -0B11 k"
720int(-3072)
721
722# " -0b11 k "
723int(-3072)
724
725# " -0B11 k "
726int(-3072)
727
728# " -0b11 M"
729int(-3145728)
730
731# " -0B11 M"
732int(-3145728)
733
734# " -0b11 M "
735int(-3145728)
736
737# " -0B11 M "
738int(-3145728)
739
740# " -0b11 m"
741int(-3145728)
742
743# " -0B11 m"
744int(-3145728)
745
746# " -0b11 m "
747int(-3145728)
748
749# " -0B11 m "
750int(-3145728)
751