Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/practice/matrix/.meta/example.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function StringToMatrix(const AString : string) : TIntMatrix;
j : byte = 0;
begin
result := [[]];
for LRow in SplitString(AString, '\n') do
for LRow in SplitString(AString, #10) do
begin
inc(i);
SetLength(result, i);
Expand Down
12 changes: 6 additions & 6 deletions exercises/practice/matrix/TestCases.pas
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ procedure MatrixTest.extract_row_from_one_number_matrix;
// 5c93ec93-80e1-4268-9fc2-63bc7d23385c
procedure MatrixTest.can_extract_row;
begin
TapAssertTrue(Self, 'can extract row', [3, 4], Matrix.row('1 2\n3 4', 2));
TapAssertTrue(Self, 'can extract row', [3, 4], Matrix.row('1 2'#10'3 4', 2));
end;

// 2f1aad89-ad0f-4bd2-9919-99a8bff0305a
procedure MatrixTest.extract_row_where_numbers_have_different_widths;
begin
TapAssertTrue(Self, 'extract row where numbers have different widths', [10, 20], Matrix.row('1 2\n10 20', 2));
TapAssertTrue(Self, 'extract row where numbers have different widths', [10, 20], Matrix.row('1 2'#10'10 20', 2));
end;

// 68f7f6ba-57e2-4e87-82d0-ad09889b5204
procedure MatrixTest.can_extract_row_from_non_square_matrix_with_no_corresponding_column;
begin
TapAssertTrue(Self, 'can extract row from non-square matrix with no corresponding column', [8, 7, 6], Matrix.row('1 2 3\n4 5 6\n7 8 9\n8 7 6', 4));
TapAssertTrue(Self, 'can extract row from non-square matrix with no corresponding column', [8, 7, 6], Matrix.row('1 2 3'#10'4 5 6'#10'7 8 9'#10'8 7 6', 4));
end;

// e8c74391-c93b-4aed-8bfe-f3c9beb89ebb
Expand All @@ -56,19 +56,19 @@ procedure MatrixTest.extract_column_from_one_number_matrix;
// 7136bdbd-b3dc-48c4-a10c-8230976d3727
procedure MatrixTest.can_extract_column;
begin
TapAssertTrue(Self, 'can extract column', [3, 6, 9], Matrix.column('1 2 3\n4 5 6\n7 8 9', 3));
TapAssertTrue(Self, 'can extract column', [3, 6, 9], Matrix.column('1 2 3'#10'4 5 6'#10'7 8 9', 3));
end;

// ad64f8d7-bba6-4182-8adf-0c14de3d0eca
procedure MatrixTest.can_extract_column_from_non_square_matrix_with_no_corresponding_row;
begin
TapAssertTrue(Self, 'can extract column from non-square matrix with no corresponding row', [4, 8, 6], Matrix.column('1 2 3 4\n5 6 7 8\n9 8 7 6', 4));
TapAssertTrue(Self, 'can extract column from non-square matrix with no corresponding row', [4, 8, 6], Matrix.column('1 2 3 4'#10'5 6 7 8'#10'9 8 7 6', 4));
end;

// 9eddfa5c-8474-440e-ae0a-f018c2a0dd89
procedure MatrixTest.extract_column_where_numbers_have_different_widths;
begin
TapAssertTrue(Self, 'extract column where numbers have different widths', [1903, 3, 4], Matrix.column('89 1903 3\n18 3 1\n9 4 800', 2));
TapAssertTrue(Self, 'extract column where numbers have different widths', [1903, 3, 4], Matrix.column('89 1903 3'#10'18 3 1'#10'9 4 800', 2));
end;

initialization
Expand Down