s = "hello world"

b = li_std_string_extra.B("hi")

b.name = li_std_string_extra.string("hello")
if b.name != "hello":
    raise RuntimeError, "bad string mapping"

b.a = li_std_string_extra.A("hello")
if b.a != "hello":
    raise RuntimeError, "bad string mapping"

if li_std_string_extra.test_value_basic1(x) != x:
    raise RuntimeError, "bad string mapping"

if li_std_string_extra.test_value_basic2(x) != x:
    raise RuntimeError, "bad string mapping"

if li_std_string_extra.test_value_basic3(x) != x:
    raise RuntimeError, "bad string mapping"

# Global variables
s = "initial string"
if li_std_string_extra.cvar.GlobalString2 != "global string 2":
    raise RuntimeError, "GlobalString2 test 1"
li_std_string_extra.cvar.GlobalString2 = s
if li_std_string_extra.cvar.GlobalString2 != s:
    raise RuntimeError, "GlobalString2 test 2"
if li_std_string_extra.cvar.ConstGlobalString != "const global string":
    raise RuntimeError, "ConstGlobalString test"
Пример #2
0
b = li_std_string_extra.B("hi")

b.name = li_std_string_extra.string("hello")
if b.name != "hello":
    raise RuntimeError, "bad string mapping"


b.a = li_std_string_extra.A("hello")
if b.a != "hello":
    raise RuntimeError, "bad string mapping"


if li_std_string_extra.test_value_basic1(x) != x:
    raise RuntimeError, "bad string mapping"

if li_std_string_extra.test_value_basic2(x) != x:
    raise RuntimeError, "bad string mapping"


if li_std_string_extra.test_value_basic3(x) != x:
    raise RuntimeError, "bad string mapping"

if li_std_string_extra.test_value_basic_overload(x) != x:
    raise RuntimeError, "bad overload string"

if li_std_string_extra.test_value_basic_overload(123) != "int":
    raise RuntimeError, "bad overload int"

try:
    li_std_string_extra.test_value_basic_overload([x])
    raise RuntimeError, "should throw NotImplementedError"