def test_juggler_fest_example(self):
        # Arrange
        circuits, jugglers = input_file_parser.parse_input_file("juggle_fest_example.txt")

        jugglers_prefer = juggler_circuit_matcher.jugglers_to_jugglers_prefers(jugglers)
        circuits_prefer = juggler_circuit_matcher.circuits_to_circuits_prefers(circuits, jugglers)

        expected_matches = {'C2': ['J3', 'J6', 'J10', 'J0'], 'C1': ['J8', 'J9', 'J1', 'J7'], 'C0': ['J11', 'J2', 'J4', 'J5']}

        # Act
        actual_matches = juggler_circuit_matcher.matchmaker(jugglers_prefer, circuits_prefer)

        # Assert
        self.assertEqual(expected_matches, actual_matches)
    def test_generate_output_juggle_fest_example(self):
        # Arrange
        path_to_test_data = os.path.abspath(os.path.realpath('juggle_fest_example.txt'))
        circuits, jugglers = input_file_parser.parse_input_file(path_to_test_data)

        matches = juggler_circuit_matcher.matchmaker(juggler_circuit_matcher.jugglers_to_jugglers_prefers(jugglers),
                                                     juggler_circuit_matcher.circuits_to_circuits_prefers(circuits, jugglers))

        output_file_generator.calc_representation_for_output_for_each_juggler(circuits, jugglers)

        expected_output = 'C2 J3 C2:120 C0:171 C1:31, J6 C2:128 C1:31 C0:188, J10 C0:120 C2:86 C1:21, J0 C2:83 C0:104 C1:17\nC1 J8 C1:21 C0:100 C2:80, J9 C1:23 C2:86 C0:94, J1 C0:119 C2:74 C1:18, J7 C2:75 C1:20 C0:106\nC0 J11 C0:154 C1:27 C2:108, J2 C0:128 C2:68 C1:18, J4 C0:122 C2:106 C1:23, J5 C0:161 C2:112 C1:26\n'

        # Act
        actual_output = output_file_generator.generate_output(matches, jugglers)
        output_file_generator.generate_output_file("juggle_fest_example_output.txt", matches, circuits, jugglers)

        # Assert
        self.assertEqual(expected_output, actual_output)
    def test_generate_output_juggle_fest(self):
        from datetime import datetime
        time_of_start = datetime.now()
        print 'starting test now (takes about 2 minutes to run): ' + str(time_of_start)
        # Arrange
        print 'starting test'
        path_to_test_data = os.path.abspath(os.path.realpath('juggle_fest.txt'))
        circuits, jugglers = input_file_parser.parse_input_file(path_to_test_data)
        print 'done parsing'
        matches = juggler_circuit_matcher.matchmaker(juggler_circuit_matcher.jugglers_to_jugglers_prefers(jugglers),
                                                     juggler_circuit_matcher.circuits_to_circuits_prefers(circuits, jugglers))
        print 'done matching'
        output_file_generator.calc_representation_for_output_for_each_juggler(circuits, jugglers)
        print 'done calculating output representation for jugglers'
        print 'all that is left is write to file!'
        # Act
        output_file_generator.generate_output_file("juggle_fest_output.txt", matches, circuits, jugglers)

        time_of_finish = datetime.now()
        print 'finishing test now: ' + str(time_of_finish)
        print 'total time for test: ' + str(time_of_finish - time_of_start)