improve un/serialization API
[awesomized/ext-ion] / tests / Decimal / toString.phpt
1 --TEST--
2 ion\Decimal::toString
3 --EXTENSIONS--
4 ion
5 --FILE--
6 TEST
7 <?php
8 use ion\Decimal;
9
10 var_dump((new Decimal(1))->toString());
11 var_dump((new Decimal(-1))->toString());
12 var_dump((new Decimal(123456789))->toString());
13 var_dump((new Decimal(-123456789))->toString());
14 try {
15 var_dump((new Decimal("1.23"))->toString());
16 } catch (Throwable) {
17 echo "caught 1.23\n";
18 }
19 try {
20 var_dump((new Decimal("-1.23"))->toString());
21 } catch (Throwable) {
22 echo "caught -1.23\n";
23 }
24 ?>
25 DONE
26 --EXPECT--
27 TEST
28 string(3) "1d0"
29 string(4) "-1d0"
30 string(11) "123456789d0"
31 string(12) "-123456789d0"
32 string(4) "1.23"
33 string(5) "-1.23"
34 DONE