Sha256: 3b8f2049dbd50ebb02edce99dfce19c7e2092dbdbc77a1f039f0f5557b63c7e1

Contents?: true

Size: 1.7 KB

Versions: 70

Compression:

Stored size: 1.7 KB

Contents

import unittest

from rectangles import count


class WordTest(unittest.TestCase):
    # unit tests
    def test_zero_area_1(self):
        assert 0 == count()

    def test_zero_area_2(self):
        lines = ""
        assert 0 == count(lines)

    def test_empty_area(self):
        lines = " "
        assert 0 == count(lines)

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

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

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

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

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

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


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

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
trackler-2.0.6.40 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.39 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.38 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.37 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.36 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.35 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.34 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.33 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.32 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.31 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.30 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.29 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.28 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.27 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.26 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.25 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.24 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.23 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.22 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.6.21 tracks/python/exercises/rectangles/rectangles_count_test.py