Test that AR can figure out bisector & ex-bisector are perpendicular.
(self)
| 86 | self.assertIn(('b', 'd', ['fact1', 'fact2']), result) |
| 87 | |
| 88 | def test_angle_table_inbisector_exbisector(self): |
| 89 | """Test that AR can figure out bisector & ex-bisector are perpendicular.""" |
| 90 | # Load the scenario that we have cd is bisector of acb and |
| 91 | # ce is the ex-bisector of acb. |
| 92 | p = pr.Problem.from_txt( |
| 93 | 'a b c = triangle a b c; d = incenter d a b c; e = excenter e a b c ?' |
| 94 | ' perp d c c e' |
| 95 | ) |
| 96 | g, _ = gh.Graph.build_problem(p, ARTest.defs) |
| 97 | |
| 98 | # Create an external angle table: |
| 99 | tb = ar.AngleTable('pi') |
| 100 | |
| 101 | # Add bisector & ex-bisector facts into the table: |
| 102 | ca, cd, cb, ce = g.names2nodes(['d(ac)', 'd(cd)', 'd(bc)', 'd(ce)']) |
| 103 | tb.add_eqangle(ca, cd, cd, cb, 'fact1') |
| 104 | tb.add_eqangle(ce, ca, cb, ce, 'fact2') |
| 105 | |
| 106 | # Add a distractor fact to make sure traceback does not include this fact |
| 107 | ab = g.names2nodes(['d(ab)'])[0] |
| 108 | tb.add_eqangle(ab, cb, cb, ca, 'fact3') |
| 109 | |
| 110 | # Check for all new equalities |
| 111 | result = list(tb.get_all_eqs_and_why()) |
| 112 | |
| 113 | # halfpi is represented as a tuple (1, 2) |
| 114 | halfpi = (1, 2) |
| 115 | |
| 116 | # check that cd-ce == halfpi and this is because fact1 & fact2, not fact3 |
| 117 | self.assertCountEqual( |
| 118 | result, |
| 119 | [ |
| 120 | (cd, ce, halfpi, ['fact1', 'fact2']), |
| 121 | (ce, cd, halfpi, ['fact1', 'fact2']), |
| 122 | ], |
| 123 | ) |
| 124 | |
| 125 | def test_angle_table_equilateral_triangle(self): |
| 126 | """Test that AR can figure out triangles with 3 equal angles => each is pi/3.""" |
nothing calls this directly
no test coverage detected