Example #1
0
def test_y():
    a = Quaternion()
    assert a.y == 0

    a = Quaternion(1, 2, 3)
    assert a.y == 2

    a = Quaternion(4, 5, 6, 1)
    assert a.y == 5

    a = Quaternion(7, 8, 9)
    a.y = 10
    assert a.y == 10

    a = Quaternion(11, 12, 13)
    a.y = 14
    assert a.y == 14
Example #2
0
def test_properties():
    a = Quaternion()
    a.x = x
    a.y = y
    a.z = z
    a.w = w

    assert a.x == x, "Check x"
    assert a.y == y, "Check y"
    assert a.z == z, "Check z"
    assert a.w == w, "Check w"
Example #3
0
def test_copy():
    a = Quaternion(x, y, z, w)
    b = Quaternion().copy(a)
    assert b.x == x
    assert b.y == y
    assert b.z == z
    assert b.w == w

    # ensure that it is a True copy
    a.x = 0
    a.y = -1
    a.z = 0
    a.w = -1
    assert b.x == x
    assert b.y == y