def test_matlab_parse_string():
    """[MATLAB] parse_string.m: """
    cmd = 'matlab -nodisplay -nosplash'
    run_cmd("%s < matlab/parse_string.m > /dev/null" % cmd, "", "")
    str_eq(open("tmp_ml_out.txt", "r").read(), MATLAB_EXP_OUT)
    os.remove("tmp_ml_out.txt")
    os.remove("tmp.xc")
def test_cpp_load_text_str():
    """[CPP] load_text_str.cpp: """
    build_cpp('load_text_str')
    run_cmd('load_text_str.run "`< tmp.xc`"', "", """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
""")
    os.remove('tmp.xc')
Exemple #3
0
def test_xcpp_matlab():
    """[XCPP-MATLAB]: """
    exec_cmd('excentury xc_test.xcpp to matlab --force')
    cmd = 'matlab -nodisplay -nosplash'
    run_cmd("%s < matlab/xc_test.m > /dev/null" % cmd, "", "")
    data = load_file('tmp.xc')
    eq_(data['x'], 4, "Failed...")
    eq_(data['y'], 27, "Failed...")
Exemple #4
0
def test_xcpp_cpp():
    """[XCPP-CPP]: """
    exec_cmd('excentury xc_test.xcpp to cpp --force')
    cmd = 'xc_test-timestwo.run "%s"' % to_text(x=2.0)
    exp_out = '0 1\nresult R 8 4.000000 \n'
    exp_err = ''
    run_cmd(cmd, exp_err, exp_out)
    cmd = 'xc_test-cube.run "%s"' % to_text(x=3)
    exp_out = '0 1\nresult I 4 27 \n'
    exp_err = ''
    run_cmd(cmd, exp_err, exp_out)
def test_python_load_text():
    """[PYTHON] load_text.py: """
    run_cmd("python python/load_text.py", "", EXP_OUT)
def test_matlab_load_text():
    """[MATLAB] load_text.m: """
    cmd = 'matlab -nodisplay -nosplash'
    run_cmd("%s < matlab/load_text.m > /dev/null" % cmd, "", "")
    str_eq(open("tmp_ml_out.txt", "r").read(), MATLAB_EXP_OUT)
    os.remove("tmp_ml_out.txt")
def test_python_dump_text():
    """[PYTHON] dump_text.py: """
    run_cmd("python python/dump_text.py", "", "")
    str_eq(open("tmp.xc", "r").read(), PYTHON_FILE_CONTENT)
def test_python_to_text():
    """[PYTHON] to_text.py: """
    run_cmd("python python/to_text.py", "", PYTHON_FILE_CONTENT)
def test_matlab_dump_text():
    """[MATLAB] dump_text.m: """
    cmd = 'matlab -nodisplay -nosplash'
    run_cmd("%s < matlab/dump_text.m > /dev/null" % cmd, "", "")
    str_eq(open("tmp.xc", "r").read(), MATLAB_FILE_CONTENT)