in tutorials/ComplexArithmetic/testing.py [0:0]
def complex_exp_arbitrary_test(fun):
for i in range(25):
x = prep_random_cartesian()
y = prep_random_cartesian()
if i == 0:
x = (0, 0)
expected = complex_exp_arbitrary_ref(x, y)
actual = fun(x, y)
msg = assert_tuple(actual)
if msg != None:
print(msg)
return
msg = assert_cartesian(expected, actual,
"Result of exponentiation doesn't seem to match expected value: expected ("
+ format_cartesian(x)
+ ")^("
+ format_cartesian(y)
+ ") = "
+ format_cartesian(expected)
+ ", got "
+ format_cartesian(actual))
if msg != None:
print(msg)
return
print("Success!")