Skip to content

if numbers are not float equals method return false (e.g., 2 instead of 2.0). @G... #123

@github-actions

Description

@github-actions

# TODO: if numbers are not float equals method return false (e.g., 2 instead of 2.0). @Giovanni 2ppy

import unittest
from tuprolog.theory import mutable_theory, theory
from tuprolog.theory.parsing import parse_theory
from psyke.utils.logic import simplify


class TestSimplify(unittest.TestCase):

    def test_simplify(self):
        # TODO: if numbers are not float equals method return false (e.g., 2 instead of 2.0). @Giovanni 2ppy
        textual_theory = "p(X, Y, inside) :- ('=<'(X, 1.0), '>'(Y, 2.0), '=<'(X, 0.5))."
        textual_simplified_theory = "p(X, Y, inside) :- ('=<'(X, 0.5), '>'(Y, 2.0))."
        long_theory = mutable_theory(parse_theory(textual_theory))
        simplified_theory = theory(parse_theory(textual_simplified_theory))

        self.assertTrue(simplified_theory.equals(simplify(long_theory), False))


if __name__ == '__main__':
    unittest.main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions