Spaces:
Runtime error
Runtime error
Delete ag4masses/alphageometry/trace_back_test.py
Browse files
ag4masses/alphageometry/trace_back_test.py
DELETED
|
@@ -1,61 +0,0 @@
|
|
| 1 |
-
# Copyright 2023 DeepMind Technologies Limited
|
| 2 |
-
#
|
| 3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
-
# you may not use this file except in compliance with the License.
|
| 5 |
-
# You may obtain a copy of the License at
|
| 6 |
-
#
|
| 7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
-
#
|
| 9 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
-
# See the License for the specific language governing permissions and
|
| 13 |
-
# limitations under the License.
|
| 14 |
-
# ==============================================================================
|
| 15 |
-
|
| 16 |
-
"""Unit testing for the trace_back code."""
|
| 17 |
-
|
| 18 |
-
import unittest
|
| 19 |
-
|
| 20 |
-
from absl.testing import absltest
|
| 21 |
-
import ddar
|
| 22 |
-
import graph as gh
|
| 23 |
-
import problem as pr
|
| 24 |
-
import trace_back as tb
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
class TracebackTest(unittest.TestCase):
|
| 28 |
-
|
| 29 |
-
@classmethod
|
| 30 |
-
def setUpClass(cls):
|
| 31 |
-
super().setUpClass()
|
| 32 |
-
cls.defs = pr.Definition.from_txt_file('defs.txt', to_dict=True)
|
| 33 |
-
cls.rules = pr.Theorem.from_txt_file('rules.txt', to_dict=True)
|
| 34 |
-
|
| 35 |
-
def test_orthocenter_dependency_difference(self):
|
| 36 |
-
txt = 'a b c = triangle a b c; d = on_tline d b a c, on_tline d c a b; e = on_line e a c, on_line e b d ? perp a d b c' # pylint: disable=line-too-long
|
| 37 |
-
p = pr.Problem.from_txt(txt)
|
| 38 |
-
g, _ = gh.Graph.build_problem(p, TracebackTest.defs)
|
| 39 |
-
|
| 40 |
-
ddar.solve(g, TracebackTest.rules, p)
|
| 41 |
-
|
| 42 |
-
goal_args = g.names2nodes(p.goal.args)
|
| 43 |
-
query = pr.Dependency(p.goal.name, goal_args, None, None)
|
| 44 |
-
|
| 45 |
-
setup, aux, _, _ = tb.get_logs(query, g, merge_trivials=False)
|
| 46 |
-
|
| 47 |
-
# Convert each predicates to its hash string:
|
| 48 |
-
setup = [p.hashed() for p in setup]
|
| 49 |
-
aux = [p.hashed() for p in aux]
|
| 50 |
-
|
| 51 |
-
self.assertCountEqual(
|
| 52 |
-
setup, [('perp', 'a', 'c', 'b', 'd'), ('perp', 'a', 'b', 'c', 'd')]
|
| 53 |
-
)
|
| 54 |
-
|
| 55 |
-
self.assertCountEqual(
|
| 56 |
-
aux, [('coll', 'a', 'c', 'e'), ('coll', 'b', 'd', 'e')]
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
if __name__ == '__main__':
|
| 61 |
-
absltest.main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|