Пример #1
0
 def test_part2_example3(self):
     techniques = [
         "deal with increment 7",
         "deal with increment 9",
         "cut -2",
     ]
     expected = "6 3 0 7 4 1 8 5 2 9"
     deck = day22.DeckOfSpaceCards(10)
     deck.shuffle(techniques)
     cards = deck.get_all_cards()
     self.assertEqual(list(map(int, expected.split())), cards)
Пример #2
0
 def test_part1_example1(self):
     techniques = [
         "deal with increment 7",
         "deal into new stack",
         "deal into new stack",
     ]
     expected = "0 3 6 9 2 5 8 1 4 7"
     deck = day22.DeckOfSpaceCards(10)
     deck.shuffle(techniques)
     cards = deck.get_all_cards()
     self.assertEqual(list(map(int, expected.split())), cards)
Пример #3
0
 def test_deal_into_new_stack(self):
     techniques = ["deal into new stack"]
     deck = day22.DeckOfSpaceCards(10)
     deck.shuffle(techniques)
     cards = deck.get_all_cards()
     self.assertEqual(list(map(int, "9 8 7 6 5 4 3 2 1 0".split())), cards)
Пример #4
0
 def test_deal_with_increment(self):
     techniques = ["deal with increment 3"]
     deck = day22.DeckOfSpaceCards(10)
     deck.shuffle(techniques)
     cards = deck.get_all_cards()
     self.assertEqual(list(map(int, "0 7 4 1 8 5 2 9 6 3".split())), cards)
Пример #5
0
 def test_cut_n_negative(self):
     techniques = ["cut -4"]
     deck = day22.DeckOfSpaceCards(10)
     deck.shuffle(techniques)
     cards = deck.get_all_cards()
     self.assertEqual(list(map(int, "6 7 8 9 0 1 2 3 4 5".split())), cards)