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