Ejemplo n.º 1
0
    def test_findEdge(self):
        # arrange
        wf = WaterFountain()
        wf.load(test1)

        # act
        result = wf.findEdge(500,2)
        # assert
        self.assertEqual(result.a, [499,502])
Ejemplo n.º 2
0
    def test_putGridItem(self):
        # arrange
        wf = WaterFountain()
        
        # act
        wf.putGridItem('t', 2, 2)

        # assert
        self.assertEqual(wf.getGridItem(2,2), 't')
Ejemplo n.º 3
0
    def test_findWalls(self):
        # arrange
        wf = WaterFountain()
        wf.load(test1)

        # act
        result = wf.findWalls(499,10)
        # assert
        self.assertEqual(result.a, [498,504])
Ejemplo n.º 4
0
    def test_load_data_wf(self):
        # arrange
        wf = WaterFountain()

        # act
        wf.load(test1)
        result = wf.getGridItem(495,7)

        # assert
        self.assertEqual(result, '#')
Ejemplo n.º 5
0
    def test_tryDown(self):
        # arrange
        wf = WaterFountain()

        # act
        wf.load(test1)
        wf.tryDown(500,0)

        # assert
        wf.printGrid()

        self.assertTrue(True)
Ejemplo n.º 6
0
    def test_do_fill_with_water(self):
        # arrange
        wf = WaterFountain()

        # act
        wf.load(test1)
        wf.doFillWithWater()

        # assert
        wf.printGrid()

        self.assertTrue(True)
Ejemplo n.º 7
0
    def test_grid_print(self):
        # arrange
        wf = WaterFountain()

        # act
        wf.load(test1)

        # assert
        wf.printGrid()

        self.assertTrue(True)
Ejemplo n.º 8
0
# Advent of Code 2018: https://adventofcode.com/2018/day/17
#
# Main file

import datetime, time
from datetime import timedelta

from AoC17_classes import WaterFountain
start = datetime.datetime.now()

inputData = open('../../data/input17.txt', 'r')
liveData = inputData.readlines()

wf = WaterFountain()
wf.load(liveData)

wf.printGrid()
# scores = bb.getScores()

# print('\nPart 1: The outcome of the combat is', inputData, 'is', scores)

# print('\nPart 2: The location of the last cart is', cart.print())

end = datetime.datetime.now()
duration = end - start
print('Completed in {0:02d}:{1:02d}:{2:02.5f}\n'.format(
    int(duration.seconds / 3600), int(duration.seconds / 60),
    duration.seconds % 60 + duration.microseconds / 1000000))