Esempio n. 1
0
def test_magnitude() -> None:
    assert magnitude("[[1,2],[[3,4],5]]") == 143
    assert magnitude("[[[[0,7],4],[[7,8],[6,0]]],[8,1]]") == 1384
    assert magnitude("[[[[1,1],[2,2]],[3,3]],[4,4]]") == 445
    assert magnitude("[[[[3,0],[5,3]],[4,4]],[5,5]]") == 791
    assert magnitude("[[[[5,0],[7,4]],[5,5]],[6,6]]") == 1137
    assert magnitude("[[[[8,7],[7,7]],[[8,6],[7,7]]],[[[0,7],[6,6]],[8,7]]]") == 3488
def test_magnitude4():
    a = parse("[[[[1,1],[2,2]],[3,3]],[4,4]]")
    print(a)

    assert magnitude(a) == 445
def test_magnitude3():
    a = parse("[[[[0,7],4],[[7,8],[6,0]]],[8,1]]")
    print(a)

    assert magnitude(a) == 1384
def test_magnitude2():
    a = parse("[[9,1],[1,9]]")

    assert magnitude(a) == 129
def test_magnitude():
    a = parse("[9,1]")

    assert magnitude(a) == 29