Expand li_std_string_runme.php

Re-enable a disabled check and implement more checks based on those
in perl5/li_std_string_runme.pl.
This commit is contained in:
Olly Betts 2021-04-17 18:53:50 +12:00
commit db358d1e42

View file

@ -3,9 +3,33 @@
require "tests.php";
require "li_std_string.php";
// Global variables
//$s="initial string";
//check::equal(GlobalString2_get() ,"global string 2", "GlobalString2 test 1");
# Checking expected use of %typemap(in) std::string {}
li_std_string::test_value("Fee");
# Checking expected result of %typemap(out) std::string {}
check::equal(li_std_string::test_value("Fi"), "Fi", "Test 1");
# Checking expected use of %typemap(in) const std::string & {}
li_std_string::test_const_reference("Fo");
# Checking expected result of %typemap(out) const std::string& {}
check::equal(li_std_string::test_const_reference("Fum"), "Fum", "Test 3");
# Input and output typemaps for pointers and non-const references to
# std::string are *not* supported; the following tests confirm
# that none of these cases are slipping through.
$stringPtr = li_std_string::test_pointer_out();
li_std_string::test_pointer($stringPtr);
$stringPtr = li_std_string::test_const_pointer_out();
li_std_string::test_const_pointer($stringPtr);
$stringPtr = li_std_string::test_reference_out();
li_std_string::test_reference($stringPtr);
// Global variables
$s = "initial string";
@ -24,8 +48,7 @@ check::equal($myStructure->ConstMemberString, "const member string", "ConstMembe
check::equal(Structure::StaticMemberString2(), "static member string 2", "StaticMemberString2 test 1");
Structure::StaticMemberString2($s);
check::equal(Structure::StaticMemberString2(), $s, "StaticMemberString2 test 2");
// below broken ?
//check::equal(Structure::ConstStaticMemberString(), "const static member string", "ConstStaticMemberString test");
check::equal(Structure::ConstStaticMemberString(), "const static member string", "ConstStaticMemberString test");
// This used to give "Undefined variable: r"
li_std_string::test_const_reference_returning_void("foo");