Sha256: 49cb0d213d8bd6080f52dd97f041481ffa468f0f6931cd581902cddad35dd948

Contents?: true

Size: 1.7 KB

Versions: 26

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

26 entries across 26 versions & 1 rubygems

Version Path
trackler-2.0.3.0 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.2.0 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.1.2 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.1.1 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.1.0 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.10 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.9 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.8 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.7 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.6 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.5 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.4 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.3 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.2 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.1 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-2.0.0.0 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-1.0.4.1 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-1.0.4.0 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-1.0.3.0 tracks/python/exercises/rectangles/rectangles_count_test.py
trackler-1.0.2.1 tracks/python/exercises/rectangles/rectangles_count_test.py