problem-specifications icon indicating copy to clipboard operation
problem-specifications copied to clipboard

New tests for Rectangles

Open remrobem opened this issue 5 years ago • 1 comments

Suggest new tests for Rectangles, if it fits within the intent of the exercise. The tests are for rectangles that do not share sides with other existing rectangles.

test('separated rectangle, same size as other rectangle ', () => {
   const expected = 4;
   const actual = Rectangles.count([
     '     +-+',
     '     | |',
     '+-+  +-+',
     '| |  | |',
     '+-+  +-+',
   ]);

   expect(actual).toEqual(expected);
 });

 test('separated rectangles, different sizes,no overlap ', () => {
   const expected = 3;
   const actual = Rectangles.count([
     '     +-+',
     '     | |',
     '     +-+',
     '+-+     ',
     '+-+     ',
     '  +---+ ',
     '  |   | ',
     '  +---+ ',
   ]);

   expect(actual).toEqual(expected);
 });

 test('separated rectangles, different sizes', () => {
   const expected = 4;
   const actual = Rectangles.count([
     '     +-+',
     '     | |',
     '     +-+',
     '+-+  | |',
     '| |  | |',
     '+-+  | |',
     '     +-+',
   ]);

   expect(actual).toEqual(expected);
 });

remrobem avatar Feb 14 '20 03:02 remrobem