Skip to content

New tests for Rectangles  #1637

Open
Open
@remrobem

Description

@remrobem

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);
 });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions