Example #1
0
def test_dtype_from_type_complex():
    """
    Test to-numpy translation of a complex LLVM type.
    """

    from llvm.core  import Type
    from qy         import (
        type_from_dtype,
        dtype_from_type,
        )

    dtype = numpy.dtype([("f0", [("f0", numpy.int32), ("f1", numpy.int32)], (4,))])
    type_ = Type.struct([Type.array(Type.packed_struct([Type.int(32)] * 2), 4)])
    dtype2 = dtype_from_type(type_)

    assert_equal(dtype2.itemsize, dtype.itemsize)
    assert_equal(str(dtype2), str(dtype))