Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/util.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
def assert_equal(thing1, thing2, *args): | def assert_equal(thing1, thing2, *args): | ||||
if thing1 != thing2 or any(thing1 != arg for arg in args): | if thing1 != thing2 or any(thing1 != arg for arg in args): | ||||
raise AssertionError("not(%s)" % " == ".join(str(arg) | raise AssertionError("not(%s)" % " == ".join(str(arg) | ||||
for arg in (thing1, thing2) + args)) | for arg in (thing1, thing2) + args)) | ||||
def assert_equal_float(float1, float2, epsilon=0.00001): | |||||
if abs(float1 - float2) > epsilon: | |||||
raise AssertionError("%s == %s within precision %s" % | |||||
(str(float1), str(float2), str(epsilon))) | |||||
def assert_greater_than(thing1, thing2): | def assert_greater_than(thing1, thing2): | ||||
if thing1 <= thing2: | if thing1 <= thing2: | ||||
raise AssertionError("%s <= %s" % (str(thing1), str(thing2))) | raise AssertionError("%s <= %s" % (str(thing1), str(thing2))) | ||||
def assert_greater_than_or_equal(thing1, thing2): | def assert_greater_than_or_equal(thing1, thing2): | ||||
if thing1 < thing2: | if thing1 < thing2: | ||||
raise AssertionError("%s < %s" % (str(thing1), str(thing2))) | raise AssertionError("%s < %s" % (str(thing1), str(thing2))) | ||||
▲ Show 20 Lines • Show All 575 Lines • Show Last 20 Lines |