def test_invertsign():
    q1 = Qualean(random.choice([-1, 0, 1]))
    if q1.get_number() < 0:
        assert (q1.__invertsign__() > 0) == True, "invertsign not working"
    elif q1.get_number() > 0:
        assert (q1.__invertsign__() < 0) == True, "invertsign not working"
    else:
        assert (q1.__invertsign__() == 0) == True, "invertsign not working"
Exemple #2
0
def test_qualean_lt():
    q1, q2 = Qualean(1), Qualean(0)

    if q1.number > 0:
        q1 = q1.__invertsign__()

    assert q1 < q2
Exemple #3
0
def test_qualean_gt():
    q1, q2 = Qualean(1), Qualean(0)
    
    if q1.number < 0:
        q1 = q1.__invertsign__()

    assert q1 > q2
Exemple #4
0
def test_qualean_le():
    q1, q2, q3 = Qualean(1), Qualean(0), Qualean(0)

    if q1.number > 0:
        q1 = q1.__invertsign__()

    assert q1 <= q2
    assert q2 <= q3
Exemple #5
0
def test_qualean_ge():
    q1, q2, q3 = Qualean(1), Qualean(0), Qualean(0)

    if q1.number < 0:
        q1 = q1.__invertsign__()

    assert q1 >= q2
    assert q2 >= q3
Exemple #6
0
def test_qualean_sqrt():
    decimal.getcontext().prec = 10
    sign = lambda x : copysign(1.0, x)
    q = Qualean(-1)

    if q.number < 0:
        q = q.__invertsign__()

    assert q.__sqrt__() == Decimal(q.number).sqrt()
def test_function_invertsign():
    q1 = Qualean(random.choice(states))
    if q1 != 0:
        assert q1.__invertsign__() == -q1.q
    else:
        assert q1==0