import unittest

from nose.tools import eq_
from numpy import array

from helix.calculators.bom_helper import get_panel_type_counts
from helix.constants.panel_type import PanelType
from helix.models.panel import Panel


class BomHelperTest(unittest.TestCase):
    def test_get_panel_type_counts(self):
        panels = [Panel(panel_type=PanelType.Corner),
                  Panel(panel_type=PanelType.NorthSouth),
                  Panel(panel_type=PanelType.EastWest),
                  Panel(panel_type=PanelType.Middle),
                  Panel(panel_type=PanelType.Corner),
                  Panel(panel_type=PanelType.EastWest),
                  Panel(panel_type=PanelType.Corner),
                  Panel(panel_type=PanelType.EastWest),
                  Panel(panel_type=PanelType.Corner),
                  Panel(panel_type=PanelType.EastWest),
                  Panel(panel_type=PanelType.EastWest),
                  Panel(panel_type=PanelType.EastWest),
                  Panel(panel_type=PanelType.Corner),
                  Panel(panel_type=PanelType.NorthSouth),
                  Panel(panel_type=PanelType.EastWest)]

        counts = get_panel_type_counts(panels)

        eq_(counts[PanelType.Corner], 5)
        eq_(counts[PanelType.NorthSouth], 2)
        eq_(counts[PanelType.EastWest], 7)
        eq_(counts[PanelType.Middle], 1)

