# Path: eppy/pytest_helpers.py
# def almostequal(first, second, places=7, printit=True):
#     """docstring for almostequal
#     # taken from python's unit test
#     # may be covered by Python's license
# 
#     """
#     if round(abs(second - first), places) != 0:
#         if printit:
#             print(round(abs(second - first), places))
#             print("notalmost: %s != %s" % (first, second))
#         return False
#     else:
#         return True


import eppy.geometry.surface as surface
from eppy.pytest_helpers import almostequal
                (1.664906, -5.014146, 0.0),
            ],
            5,
        ),
        ([(0.0, 0.0, 3.0), (0.0, 0.0, 2.4), (30.5, 0.0, 2.4), (30.5, 0.0, 3.0)], 0.6),
    )
    for poly, expected in data:
        result = surface.height(poly)
        assert almostequal(expected, result, places=5) == True


def test_width():
    """test the width of a polygon poly """
    data = (
        ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 1),
        # polygon, expected,
        ([(0, 0, 0), (8, 0, 0), (11, 0, 4), (3, 0, 4)], 8),
        ([(0, 0, 0), (10, 0, 0), (10, 9, 0), (0, 9, 0)], 10),
        (
            [
                (3.571913, -9.390334, 1.487381),
                (10.905826, -6.194443, 1.487381),
                (8.998819, -1.818255, 0.0),
                (1.664906, -5.014146, 0.0),
            ],
            8,
        ),
    )
    for poly, expected in data:
        result = surface.width(poly)

# Path: eppy/pytest_helpers.py
# def almostequal(first, second, places=7, printit=True):
#     """docstring for almostequal
#     # taken from python's unit test
#     # may be covered by Python's license
# 
#     """
#     if round(abs(second - first), places) != 0:
#         if printit:
#             print(round(abs(second - first), places))
#             print("notalmost: %s != %s" % (first, second))
#         return False
#     else:
#         return True


# Path: tests/geometry_tests/test_surface.py
import eppy.geometry.surface as surface
from eppy.pytest_helpers import almostequal

                (1.664906, -5.014146, 0.0),
            ],
            5,
        ),
        ([(0.0, 0.0, 3.0), (0.0, 0.0, 2.4), (30.5, 0.0, 2.4), (30.5, 0.0, 3.0)], 0.6),
    )
    for poly, expected in data:
        result = surface.height(poly)
        assert almostequal(expected, result, places=5) == True


def test_width():
    """test the width of a polygon poly """
    data = (
        ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 1),
        # polygon, expected,
        ([(0, 0, 0), (8, 0, 0), (11, 0, 4), (3, 0, 4)], 8),
        ([(0, 0, 0), (10, 0, 0), (10, 9, 0), (0, 9, 0)], 10),
        (
            [
                (3.571913, -9.390334, 1.487381),
                (10.905826, -6.194443, 1.487381),
                (8.998819, -1.818255, 0.0),
                (1.664906, -5.014146, 0.0),
            ],
            8,
        ),
    )
    for poly, expected in data:
        result = surface.width(poly)

        assert almostequal(expected, result, places=4) == True