summaryrefslogtreecommitdiff
path: root/tests/php/phpt/variables/012-value-casting-operators-double.phpt
blob: babd476556f86e804cfd27874a9fd1b2304a4790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--TEST--
Test Php::Value casting operators (double)
--DESCRIPTION--
The Php::Value class has casting operators to cast the object to almost every thinkable native type.

native_value_casting - repeats the behavior of c++ functions TestVariables\value_casting
the output of each of these functions should be the same
--SKIPIF--
<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?>
--FILEEOF--
<?php



function out($v) {
    echo 'Test ';
    var_export($v);
    echo ':', PHP_EOL;
    TestVariables\value_cast2double($v);
    //echo  (double)$v, PHP_EOL;;
    //echo PHP_EOL;
}

out(5555555555555);
out("999999999999999");
out(99999999999999);
out(5);
out(-99999999);
out("18");
out("3.14159265359");
out(3.14159265359);
out(" this is a string ");
out(" 2-nd string ");
out("false");
out(false);
out("true");
out(true);
out(0);
out("0");
out(0123); // octal number (equivalent to 83 decimal)
out(0x1A); // hexadecimal number (equivalent to 26 decimal)


--EXPECT--
Test 5555555555555:
5555555555555
Test '999999999999999':
999999999999999
Test 99999999999999:
99999999999999
Test 5:
5
Test -99999999:
-99999999
Test '18':
18
Test '3.14159265359':
3.14159265359
Test 3.14159265359:
3.14159265359
Test ' this is a string ':
0
Test ' 2-nd string ':
2
Test 'false':
0
Test false:
0
Test 'true':
0
Test true:
1
Test 0:
0
Test '0':
0
Test 83:
83
Test 26:
26