Esempio n. 1
0
def test():
    assertEquals(5, countStepsSingleIncrement([0, 3, 0, 1, -3]))

    input = list(
        map(lambda instr: int(instr),
            read("adventofcode2017/day5/input.txt").split()))
    assertEquals(354121, countStepsSingleIncrement(input.copy()))

    assertEquals(10, countStepsIncrementTowardsZero([0, 3, 0, 1, -3]))
    print(countStepsIncrementTowardsZero(input.copy()))
Esempio n. 2
0
def testHalfwayRound(input, expected):
    resultHalf = solveCaptchaHalfwayRound(input)
    assertEquals(expected, resultHalf)
Esempio n. 3
0
def testNextDigit(input, expected):
    resultNext = solveCaptchaNextDigit(input)
    assertEquals(expected, resultNext)
Esempio n. 4
0
def test():
    assertEquals(True, isValidPassphrase("aa bb cc dd ee"))
    assertEquals(False, isValidPassphrase("aa bb cc dd aa"))
    assertEquals(True, isValidPassphrase("aa bb cc dd aaa"))

    assertEquals(True, isValidPassphraseAnagram("abcde fghij"))
    assertEquals(False, isValidPassphraseAnagram("abcde xyz ecdab"))
    assertEquals(True, isValidPassphraseAnagram("a ab abc abd abf abj"))
    assertEquals(True, isValidPassphraseAnagram("iiii oiii ooii oooi oooo"))
    assertEquals(False, isValidPassphraseAnagram("oiii ioii iioi iiio"))
Esempio n. 5
0
def doTest(passphrase, isValid):
    assertEquals(isValid, isValidPassphrase(passphrase))
Esempio n. 6
0
def doTest(input, expected):
    result = computeManhattanDistance(input)
    assertEquals(expected, result)
Esempio n. 7
0
def doDivisibleTest(input, expected):
    parsedInput = parseInput(input)
    actual = computeDivisibleChecksum(parsedInput)
    assertEquals(expected, actual)