def test_get_set():
    trans_idt = transform_identity()
    # openGLMatrix property
    ref_basis = Matrix3x3(
                1, 2, 3,
                4, 5, 6, 
                7, 8, 9)
    ref_origin = Vector3(1, 2, 3)
    ref_trans = Transform(ref_basis, ref_origin)
    np_mat = np.array((
            1, 4, 7, 0, 
            2, 5, 8, 0,
            3, 6, 9, 0,
            0, 0, 0, 1))
    trans = Transform()
    trans.openGLMatrix = np_mat
    assert (trans.getOpenGLMatrix() == np_mat).all()
    assert (ref_trans.openGLMatrix == np.array((
            1, 4, 7, 0,
            2, 5, 8, 0,
            3, 6, 9, 0, 
            1, 2, 3, 1))).all()
    # origin/basis properties
    trans = Transform()
    trans.origin = ref_origin
    trans.basis = ref_basis
    assert_equal(trans, ref_trans)
    trans = Transform()
    trans.setOrigin(ref_origin)
    trans.setBasis(ref_basis)
    assert_equal(trans.getOrigin(), ref_origin)
    assert_equal(trans.getBasis(), ref_basis)
    # rotation property
    trans = Transform()
    rot = Quaternion()
    rot.setRotation(Vector3(0, 1, 0), math.pi / 2)
    trans.rotation = rot
    trans.origin = ref_origin
    ref_rot_trans = Transform(Matrix3x3(
            0, 0, 1,
            0, 1, 0,
            -1, 0, 0), ref_origin)
    assert_equal(trans, ref_rot_trans)
    # setIdentity()
    trans = Transform()
    trans.setIdentity()
    assert_equal(trans.basis, matrix3x3_identity())
    assert_equal(trans.origin, Vector3(0, 0, 0))
    # mult()
    trans = Transform()
    trans.mult(trans_idt, trans_idt)
    assert_equal(trans, trans_idt)
def test_create():
    vec = Vector3(1, 2, 3)
    quat = Quaternion(0, 0, 0, 1)
    mat = matrix3x3_identity()
    trans = Transform()
    trans = Transform(quat)
    assert_equal(trans.rotation, quat)
    trans = Transform(mat)
    assert_equal(trans.basis, mat)
    trans = Transform(quat, vec)
    assert_equal(trans.rotation, quat)
    assert_equal(trans.origin, vec)
    trans = Transform(mat, vec)
    assert_equal(trans.basis, mat)
    assert_equal(trans.origin, vec)    
    trans_copy = Transform(trans)
    assert_equal(trans, trans_copy)