37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import mapytex
|
|
|
|
def test_generate_list():
|
|
random_list = mapytex.random.list(["a", "b"])
|
|
assert len(random_list) == 2
|
|
random_list = mapytex.random.list(["a", "b", "c"])
|
|
assert len(random_list) == 3
|
|
random_list = mapytex.random.list(["a", "b", "a", "b"])
|
|
assert random_list[0] == random_list[2]
|
|
assert random_list[1] == random_list[3]
|
|
|
|
def test_generate_list_calculus():
|
|
random_list = mapytex.random.list(["a", "b", "a+b"])
|
|
assert random_list[0] + random_list[1] == random_list[2]
|
|
|
|
random_list = mapytex.random.list(["a", "b", "a-b"])
|
|
assert random_list[0] - random_list[1] == random_list[2]
|
|
|
|
random_list = mapytex.random.list(["a", "b", "a*b"])
|
|
assert random_list[0] * random_list[1] == random_list[2]
|
|
|
|
random_list = mapytex.random.list(["a", "b", "a/b"])
|
|
assert random_list[0] / random_list[1] == random_list[2]
|
|
|
|
def test_generate_list_calculus_math():
|
|
import math
|
|
a, b, gcd = mapytex.random.list(["a", "b", "gcd(a, b)"])
|
|
assert math.gcd(a, b) == gcd
|
|
a, b, exp, log = mapytex.random.list(["a", "b", "exp(a)", "log(b)"])
|
|
assert math.exp(a) == exp
|
|
assert math.log(b) == log
|
|
|
|
|
|
def test_generate_list_conditions():
|
|
random_list = mapytex.random.list(["a", "b"], )
|
|
|