Esempio n. 1
0
def test_w():
    a = Quaternion()
    assert a.w == 1

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

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

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

    a = Quaternion(11, 12, 13)
    a.w = 14
    assert a.w == 14
Esempio n. 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"
Esempio n. 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