Example #1
0
h = "h"
check_equal(li_std_wstring.test_wcvalue(h), h)

x = "abc"
check_equal(li_std_wstring.test_ccvalue(x), x)
check_equal(li_std_wstring.test_cvalue(x), x)

check_equal(li_std_wstring.test_wchar_overload(x), x)
check_equal(li_std_wstring.test_wchar_overload(), None)

li_std_wstring.test_pointer(None)
li_std_wstring.test_const_pointer(None)

try:
    li_std_wstring.test_value(None)
    raise RuntimeError("NULL check failed")
except TypeError as e:
    pass

try:
    li_std_wstring.test_reference(None)
    raise RuntimeError("NULL check failed")
except ValueError as e:
    if "invalid null reference" not in str(e):
        raise RuntimeError("Missing text {}".format(e))
try:
    li_std_wstring.test_const_reference(None)
    raise RuntimeError("NULL check failed")
except ValueError as e:
    if "invalid null reference" not in str(e):
Example #2
0
import li_std_wstring

x = u"h"

if li_std_wstring.test_wcvalue(x) != x:
    print li_std_wstring.test_wcvalue(x)
    raise RuntimeError, "bad string mapping"

x = u"hello"
if li_std_wstring.test_ccvalue(x) != x:
    raise RuntimeError, "bad string mapping"

if li_std_wstring.test_cvalue(x) != x:
    raise RuntimeError, "bad string mapping"

if li_std_wstring.test_value(x) != x:
    print x, li_std_wstring.test_value(x)
    raise RuntimeError, "bad string mapping"

if li_std_wstring.test_const_reference(x) != x:
    raise RuntimeError, "bad string mapping"

s = li_std_wstring.wstring(u"he")
s = s + u"llo"

if s != x:
    print s, x
    raise RuntimeError, "bad string mapping"

if s[1:4] != x[1:4]:
    raise RuntimeError, "bad string mapping"
import li_std_wstring

x=u"h"

if li_std_wstring.test_wcvalue(x) != x:
  print li_std_wstring.test_wcvalue(x)
  raise RuntimeError, "bad string mapping"

x=u"hello"
if li_std_wstring.test_ccvalue(x) != x:
  raise RuntimeError, "bad string mapping"

if li_std_wstring.test_cvalue(x) != x:
  raise RuntimeError, "bad string mapping"

if li_std_wstring.test_value(x) != x:
  print x, li_std_wstring.test_value(x)
  raise RuntimeError, "bad string mapping"

if li_std_wstring.test_const_reference(x) != x:
  raise RuntimeError, "bad string mapping"


s = li_std_wstring.wstring(u"he")
s = s + u"llo"

if s != x:
  print s, x
  raise RuntimeError, "bad string mapping"

if s[1:4] != x[1:4]: