Example #1
0
    def test_split_reaction2(self):
        # arrange
        reaction = '9 ORE => 2 A'
        nf = NanoFactory([reaction])

        # act
        c, a, arr = nf.SplitReaction(reaction)

        # assert
        self.assertEqual(c, 'A')
        self.assertEqual(a, 2)
        self.assertEqual(len(arr), 1)
        self.assertEqual(arr['ORE'], 9)
Example #2
0
    def test_split_reaction(self):
        # arrange
        reaction = '5 B, 7 C => 1 BC'
        nf = NanoFactory([reaction])

        # act
        c, a, arr = nf.SplitReaction(reaction)

        # assert
        self.assertEqual(c, 'BC')
        self.assertEqual(a, 1)
        self.assertEqual(len(arr), 2)
        self.assertEqual(arr['B'], 5)
        self.assertEqual(arr['C'], 7)
Example #3
0
    def test_split_reaction1(self):
        # arrange
        reaction = '2 AB, 3 BC, 4 CA => 1 FUEL'
        nf = NanoFactory([reaction])

        # act
        c, a, arr = nf.SplitReaction(reaction)

        # assert
        self.assertEqual(c, 'FUEL')
        self.assertEqual(a, 1)
        self.assertEqual(len(arr), 3)
        self.assertEqual(arr['AB'], 2)
        self.assertEqual(arr['BC'], 3)
        self.assertEqual(arr['CA'], 4)
Example #4
0
    def test_split_reaction3(self):
        # arrange
        reaction = '44 XJWVT, 5 KHKGT, 1 QDVJ, 29 NZVS, 9 GPVTF, 48 HKGWZ => 1 FUEL'
        nf = NanoFactory([reaction])

        # act
        c, a, arr = nf.SplitReaction(reaction)

        # assert
        self.assertEqual(c, 'FUEL')
        self.assertEqual(a, 1)
        self.assertEqual(len(arr), 6)
        self.assertEqual(arr['XJWVT'], 44)
        self.assertEqual(arr['KHKGT'], 5)
        self.assertEqual(arr['QDVJ'], 1)
        self.assertEqual(arr['NZVS'], 29)
        self.assertEqual(arr['GPVTF'], 9)
        self.assertEqual(arr['HKGWZ'], 48)