@@ -19,105 +19,105 @@ describe('rectangles', function()
1919
2020 it (' one rectangle' , function ()
2121 assert .equal (1 , rectangles .count ({
22- ' +-+' , -- ,
23- ' | |' , -- ,
22+ ' +-+' , --
23+ ' | |' , --
2424 ' +-+' --
2525 }))
2626 end )
2727
2828 it (' two rectangles without shared parts' , function ()
2929 assert .equal (2 , rectangles .count ({
30- ' +-+' , -- ,
31- ' | |' , -- ,
32- ' +-+-+' , -- ,
33- ' | | ' , -- ,
30+ ' +-+' , --
31+ ' | |' , --
32+ ' +-+-+' , --
33+ ' | | ' , --
3434 ' +-+ ' --
3535 }))
3636 end )
3737
3838 it (' five rectangles with shared parts' , function ()
3939 assert .equal (5 , rectangles .count ({
40- ' +-+' , -- ,
41- ' | |' , -- ,
42- ' +-+-+' , -- ,
43- ' | | |' , -- ,
40+ ' +-+' , --
41+ ' | |' , --
42+ ' +-+-+' , --
43+ ' | | |' , --
4444 ' +-+-+' --
4545 }))
4646 end )
4747
4848 it (' rectangle of height 1 is counted' , function ()
4949 assert .equal (1 , rectangles .count ({
50- ' +--+' , -- ,
50+ ' +--+' , --
5151 ' +--+' --
5252 }))
5353 end )
5454
5555 it (' rectangle of width 1 is counted' , function ()
5656 assert .equal (1 , rectangles .count ({
57- ' ++' , -- ,
58- ' ||' , -- ,
57+ ' ++' , --
58+ ' ||' , --
5959 ' ++' --
6060 }))
6161 end )
6262
6363 it (' 1x1 square is counted' , function ()
6464 assert .equal (1 , rectangles .count ({
65- ' ++' , -- ,
65+ ' ++' , --
6666 ' ++' --
6767 }))
6868 end )
6969
7070 it (' only complete rectangles are counted' , function ()
7171 assert .equal (1 , rectangles .count ({
72- ' +-+' , -- ,
73- ' |' , -- ,
74- ' +-+-+' , -- ,
75- ' | | -' , -- ,
72+ ' +-+' , --
73+ ' |' , --
74+ ' +-+-+' , --
75+ ' | | -' , --
7676 ' +-+-+' --
7777 }))
7878 end )
7979
8080 it (' rectangles can be of different sizes' , function ()
8181 assert .equal (3 , rectangles .count ({
82- ' +------+----+' , -- ,
83- ' | | |' , -- ,
84- ' +---+--+ |' , -- ,
85- ' | | |' , -- ,
82+ ' +------+----+' , --
83+ ' | | |' , --
84+ ' +---+--+ |' , --
85+ ' | | |' , --
8686 ' +---+-------+' --
8787 }))
8888 end )
8989
9090 it (' corner is required for a rectangle to be complete' , function ()
9191 assert .equal (2 , rectangles .count ({
92- ' +------+----+' , -- ,
93- ' | | |' , -- ,
94- ' +------+ |' , -- ,
95- ' | | |' , -- ,
92+ ' +------+----+' , --
93+ ' | | |' , --
94+ ' +------+ |' , --
95+ ' | | |' , --
9696 ' +---+-------+' --
9797 }))
9898 end )
9999
100100 it (' large input with many rectangles' , function ()
101101 assert .equal (60 , rectangles .count ({
102- ' +---+--+----+' , -- ,
103- ' | +--+----+' , -- ,
104- ' +---+--+ |' , -- ,
105- ' | +--+----+' , -- ,
106- ' +---+--+--+-+' , -- ,
107- ' +---+--+--+-+' , -- ,
108- ' +------+ | |' , -- ,
102+ ' +---+--+----+' , --
103+ ' | +--+----+' , --
104+ ' +---+--+ |' , --
105+ ' | +--+----+' , --
106+ ' +---+--+--+-+' , --
107+ ' +---+--+--+-+' , --
108+ ' +------+ | |' , --
109109 ' +-+' --
110110 }))
111111 end )
112112
113113 it (' rectangles must have four sides' , function ()
114114 assert .equal (5 , rectangles .count ({
115- ' +-+ +-+' , -- ,
116- ' | | | |' , -- ,
117- ' +-+-+-+' , -- ,
118- ' | | ' , -- ,
119- ' +-+-+-+' , -- ,
120- ' | | | |' , -- ,
115+ ' +-+ +-+' , --
116+ ' | | | |' , --
117+ ' +-+-+-+' , --
118+ ' | | ' , --
119+ ' +-+-+-+' , --
120+ ' | | | |' , --
121121 ' +-+ +-+' --
122122 }))
123123 end )
0 commit comments