File: cpp11_auto_variable_runme.php

package info (click to toggle)
swig 4.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,980 kB
  • sloc: cpp: 54,284; ansic: 29,022; java: 17,595; python: 12,734; cs: 10,421; ruby: 7,263; yacc: 6,501; makefile: 5,860; javascript: 5,538; sh: 5,422; perl: 4,246; php: 3,733; ml: 2,198; tcl: 2,015; lisp: 1,448; xml: 115
file content (43 lines) | stat: -rw-r--r-- 1,592 bytes parent folder | download
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
<?php

require "tests.php";

// No new functions
check::functions(array());
check::classes(array('cpp11_auto_variable'));
check::globals(array('f', 't', 'zero', 'one', 'la', 'da', 'fa', 'lc', 'dc', 'fc', 'pi_approx', 'wstring_lit_len1', 'wstring_lit_len2', 'Bar', 'Bar2', 'Bar3', 'CAST_HAD_WRONG_PRECEDENCE1', 'CAST_HAD_WRONG_PRECEDENCE2', 'CAST_HAD_WRONG_PRECEDENCE3', 'CAST_HAD_WRONG_PRECEDENCE4', 'Foo', 'Foo2', 'Foo3', 'NOEXCEPT_FUNC'));

check::equal(f_get(), false);
check::equal(gettype(f_get()), "boolean");
check::equal(t_get(), true);
check::equal(gettype(t_get()), "boolean");

t_set(false);
check::equal(t_get(), false);

check::equal(function_exists('f_set'), false, "f should be constant but f_set() exists");

check::equal(zero_get(), 0);
check::equal(gettype(zero_get()), "integer");
check::equal(one_get(), 1);
check::equal(gettype(one_get()), "integer");

zero_set(42);
check::equal(zero_get(), 42);

check::equal(function_exists('one_set'), false, "one should be constant but one_set() exists");

check::equal(fa_get(), 1.0);
check::equal(da_get(), 1.0);
// PHP doesn't have a native "long double" type, so SWIG/PHP doesn't have
// typemaps for it and so it should get wrapped as an opaque type.
check::str_contains(la_get(), "SWIGPointer(");

check::equal(fc_get(), 1.0);
check::equal(dc_get(), 1.0);
// PHP doesn't have a native "long double" type, so SWIG/PHP doesn't have
// typemaps for it and so it should get wrapped as an opaque type.
check::str_contains(lc_get(), "SWIGPointer(");

check::equal(wstring_lit_len1_get(), 6);
check::equal(wstring_lit_len2_get(), 6);