コード例 #1
0
    def test_sub(self, a_str: str, b_str: str, expected_result_str: str):
        a = quant.from_string(a_str)
        b = quant.from_string(b_str)
        expected_result = quant.from_string(expected_result_str)

        assert quant.isclose(quant.sub(a, b), expected_result)
        assert quant.isclose(a - b, expected_result)
コード例 #2
0
    def test_neg(self, a_str: str, b_str: str):
        a = quant.from_string(a_str)
        b = quant.from_string(b_str)

        assert quant.isclose(quant.neg(a), b)
        assert quant.isclose(-a, b)
        assert quant.isclose(quant.neg(b), a)
        assert quant.isclose(-b, a)
コード例 #3
0
    def test_add(self, a_str: str, b_str: str, expected_result_str: str):
        a = quant.from_string(a_str)
        b = quant.from_string(b_str)
        expected_result = quant.from_string(expected_result_str)

        assert quant.isclose(quant.add(a, b), expected_result)
        assert quant.isclose(a + b, expected_result)

        assert quant.isclose(quant.add(b, a), expected_result)
        assert quant.isclose(b + a, expected_result)
コード例 #4
0
    def test_isclose(self, a_str: str, b_str: str, expected_result: bool):
        a = quant.from_string(a_str)
        b = quant.from_string(b_str)

        assert quant.isclose(a, b) == expected_result
        assert quant.isclose(b, a) == expected_result
コード例 #5
0
    def test_pos(self, a_str: str, b_str: str):
        a = quant.from_string(a_str)
        b = quant.from_string(b_str)

        assert quant.isclose(+a, b)
コード例 #6
0
    def test_pow(self, a: float, b_str: str, result_str: str):
        b = quant.from_string(b_str)
        result = quant.from_string(result_str)

        assert quant.isclose(quant.pow(a, b), result)
コード例 #7
0
    def test_absolute(self, a_str: str, b_str: str):
        a = quant.from_string(a_str)
        b = quant.from_string(b_str)

        assert quant.isclose(quant.abs(a), b)
        assert quant.isclose(abs(a), b)
コード例 #8
0
    def test_log10(self, a_str: str, result_str: str):
        a = quant.from_string(a_str)
        result = quant.from_string(result_str)

        assert quant.isclose(quant.log10(a), result)