Esempio n. 1
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)
Esempio n. 2
0
import sys
import excentury as xc
import objects as obj
import numpy as np

point_obj = obj.Point(34.1, 4)
line_obj = obj.Line(100, 200, 300, 400)
tensor_obj = np.array([[1.0,2,3],[4,5,6]])
array_obj = np.array([obj.Point(1,0), obj.Point(2,4)])

out = xc.to_text(
    ('A', "v_char"),
    (127, "v_byte", "byte"),
    (255, "v_ubyte", "ubyte"),
    (2, "v_short", "short"),
    (10, "v_int", "int"),
    (123456789, "v_long", "long"),
    (2, "v_ushort", "ushort"),
    (10, "v_uint", "uint"),
    (123456789, "v_ulong", "ulong"),
    (3.14, "v_float", "float"),
    (0.007, "v_double", "double"),
    ('hello world', "v_str"),
    (point_obj, "point_obj"),
    (line_obj, "line_obj"),
    array_obj=array_obj,
    tensor_obj=tensor_obj
)
sys.stdout.write(out)