-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors_histogram.pas
More file actions
38 lines (33 loc) · 1.22 KB
/
errors_histogram.pas
File metadata and controls
38 lines (33 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
6 kyu
Errors : histogram
https://www.codewars.com/kata/59f44c7bd4b36946fd000052
}
program errors_histogram;
{$mode objfpc}{$H+}
uses
StrUtils,
errors_histogram_unit;
procedure DoTest(strng: string; Expected: string);
var
Actual: string;
begin
Actual := Hist(strng);
writeln('String : ', LineEnding, strng);
writeln('Expected: ', LineEnding, ReplaceStr(Expected, '\r', LineEnding));
writeln('Actual : ', LineEnding, ReplaceStr(Actual, '\r', LineEnding));
if Expected = Actual then
writeln('-> OK', LineEnding)
else
writeln('-> FAIL', LineEnding);
end;
begin
DoTest('uuuuuuuuuuuuuuuuwwwwwwwwwwwwwwwwwwxxxxxxxxxxxxxxxxxxzzzzzzzzzzzzz',
'u 16 ****************\rw 18 ******************\rx 18 ******************\rz 13 *************');
DoTest('tpwaemuqxdmwqbqrjbeosjnejqorxdozsxnrgpgqkeihqwybzyymqeazfkyiucesxwutgszbenzvgxibxrlvmzihcb',
'u 3 ***\rw 4 ****\rx 6 ******\rz 6 ******');
DoTest('aaifzlnderpeurcuqjqeywdq', 'u 2 **\rw 1 *\rz 1 *');
DoTest('sjeneccyhrcpfvpujfaoaykqllteovskclebmzjeqepilxygdmzvdfmxbqdzubkzturnuqxsewrwgmdfwgdx',
'u 4 ****\rw 3 ***\rx 4 ****\rz 4 ****');
DoTest('', '');
end.