problem-specifications
problem-specifications copied to clipboard
New tests for Rectangles
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);
});