def test_heading(x, y, length):
    a = Vector_C(x, y)

    assert math.atan2(a.y, a.x) == a.heading
    assert -math.pi <= a.heading <= math.pi

    a.set_mag(length)
    b = Vector_C().from_angle(a.heading, length=a.norm)

    assert abs(a.x - b.x) < eps
    assert abs(a.y - b.y) < eps
def test_set_mag(x, y, mags):
    assume(x != 0)
    assume(y != 0)
    assume(mags)
    assume(0 not in mags)

    a = Vector_C(x, y)

    for mag in mags:
        a.set_mag(mag)
        assert abs(a.norm - abs(mag)) < eps