Sha256: d78ebb082a3ff4ff620f076e944aa080576258ff7192b53f8fd2c4caa22ff50b

Contents?: true

Size: 1.66 KB

Versions: 31

Compression:

Stored size: 1.66 KB

Contents

import unittest

from rectangles import count


class WordTest(unittest.TestCase):
    def test_zero_area_1(self):
        self.assertEqual(0, count())

    def test_zero_area_2(self):
        lines = ""
        self.assertEqual(0, count(lines))

    def test_empty_area(self):
        lines = " "
        self.assertEqual(0, count(lines))

    def test_one_rectangle(self):
        lines = ["+-+",
                 "| |",
                 "+-+"]
        self.assertEqual(1, count(lines))

    def test_two_rectangles_no_shared_parts(self):
        lines = ["  +-+",
                 "  | |",
                 "+-+-+",
                 "| |  ",
                 "+-+  "]
        self.assertEqual(2, count(lines))

    def test_five_rectangles_three_regions(self):
        lines = ["  +-+",
                 "  | |",
                 "+-+-+",
                 "| | |",
                 "+-+-+"]
        self.assertEqual(5, count(lines))

    def test_incomplete_rectangles(self):
        lines = ["  +-+",
                 "    |",
                 "+-+-+",
                 "| | -",
                 "+-+-+"]
        self.assertEqual(1, count(lines))

    def test_complicated(self):
        lines = ["+------+----+",
                 "|      |    |",
                 "+---+--+    |",
                 "|   |       |",
                 "+---+-------+"]
        self.assertEqual(3, count(lines))

    def test_not_so_complicated(self):
        lines = ["+------+----+",
                 "|      |    |",
                 "+------+    |",
                 "|   |       |",
                 "+---+-------+"]
        self.assertEqual(2, count(lines))


if __name__ == '__main__':
    unittest.main()

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
trackler-2.0.8.27 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.26 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.24 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.23 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.22 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.21 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.20 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.19 tracks/python/exercises/rectangles/rectangles_test.py
trackler-2.0.8.18 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.17 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.16 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.15 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.14 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.13 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.12 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.11 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.10 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.9 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.8 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.8.7 tracks/python/exercises/rectangles/rectangles_count_test.py