コード例 #1
0
def test_cpp_load_text():
    """[CPP] load_text.cpp: """
    build_run('load_text', "", """v_char: A
(int)v_byte: 127
(int)v_ubyte: 255
v_short: 2
v_int: 10
v_long: 123456789
v_ushort: 2
v_uint: 10
v_ulong: 123456789
v_float: 3.14
v_double: 0.007
v_str: hello world
point_obj: Point(34.100000, 4.000000)
line_obj: [Point(100.000000, 200.000000), Point(300.000000, 400.000000)]
array_obj: 
  Point(1.000000, 0.000000)
  Point(2.000000, 4.000000)
tensor_obj: 
  1.000000
  2.000000
  3.000000
  4.000000
""")
コード例 #2
0
ファイル: test_debug.py プロジェクト: jmlopez-rod/excentury
def test_debug1():
    """debug.run1: """
    exp_out = """Hello world\n"""
    exp_err = """\x1b[1;31mERROR CAUGHT BY\x1b[0m \x1b[36m\
%s/cpp/debug.cpp\x1b[0m \
line \x1b[1m7\x1b[0m executing: \n\n    \x1b[1mint main()\n\n\
\x1b[0mThe error occurred because:  \x1b[1mtrue\
\x1b[0m\n\n\x1b[1mThis is a test to check that DEBUG is \
on.\n\x1b[0m""" % os.path.dirname(__file__)
    build_run('debug', exp_err, exp_out, 1)
コード例 #3
0
def test_cpp_to_text():
    """[CPP] to_text.cpp: """
    build_run("to_text", "", """2
Point x R 8 y R 8 
Line a S Point b S Point 
16
v_char C 1 A 
v_byte I 1 127 
v_ubyte N 1 255 
v_short I 2 2 
v_int I 4 10 
v_long I 8 123456789 
v_ushort N 2 2 
v_uint N 4 10 
v_ulong N 8 123456789 
v_float R 4 3.14 
v_double R 8 0.007 
v_str W 11 hello world 
point_obj S Point 34.1 4 
line_obj S Line 100 200 300 400 
array_obj T S Point 0 1 2 1 0 2 4 
tensor_obj T R 8 0 1 4 1 2 3 4 
""")
コード例 #4
0
def test_cpp_dump_text():
    """[CPP] dump_text.cpp: """
    build_run("dump_text", "", "")
    str_eq(open("tmp.xc", "r").read(), """2
Point x R 8 y R 8 
Line a S Point b S Point 
16
v_char C 1 A 
v_byte I 1 127 
v_ubyte N 1 255 
v_short I 2 2 
v_int I 4 10 
v_long I 8 123456789 
v_ushort N 2 2 
v_uint N 4 10 
v_ulong N 8 123456789 
v_float R 4 3.140000 
v_double R 8 0.007000 
v_str W 11 hello world 
point_obj S Point 34.100000 4.000000 
line_obj S Line 100.000000 200.000000 300.000000 400.000000 
array_obj T S Point 0 1 2 1.000000 0.000000 2.000000 4.000000 
tensor_obj T R 8 0 1 4 1.000000 2.000000 3.000000 4.000000 
""")
コード例 #5
0
ファイル: test_debug.py プロジェクト: jmlopez-rod/excentury
def test_nodebug():
    """debug.run: """
    exp_err = ""
    exp_out = """Hello world\nDebug was turned off...\n"""
    build_run('debug', exp_err, exp_out)
コード例 #6
0
ファイル: test_tensor.py プロジェクト: jmlopez-rod/excentury
def test_dynamic_tensor():
    """[CPP] dynamic_tensor.cpp: """
    build_run("dynamic_tensor", "", EXPECTED_OUTPUT)
コード例 #7
0
ファイル: test_tensor.py プロジェクト: jmlopez-rod/excentury
def test_static_tensor():
    """[CPP] static_tensor.cpp: """
    build_run("static_tensor", "", EXPECTED_OUTPUT)