arcade-mcp/toolkits/math/tests/test_rational.py
Mateo Torres f04087b389
Math tools expanded (#293)
Migrated all interfaces to get and return strings.

Added tests and evals for all functions (except the random generation)
Math functions are now organized into different math categories

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2025-03-14 09:47:04 -03:00

31 lines
785 B
Python

import pytest
from arcade.sdk.errors import ToolExecutionError
from arcade_math.tools.rational import (
gcd,
lcm,
)
def test_gcd():
assert gcd("-15", "-5") == "5"
assert gcd("15", "0") == "15"
assert gcd("15", "-2") == "1"
assert gcd("15", "-0") == "15"
assert gcd("15", "5") == "5"
assert gcd("7", "13") == "1"
assert gcd("-13", "13") == "13"
with pytest.raises(ToolExecutionError):
gcd("15.0", "5.0")
def test_lcm():
assert lcm("-15", "-5") == "15"
assert lcm("15", "0") == "0"
assert lcm("15", "-2") == "30"
assert lcm("15", "-0") == "0"
assert lcm("15", "5") == "15"
assert lcm("7", "13") == "91"
assert lcm("-13", "13") == "13"
with pytest.raises(ToolExecutionError):
lcm("15.0", "5.0")