Ejemplo n.º 1
0
def test_resolve_line4d(Line4d, name):
    cortopy.eval("Line4d {}: {{1, 2, 3, 4}}, {{6, 7, 8, 9}}".format(name))
    o = cortopy.resolve(name)
    assert type(o.a) == cortopy.types['/Point4d']
    assert type(o.b) == cortopy.types['/Point4d']
    assert (o.a.w, o.a.x, o.a.y, o.a.z) == (4, 1, 2, 3)
    assert (o.b.w, o.b.x, o.b.y, o.b.z) == (9, 6, 7, 8)
Ejemplo n.º 2
0
def test_resolve_line3d(Line3d, name):
    cortopy.eval("Line3d {}: {{1, 2, 3}}, {{6, 7, 8}}".format(name))
    o = cortopy.resolve(name)
    assert type(o.a) == cortopy.types['/Point3d']
    assert type(o.b) == cortopy.types['/Point3d']
    assert (o.a.x, o.a.y, o.a.z) == (1, 2, 3)
    assert (o.b.x, o.b.y, o.b.z) == (6, 7, 8)
Ejemplo n.º 3
0
def test_deserialize_point_once():
    cortopy.eval(
"""
struct PointA::
    x, y: int64
"""
    )
    Point = cortopy.gettype("PointA")
Ejemplo n.º 4
0
def Line4d(Point3d):
    cortopy.eval(
"""
struct Line4d::
    a, b: Point4d
"""
    )
    t = cortopy.gettype("Line4d")
    return t
Ejemplo n.º 5
0
def Point4d(Point3d):
    cortopy.eval(
"""
struct Point4d: Point3d::
    w: int64
"""
    )
    t = cortopy.gettype("Point4d")
    return t
Ejemplo n.º 6
0
def Point3d():
    cortopy.eval(
"""
struct Point3d::
    x, y, z: int64
"""
    )
    t = cortopy.gettype("Point3d")
    return t
Ejemplo n.º 7
0
def test_deserialize_point_twice():
    cortopy.eval(
"""
struct PointB::
    x, y: int64
"""
    )
    Point1 = cortopy.gettype("PointB")
    Point2 = cortopy.gettype("PointB")
    assert Point1 == Point2
Ejemplo n.º 8
0
def test_resolve_point4d(Point4d, name):
    cortopy.eval("Point4d {}: 5, 10, 15, 20".format(name))
    o = cortopy.resolve(name)
    assert type(o) == cortopy.types['/Point4d']
    assert (o.w, o.x, o.y, o.z) == (20, 5, 10, 15)
Ejemplo n.º 9
0
def test_resolve_point3d(name):
    cortopy.eval("Point3d {}: 1, 10, 100".format(name))
    o = cortopy.resolve(name)
    assert type(o) == cortopy.types['/Point3d']
    assert (o.x, o.y, o.z) == (1, 10, 100)
Ejemplo n.º 10
0
def test_resolve_int8(name):
    cortopy.eval("int8 {}: 99".format(name))
    o = cortopy.resolve(name)
    assert o.val == 99
Ejemplo n.º 11
0
def test_eval_expr():
    cortopy.eval("3 + 4")