def test_basic_parser(): link(A, B) link(A, C) link(B, C) set_angle('ABC', 90) set_angle('ACB', 30) assert get_angle('BAC') == 60 clear()
def test_advanced_parser(): link(A, D, B) link(A, E, C) link(D, F, C) link(B, F, E) link(B, C) set_angle('BAC', 45) set_angle('ABE', 40) set_angle('ACD', 20) assert round(get_angle('EFC'), 6) == 75 clear()
def test_parser_example2(): link(A, B, C, E) link(B, D) link(D, E) set_angle('ABD', 120) set_angle('BDE', 30) set_length('BD', 210) result = get_length('DE') assert abs(result - (3**(1/2) / 2) * 210) < 1e-6 clear()
def test_parser_example4(): link(A, B) link(A, N, C) link(B, M, C) link(M, N) set_length('AB', 5) set_length('AC', 5) set_length('BC', 6) perpendicular('MN', 'AC') split_line('BC', 'M', 0.5) assert round(get_length('MN'), 6) == 2.4 clear()
def test_parser_example3(): link(A, B) link(A, F) link(A, D) link(A, C) link(B, F, D, C) set_angle('ABC', 36) set_angle('ACB', 76) split_angle('BAC', 'AF', ratio=0.5) set_common_vertex_angles('A', ['B', 'F', 'D', 'C']) perpendicular('AD', 'BC') assert round(get_angle('DAF'), 6) == 20 clear()
def test_parser_example1(): link(A, D) link(A, B) link(A, E, C) link(B, E, D) link(B, C) set_angle('BAC', 60) set_angle('ACB', 30) set_angle('ADB', 45) set_angle('ABD', 45) set_angle('BAD', 90) set_angle('ABC', 90) assert round(get_angle('AEB'), 6) == 75 clear()
def test_parser_example7(): # link(A, B) # link(A, E, D) # link(B, D, C) # link(B, E) # link(C, E) # set_angle('ABC', 50) # split_angle('ABC', 'BE', 0.5) # perpendicular('AD', 'BC') # set_common_vertex_angles('E', ['B', 'D', 'C']) # set_common_vertex_angles('B', ['A', 'E', 'C']) # assert round(get_angle('AEC'), 6) == 59 clear()
def test_parser_example6(): # link(A, E, C) # link(B, D, C) # link(A, B) # link(A, F, D) # link(B, F, E) # set_angle('ACB', 70) # set_angle('ABC', 48) # split_angle('BAC', 'AD', 0.5) # perpendicular('AC', 'BE') # set_common_vertex_angles('A', ['B', 'D', 'C']) # set_common_vertex_angles('B', ['A', 'E', 'C']) # assert round(get_angle('BFD'), 6) == 59 clear()