3.9.0.3500
Хороший коммит )
This commit is contained in:
parent
33e8b383be
commit
7f988c9bb2
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "9";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "3499";
|
||||
public const string Revision = "3500";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=9
|
||||
%REVISION%=3499
|
||||
%COREVERSION%=0
|
||||
%REVISION%=3500
|
||||
%MINOR%=9
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
3.9.0.3499
|
||||
3.9.0.3500
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.9.0.3499'
|
||||
!define VERSION '3.9.0.3500'
|
||||
|
|
|
|||
|
|
@ -111,10 +111,42 @@ function MatrRandomReal(m: integer; n: integer): array [,] of real;
|
|||
|
||||
/// Выводит приглашение к вводу и возвращает значение типа integer, введенное с клавиатуры
|
||||
function ReadInteger(prompt: string): integer;
|
||||
/// Выводит приглашение к вводу и возвращает два значения типа integer, введенные с клавиатуры
|
||||
function ReadInteger2(prompt: string): (integer, integer);
|
||||
/// Выводит приглашение к вводу и возвращает значение типа integer, введенное с клавиатуры
|
||||
function ReadlnInteger(prompt: string): integer;
|
||||
/// Выводит приглашение к вводу и возвращает два значения типа integer, введенные с клавиатуры
|
||||
function ReadInteger2(prompt: string): (integer, integer);
|
||||
/// Выводит приглашение к вводу и возвращает два значения типа integer, введенные с клавиатуры
|
||||
function ReadlnInteger2(prompt: string): (integer, integer);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа integer, введенные с клавиатуры
|
||||
function ReadInteger3(prompt: string): (integer, integer, integer);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа integer, введенные с клавиатуры
|
||||
function ReadlnInteger3(prompt: string): (integer, integer, integer);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа integer, введенные с клавиатуры
|
||||
function ReadInteger4(prompt: string): (integer, integer, integer, integer);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа integer, введенные с клавиатуры
|
||||
function ReadlnInteger4(prompt: string): (integer, integer, integer, integer);
|
||||
|
||||
/// Выводит приглашение к вводу и возвращает значение типа real, введенное с клавиатуры
|
||||
function ReadReal(prompt: string): real;
|
||||
/// Выводит приглашение к вводу и возвращает значение типа real, введенное с клавиатуры
|
||||
function ReadlnReal(prompt: string): real;
|
||||
/// Выводит приглашение к вводу и возвращает два значения типа real, введенные с клавиатуры
|
||||
function ReadReal2(prompt: string): (real, real);
|
||||
/// Выводит приглашение к вводу и возвращает два значения типа real, введенные с клавиатуры
|
||||
function ReadlnReal2(prompt: string): (real, real);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа real, введенные с клавиатуры
|
||||
function ReadReal3(prompt: string): (real, real, real);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа real, введенные с клавиатуры
|
||||
function ReadlnReal3(prompt: string): (real, real, real);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа real, введенные с клавиатуры
|
||||
function ReadReal4(prompt: string): (real, real, real, real);
|
||||
/// Выводит приглашение к вводу и возвращает три значения типа real, введенные с клавиатуры
|
||||
function ReadlnReal4(prompt: string): (real, real, real, real);
|
||||
|
||||
/// Выводит приглашение к вводу и возвращает значение типа char, введенное с клавиатуры
|
||||
function ReadChar(prompt: string): char;
|
||||
/// Выводит приглашение к вводу и возвращает значение типа char, введенное с клавиатуры
|
||||
function ReadlnChar(prompt: string): char;
|
||||
|
||||
/// Выводит приглашение к вводу и возвращает значение типа string, введенное с клавиатуры
|
||||
function ReadString(prompt: string): string;
|
||||
|
|
@ -523,7 +555,7 @@ procedure GenerateTests<T1,T2,T3>(params a: array of (T1,T2,T3));
|
|||
{=========================================================}
|
||||
{ Фильтрация выходного списка }
|
||||
{=========================================================}
|
||||
/// Преобразование строк, являющихся целыми, в целые в OutputList
|
||||
/// Преобразование строк и символов, являющихся числами, в числа в OutputList
|
||||
procedure ConvertStringsToNumbersInOutputList;
|
||||
/// Если в OutputList массивы, вытянуть их в единый список
|
||||
procedure FlattenOutput;
|
||||
|
|
@ -1399,6 +1431,13 @@ begin
|
|||
else if s.TryToReal(rval) then
|
||||
Result := rval
|
||||
end
|
||||
else if ob is char then
|
||||
begin
|
||||
var s := ''+char(ob);
|
||||
var ival: integer;
|
||||
if s.TryToInteger(ival) then
|
||||
Result := ival
|
||||
end
|
||||
end;
|
||||
|
||||
procedure ConvertStringsToNumbersInOutputList;
|
||||
|
|
@ -1950,46 +1989,131 @@ begin
|
|||
InputList.Add(x);
|
||||
end;
|
||||
|
||||
/// Возвращает двумерный массив размера m x n, заполненный случайными вещественными значениями
|
||||
function MatrRandomReal(m: integer; n: integer): array [,] of real := MatrRandomReal(m,n,0,10);
|
||||
|
||||
/// Выводит приглашение к вводу и возвращает значение типа integer, введенное с клавиатуры
|
||||
procedure ReadRemainderAction;
|
||||
begin
|
||||
if not IsPT then
|
||||
begin
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
CreateNewLineBeforeMessage := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ReadInteger(prompt: string): integer;
|
||||
begin
|
||||
Result := PABCSystem.ReadInteger(prompt);
|
||||
if IsPT then exit;
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
CreateNewLineBeforeMessage := False;
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
/// Выводит приглашение к вводу и возвращает значение типа integer, введенное с клавиатуры
|
||||
function ReadlnInteger(prompt: string): integer;
|
||||
begin
|
||||
Result := PABCSystem.ReadlnInteger(prompt);
|
||||
if IsPT then exit;
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
CreateNewLineBeforeMessage := False;
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
/// Выводит приглашение к вводу и возвращает два значения типа integer, введенные с клавиатуры
|
||||
function ReadInteger2(prompt: string): (integer, integer);
|
||||
begin
|
||||
Result := PABCSystem.ReadInteger2(prompt);
|
||||
if IsPT then exit;
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
CreateNewLineBeforeMessage := False;
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnInteger2(prompt: string): (integer,integer);
|
||||
begin
|
||||
Result := PABCSystem.ReadlnInteger2(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadInteger3(prompt: string): (integer,integer,integer);
|
||||
begin
|
||||
Result := PABCSystem.ReadInteger3(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnInteger3(prompt: string): (integer,integer,integer);
|
||||
begin
|
||||
Result := PABCSystem.ReadlnInteger3(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadInteger4(prompt: string): (integer, integer,integer,integer);
|
||||
begin
|
||||
Result := PABCSystem.ReadInteger4(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnInteger4(prompt: string): (integer,integer,integer,integer);
|
||||
begin
|
||||
Result := PABCSystem.ReadlnInteger4(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadReal(prompt: string): real;
|
||||
begin
|
||||
Result := PABCSystem.ReadReal(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnReal(prompt: string): real;
|
||||
begin
|
||||
Result := PABCSystem.ReadlnReal(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadReal2(prompt: string): (real, real);
|
||||
begin
|
||||
Result := PABCSystem.ReadReal2(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnReal2(prompt: string): (real, real);
|
||||
begin
|
||||
Result := PABCSystem.ReadlnReal2(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadReal3(prompt: string): (real, real, real);
|
||||
begin
|
||||
Result := PABCSystem.ReadReal3(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnReal3(prompt: string): (real, real, real);
|
||||
begin
|
||||
Result := PABCSystem.ReadlnReal3(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadReal4(prompt: string): (real, real, real, real);
|
||||
begin
|
||||
Result := PABCSystem.ReadReal4(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnReal4(prompt: string): (real, real, real, real);
|
||||
begin
|
||||
Result := PABCSystem.ReadlnReal4(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadChar(prompt: string): char;
|
||||
begin
|
||||
Result := PABCSystem.ReadChar(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnChar(prompt: string): char;
|
||||
begin
|
||||
Result := PABCSystem.ReadlnChar(prompt);
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
|
||||
function ReadString(prompt: string): string;
|
||||
begin
|
||||
Result := PABCSystem.ReadString(prompt);
|
||||
if IsPT then exit;
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
OutputList.RemoveAt(OutputList.Count - 1);
|
||||
CreateNewLineBeforeMessage := False;
|
||||
ReadRemainderAction;
|
||||
end;
|
||||
|
||||
function ReadlnString(prompt: string) := ReadString(prompt);
|
||||
|
|
@ -2147,7 +2271,9 @@ end;
|
|||
function FlattenElement(x: object): List<object>;
|
||||
begin
|
||||
var res := new List<object>;
|
||||
if x is IEnumerable<object> (var xen) then
|
||||
if x is string then
|
||||
res.Add(x)
|
||||
else if x is IEnumerable<object> (var xen) then
|
||||
foreach var ob in xen do
|
||||
res.AddRange(FlattenElement(ob))
|
||||
else if x is System.Collections.IEnumerable (var xx) then
|
||||
|
|
|
|||
|
|
@ -5016,9 +5016,7 @@ function operator**(x: BigInteger; y: integer): BigInteger; extensionmethod := P
|
|||
//------------------------------------------------------------------------------
|
||||
// Операции для BigInteger
|
||||
//------------------------------------------------------------------------------
|
||||
function operator/(p: BigInteger; q: real); extensionmethod := real(p)/q;
|
||||
|
||||
// function operator/(p: BigInteger; q: integer); extensionmethod := real(p)/q;
|
||||
function BigInteger.operator/(p: BigInteger; q: real) := real(p)/q;
|
||||
|
||||
function BigInteger.operator/(q: real; p: BigInteger) := q/real(p);
|
||||
|
||||
|
|
@ -5052,7 +5050,7 @@ procedure BigInteger.operator*=(var p: BigInteger; q: BigInteger) := p := p * q;
|
|||
|
||||
procedure BigInteger.operator-=(var p: BigInteger; q: BigInteger) := p := p - q;
|
||||
|
||||
//function BigInteger.operator div(p: BigInteger; q: integer) := BigInteger.Divide(p,q);
|
||||
function BigInteger.operator div(p: BigInteger; q: integer) := BigInteger.Divide(p,q);
|
||||
|
||||
function BigInteger.operator mod(p: BigInteger; q: integer) := BigInteger.Remainder(p,q);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,50 +6,43 @@ var AllTaskNames: array of string;
|
|||
|
||||
procedure CheckTaskT(name: string);
|
||||
begin
|
||||
FlattenOutput;
|
||||
ClearOutputListFromSpaces;
|
||||
case name of
|
||||
'Arr0': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(Arr(5,4,3,2,1,777,5,4,3,2,1,777));
|
||||
CheckOutput(5,4,3,2,1,777,5,4,3,2,1,777);
|
||||
end;
|
||||
'Arr1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(Arr(777,1,1,1,777));
|
||||
CheckOutput(777,1,1,1,777);
|
||||
end;
|
||||
'Arr2': begin
|
||||
var n := 5;
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cInt|*n);
|
||||
CheckData(Input := cInt*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := IntArr(n);
|
||||
CheckOutputSeq(il.Select(x->x+1));
|
||||
CheckOutput(il.Select(x->x+1));
|
||||
end;
|
||||
'Arr3': begin
|
||||
var n := 5;
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cInt|*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := IntArr(n);
|
||||
CheckOutputSeq(il.Select(x->x*2));
|
||||
CheckOutput(il.Select(x->x*2));
|
||||
end;
|
||||
'Arr4': begin
|
||||
var n := 10;
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cInt|*n);
|
||||
CheckData(Input := cInt*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := IntArr(n);
|
||||
CheckOutputSeq(il+il.Select(x->x*x));
|
||||
CheckOutput(il+il.Select(x->x*x));
|
||||
end;
|
||||
'Arr5': begin
|
||||
var n := 10;
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cInt|*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
CheckData(Input := cInt*n);
|
||||
GenerateTests(10, tInt*n);
|
||||
var il := IntArr(n);
|
||||
CheckOutputSeq(il+il.Reverse);
|
||||
CheckOutput(il, il.Reverse);
|
||||
end;
|
||||
'ArrErr1': begin
|
||||
TaskResult := TaskStatus.ErrFix
|
||||
|
|
@ -59,88 +52,79 @@ begin
|
|||
end;
|
||||
'Arr1Sum': begin
|
||||
var n := 10;
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cInt|*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
CheckData(Input := cInt*n);
|
||||
GenerateTests(10, tInt*n);
|
||||
var il := InputListAsIntegers.Select(x->x*0.1);
|
||||
CheckOutputSeq(il+il.Sum);
|
||||
CheckOutput(il, il.Sum);
|
||||
end;
|
||||
'Arr2Prod': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
ClearOutputListFromSpaces;
|
||||
CancelMessagesIfInitial := False; // !
|
||||
var n := 8;
|
||||
CheckData(|cRe|*n, |cRe|*n);
|
||||
GenerateTests(10,tRe(1,10,1)*n);
|
||||
CheckData(cRe*n, cRe*n);
|
||||
GenerateTests(10, tRe(1,10,1)*n);
|
||||
var il := ReArr(n).Select(x->x);
|
||||
CheckOutputAfterInitial(il.Product);
|
||||
end;
|
||||
'Arr1_If': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
ClearOutputListFromSpaces;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt*n);
|
||||
var il := IntArr(n);
|
||||
CheckOutputSeq(il+il.Where(x->x.IsEven));
|
||||
CheckOutput(il, il.Where(x->x.IsEven));
|
||||
end;
|
||||
'Arr2_If': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
ClearOutputListFromSpaces;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := IntArr(n);
|
||||
CheckOutputSeq(il+il.Where((x,i)->i.IsOdd));
|
||||
CheckOutput(il, il.Where((x,i)->i.IsOdd));
|
||||
end;
|
||||
'Arr0_Count': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
ClearOutputListFromSpaces;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := IntArr(n);
|
||||
CheckOutputSeq(il+il.Count(x->x.IsOdd));
|
||||
CheckOutput(il, il.Count(x->x.IsOdd));
|
||||
end;
|
||||
'Arr1_Sum': begin
|
||||
ClearOutputListFromSpaces;
|
||||
var n := InputList.Count;
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := InputListAsIntegers.Where(x->x in 3..5).ToArray;
|
||||
CheckOutputSeq(InputListAsIntegers+il+il.sum);
|
||||
GenerateTests(10, tInt*n);
|
||||
var a := IntArr(n);
|
||||
var il := a.Where(x->x in 3..5).ToArray;
|
||||
CheckOutput(a, il, il.sum);
|
||||
end;
|
||||
'Arr2_Count': begin
|
||||
ClearOutputListFromSpaces;
|
||||
var n := InputList.Count;
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := InputListAsIntegers;
|
||||
CheckOutputSeq(il+il.CountOf(2)+il.CountOf(3)+il.CountOf(4)+il.CountOf(5));
|
||||
GenerateTests(10, tInt*n);
|
||||
var a := IntArr(n);
|
||||
CheckOutput(a, a.CountOf(2), a.CountOf(3), a.CountOf(4), a.CountOf(5));
|
||||
end;
|
||||
'Arr1_MinMax': begin
|
||||
ClearOutputListFromSpaces;
|
||||
var n := InputList.Count;
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := InputListAsIntegers;
|
||||
CheckOutputSeq(il+il.Min);
|
||||
GenerateTests(10, tInt*n);
|
||||
var a := IntArr(n);
|
||||
CheckOutput(a, a.Min);
|
||||
end;
|
||||
'Arr2_MinMax': begin
|
||||
ClearOutputListFromSpaces;
|
||||
var n := InputList.Count;
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := InputListAsIntegers;
|
||||
CheckOutputSeq(il+il.Max);
|
||||
var a := IntArr(n);
|
||||
CheckOutput(a, a.Max);
|
||||
end;
|
||||
'Arr3_MinMax': begin
|
||||
ClearOutputListFromSpaces;
|
||||
var n := InputList.Count;
|
||||
GenerateTests(10,tInt*n);
|
||||
var il := InputListAsIntegers;
|
||||
CheckOutputSeq(il+il.IndexMin);
|
||||
var a := IntArr(n);
|
||||
CheckOutput(a, a.IndexMin);
|
||||
end;
|
||||
'ПоискВМассиве': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var a := InputListAsIntegers;
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt*n);
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitial(5 in a);
|
||||
end;
|
||||
'ПоискВМассивеСтрок': begin
|
||||
|
|
@ -152,52 +136,52 @@ begin
|
|||
end;
|
||||
'Заполнение1': begin
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(Arr(0,1,4,9,16,25,36,49,64,81));
|
||||
CheckOutput(0,1,4,9,16,25,36,49,64,81);
|
||||
end;
|
||||
'Заполнение2Арифм': begin
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(ArrGen(10,1,x->x+2));
|
||||
CheckOutput(ArrGen(10,1,x->x+2));
|
||||
end;
|
||||
'Заполнение3Арифм': begin
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(ArrGen(10,1,x->x+2));
|
||||
CheckOutput(ArrGen(10,1,x->x+2));
|
||||
end;
|
||||
'Заполнение4Арифм': begin
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(ArrGen(10,1.0,x->x+0.5));
|
||||
CheckOutput(ArrGen(10,1.0,x->x+0.5));
|
||||
end;
|
||||
'Заполнение1Геом': begin
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(ArrGen(10,1,x->x*2));
|
||||
CheckOutput(ArrGen(10,1,x->x*2));
|
||||
end;
|
||||
'ЗаполнениеЧисламиФибоначчи': begin
|
||||
CheckData(Empty);
|
||||
CheckOutputSeq(ArrGen(10,1,1,(x,y)->x+y));
|
||||
CheckOutput(ArrGen(10,1,1,(x,y)->x+y));
|
||||
end;
|
||||
'СоседниеЭлементы1': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var a := IntArr(n);
|
||||
var ol := new ObjectList;
|
||||
ol.AddRange(a.Pairwise.Where(\(x,y)->x<y).Select(t->t[1]));
|
||||
CheckOutputAfterInitialSeq(ol);
|
||||
CheckOutputAfterInitial(ol);
|
||||
end;
|
||||
'СоседниеЭлементы2': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt*n);
|
||||
var a := InputListAsIntegers;
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt*n);
|
||||
var a := IntArr(n);
|
||||
var ol := new ObjectList;
|
||||
ol.AddRange(a);
|
||||
ol.Add(a.Pairwise.Where(\(x,y)->x<y).Count);
|
||||
CheckOutputSeq(ol);
|
||||
CheckOutput(ol);
|
||||
end;
|
||||
'ИнвертированиеМассива1': begin
|
||||
var n := 7;
|
||||
CheckData(InitialOutput := |cStr|*n);
|
||||
var a := OutSliceStrArr(0,n-1);
|
||||
CheckOutputSeq(a + a.Reverse);
|
||||
CheckOutput(a + a.Reverse);
|
||||
end;
|
||||
'ИнвертированиеМассива2': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
|
|
@ -213,15 +197,16 @@ begin
|
|||
end;
|
||||
var a := IntArr(n);
|
||||
var ares := a.Reverse.ToArray;
|
||||
CheckOutputAfterInitialSeq(ares);
|
||||
CheckOutputAfterInitial(ares);
|
||||
end;
|
||||
'СтрокаКакМассив1': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
CheckData(InitialOutput := |cStr|*2);
|
||||
CheckOutputSeq(Arr('бочка','ночка','дочка','кочка','почка','точка'));
|
||||
CheckOutput('бочка','ночка','дочка','кочка','почка','точка');
|
||||
end;
|
||||
'СтрокаКакМассив2': begin
|
||||
CheckOutputSeq(Arr('миг','мир','пир','пар'));
|
||||
CheckData(Empty);
|
||||
CheckOutput('миг','мир','пир','пар');
|
||||
end;
|
||||
'СтрокаКакМассив3': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
|
|
@ -234,13 +219,13 @@ begin
|
|||
CheckOutputSeq(ol);
|
||||
end;
|
||||
'СтрокаКакМассив4': begin
|
||||
CheckData(Empty);
|
||||
CheckOutput(True);
|
||||
end;
|
||||
'СтрокаКакМассив5': begin
|
||||
CheckOutputSeq(Arr('абракадабра','эбрэкэдэбрэ'));
|
||||
CheckData(Empty);
|
||||
CheckOutput('абракадабра','эбрэкэдэбрэ');
|
||||
end;
|
||||
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ begin
|
|||
CheckOutput(3,32);
|
||||
end;
|
||||
'Var_2': begin
|
||||
CheckData(InitialOutput := |cInt|*2);
|
||||
CheckData(InitialOutput := cInt*2);
|
||||
CheckOutput(3,4,20,45);
|
||||
end;
|
||||
'Var_4': begin
|
||||
|
|
@ -34,7 +34,7 @@ begin
|
|||
end;
|
||||
'Calculations2': begin
|
||||
CheckData(InitialOutput := |cInt,cInt,cStr,cInt|);
|
||||
CheckOutput(35,65,cStr,35+65,cStr,35*65);
|
||||
CheckOutput(35,65,cStr,35+65,cStr,35*65); // Это круто - можно перемежать типы и значения!
|
||||
end;
|
||||
'Calculations3': begin
|
||||
CheckData(InitialOutput := |cStr,cInt,cInt,cInt|);
|
||||
|
|
@ -61,7 +61,7 @@ begin
|
|||
TestCount := 10;
|
||||
GenerateTests(10, tRe(1,10,digits := 0)*2);
|
||||
CheckOutputSilent(S,P); // Все сообщения ColoredMessage гасятся
|
||||
if TaskResult <> Solved then
|
||||
if TaskResult <> Solved then // Это прикольный способ - проверить, что вывел то, но не в том порядке!
|
||||
CheckOutput(P,S);
|
||||
end;
|
||||
'Task1': begin
|
||||
|
|
@ -107,7 +107,7 @@ begin
|
|||
begin
|
||||
FilterOnlyNumbers;
|
||||
CheckData(InitialOutput := |cInt, cInt|);
|
||||
CheckOutputSeq(Arr(1..9));
|
||||
CheckOutput(Arr(1..9));
|
||||
end;
|
||||
'AssignAdd2':
|
||||
begin
|
||||
|
|
@ -167,13 +167,13 @@ begin
|
|||
begin
|
||||
FilterOnlyNumbers;
|
||||
CheckData(Input := Empty);
|
||||
// Просто поясняющее сообщение
|
||||
// Просто поясняющее сообщение. Ничего не проверяется
|
||||
ColoredMessage('Abs - функция, убирающая знак числа. В математике известна как модуль числа', MsgColorGray);
|
||||
end;
|
||||
'Abs_2_AB':
|
||||
begin
|
||||
FilterOnlyNumbers;
|
||||
CheckData(InitialOutput := |cInt| * 6);
|
||||
CheckData(InitialOutput := cInt * 6);
|
||||
CheckOutput(5,3,2,-1,5,6,7,4,3,9,18,9);
|
||||
end;
|
||||
'SwapProc1':
|
||||
|
|
@ -209,7 +209,7 @@ begin
|
|||
CheckData(Input := Empty);
|
||||
if OutputList.Count = 6 then
|
||||
begin
|
||||
if CompareValues(OutputList[0],37) then
|
||||
if CompareValues(OutputList[0],37) then // Здесь используется CompareValues, а не CompareWithOutput т к логика сложнее
|
||||
ColoredMessage('Измените значение a на 123', MsgColorGray)
|
||||
else if CompareValues(OutputList[0],123) then
|
||||
ColoredMessage('Верно. Проверьте еще значение a = 12345', MsgColorGray)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ begin
|
|||
|
||||
case name of
|
||||
'Types1': begin
|
||||
FilterOnlyNumbers;
|
||||
CheckData(Empty);
|
||||
CheckOutput(cInt,cRe,cStr);
|
||||
end;
|
||||
|
|
@ -50,8 +49,8 @@ begin
|
|||
end;
|
||||
'If1Пароль': begin
|
||||
CheckData(InitialInput := |cInt|);
|
||||
//if int(0)=777 then
|
||||
CheckOutput('Пароль правильный');
|
||||
//if int(0)=777 then // и без этого работает. Тёмное дело...
|
||||
CheckOutput('Пароль правильный'); // Когда по одной ветке ничего не выводится, это сложная ситуация. Это не проконтролируешь
|
||||
end;
|
||||
'If2Пароль': begin
|
||||
CheckData(Input := |cInt|);
|
||||
|
|
@ -87,7 +86,9 @@ begin
|
|||
else CheckOutput(Int(0),'Нечетное');
|
||||
end;
|
||||
'If5ЛогинПарольAnd': begin
|
||||
CancelMessagesIfInitial := False;
|
||||
CancelMessagesIfInitial := False; // Это важнейший флаг.
|
||||
// Обычно если запускается программа с Initial вводом-выводом, то подсказки не выводятся
|
||||
// А здесь выводятся - ученика сразу настраивают, что ему надо вывести
|
||||
CheckData(InitialInput := |cStr,cInt|);
|
||||
TestCount := 10;
|
||||
GenerateTestData := tnum -> begin
|
||||
|
|
@ -95,7 +96,7 @@ begin
|
|||
var p := Arr(777,666,555).RandomElement;
|
||||
if tnum = 5 then
|
||||
(a,p) := ('Angel',777);
|
||||
InputList.AddTestData(|object(a),object(p)|);
|
||||
InputList.AddTestData(|object(a),object(p)|); // Приведение к object - это приём, позволяющий записывать в тестовые данные разные типы
|
||||
end;
|
||||
if (Str(0) = 'Angel') and (Int(1) = 777) then
|
||||
CheckOutput('Вход разрешен')
|
||||
|
|
@ -197,7 +198,7 @@ begin
|
|||
end;
|
||||
'Minmax_2': begin
|
||||
CheckData(InitialOutput := |cInt|);
|
||||
CheckOutputSeq(Arr(3,5,3,5,6,6));
|
||||
CheckOutput(3,5,3,5,6,6);
|
||||
end;
|
||||
'ВложенныеIf2': begin
|
||||
CheckData(Input := |cStr,cInt|);
|
||||
|
|
@ -258,7 +259,7 @@ begin
|
|||
case Str(0) of
|
||||
'черное' : CheckOutput('белое');
|
||||
'высокий': begin
|
||||
CheckOutputSilent('низкий');
|
||||
CheckOutputSilent('низкий'); // о это прикольно. Это когда возможны несколько решений. Вначале проверяем одно, потом другое
|
||||
if TaskResult = TaskStatus.BadSolution then
|
||||
CheckOutput('невысокий');
|
||||
end;
|
||||
|
|
@ -299,7 +300,7 @@ begin
|
|||
var (d,m) := (Int(0),Int(1));
|
||||
//GenerateTests(список кортежей)
|
||||
//GenerateTests(список значений)
|
||||
GenerateTests((1,1),(23,2),(8,3),(1,5),(9,5),(12,6),(4,11),(12,12),(7,13));
|
||||
GenerateTests((1,1),(12,12),(23,2),(8,3),(1,5),(9,5),(12,6),(4,11),(7,13));
|
||||
if (d,m) = (1,1) then
|
||||
CheckOutput('Новый год')
|
||||
else if (d,m) = (23,2) then
|
||||
|
|
@ -314,11 +315,11 @@ begin
|
|||
CheckOutput('День России')
|
||||
else if (d,m) = (4,11) then
|
||||
CheckOutput('День народного единства')
|
||||
else CheckOutput('');
|
||||
//else CheckOutput('');
|
||||
end;
|
||||
'IfXSituations2': begin
|
||||
CheckData(Input := |cInt|);
|
||||
GenerateTests(-2,-1,0,1,2);
|
||||
GenerateTests(2,3,4,5,6);
|
||||
if Int(0) < 3 then
|
||||
CheckOutput('x меньше 3')
|
||||
else if Int(0) in 3..5 then
|
||||
|
|
|
|||
|
|
@ -337,7 +337,14 @@ begin
|
|||
FilterOnlyNumbersAndBools;
|
||||
var N := Int(0);
|
||||
CheckData(Input := |cInt|*(N+1));
|
||||
GenerateTests(10,tInt(1,10)*n);
|
||||
|
||||
TestCount := 5;
|
||||
GenerateTestData := tnum -> begin
|
||||
var N := Random(5, 10);
|
||||
var a := ArrRandomInteger(N,1,10);
|
||||
InputList.AddTestData(|N|+a);
|
||||
end;
|
||||
|
||||
var s := 0;
|
||||
for var i:=1 to N do
|
||||
if Int(i).IsEven then
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ begin
|
|||
'Arr1','Arr2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
CheckData(InitialOutput := cInt*5);
|
||||
CheckOutputSeq(|cInt|*10); // Это еще и типы проверяет. Бывает, что только типы и надо проверить
|
||||
CheckOutput(|cInt|*10); // Это еще и типы проверяет. Бывает, что только типы и надо проверить
|
||||
// Надо проверить, что Output[9] - целое ненулевое
|
||||
if OutputList.Count<10 then // чтобы не получить исключение
|
||||
if OutputList.Count<10 then // чтобы не получить исключение. Ошибки в CheckOutput кидают исключения уже после
|
||||
exit;
|
||||
if OutIsInt(9) then
|
||||
if OutIsInt(9) then // Это - редкая техника
|
||||
if OutInt(9) = 0 then
|
||||
begin
|
||||
ColoredMessage('Массив надо заполнить ненулевыми значениями');
|
||||
|
|
@ -28,23 +28,23 @@ begin
|
|||
FilterOnlyNumbersAndBools;
|
||||
TaskResult := PartialSolution; // То есть, уже начали проверять, уже под контролем
|
||||
CheckData(|cInt|*5, |cInt|*5, |cInt|*10);
|
||||
if TaskResult <> PartialSolution then
|
||||
if TaskResult <> PartialSolution then // Не знаю, зачем это
|
||||
exit;
|
||||
|
||||
CheckOutputSeq(InputList);
|
||||
CheckOutput(InputList); // Что ввели, то и вывели
|
||||
end;
|
||||
'Arr5','Arr6': begin
|
||||
// Проверка того что введено и выведено 10 значений, что ввод совпадает с выводом и что вывод в диапазоне от 2 до 5
|
||||
// Что плохо - все Check неявно меняют TaskResult, а здесь надо еще и явно
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(InitialInput := |cInt|*n, InitialOutput := |cInt|*n);
|
||||
|
||||
TaskResult := PartialSolution; // потому что если просто запустить - будет InitialSolution
|
||||
|
||||
CheckOutputSeq(InputList);
|
||||
CheckOutput(InputList); // Что ввели, то и вывели
|
||||
// Дополнительная проверка
|
||||
if TaskResult = Solved then
|
||||
if TaskResult = Solved then // То есть, после проверки решения мы проверяем еще входные данные
|
||||
begin
|
||||
// проверим на диапазон от 2 до 5
|
||||
var a := IntArr(n);
|
||||
|
|
@ -56,11 +56,11 @@ begin
|
|||
end;
|
||||
end;
|
||||
end;
|
||||
'Arr_Sum0': begin
|
||||
'Arr_Sum0': begin // Этой задачи нет
|
||||
// Это паттерн: вводится n, а потом вводится n элементов массива
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := Int;
|
||||
CheckInput(|cInt| + n*|cInt|);
|
||||
CheckData(Input := |cInt| + n*cInt);
|
||||
var a := IntArr(n);
|
||||
CheckOutput(a.Sum)
|
||||
end;
|
||||
|
|
@ -68,7 +68,7 @@ begin
|
|||
FilterOnlyNumbersAndBools;
|
||||
// Это всё надо. Начальный ввод - 10 целых, весь ввод - тоже
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*(n+1), |cInt|*n);
|
||||
CheckData(cInt*n, cInt*(n+1), cInt*n);
|
||||
|
||||
var a := IntArr(n);
|
||||
var p := integer(a.Product); // потому что ученик будет вычислять в вещественной переменной
|
||||
|
|
@ -77,7 +77,7 @@ begin
|
|||
'Arr_Sum3': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*(n+1), |cInt|*n);
|
||||
CheckData(cInt*n, cInt*(n+1), cInt*n);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitial(a.Product)
|
||||
|
|
@ -85,11 +85,11 @@ begin
|
|||
'Arr_Sum4': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n, cInt*n);
|
||||
|
||||
var a := IntArr(n);
|
||||
var ave := a.Average;
|
||||
CheckOutputAfterInitialSeq(|ave|*2)
|
||||
CheckOutputAfterInitial(ave,ave)
|
||||
end;
|
||||
'Arr_CountA1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
|
|
@ -100,51 +100,51 @@ begin
|
|||
CheckOutputAfterInitial(a.CountOf(3));
|
||||
end;
|
||||
'Arr_CountA2': begin
|
||||
ClearOutputListFromSpaces; // Кроме чисел тут строки
|
||||
// Кроме чисел тут строки
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var lst := ObjectList.New;
|
||||
var a := IntArr(n);
|
||||
var cnt4 := a.CountOf(4);
|
||||
var cnt5 := a.CountOf(5);
|
||||
|
||||
var lst := ObjectList.New; // Можно без списка. Наверное, думал выводить что то еще
|
||||
case cnt4.CompareTo(cnt5) of
|
||||
1: lst.Add('четвёрок больше');
|
||||
0: lst.Add('одинаково');
|
||||
-1: lst.Add('пятёрок больше');
|
||||
end;
|
||||
CheckOutputAfterInitialSeq(lst);
|
||||
CheckOutputAfterInitial(lst);
|
||||
end;
|
||||
'Arr_Replace1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var arr := IntArr(n);
|
||||
arr.Replace(2,3);
|
||||
CheckOutputAfterInitialSeq(arr);
|
||||
CheckOutputAfterInitial(arr);
|
||||
end;
|
||||
'Arr_Replace2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var arr := IntArr(n);
|
||||
arr.Replace(2,22);
|
||||
arr.Replace(5,55);
|
||||
arr.Replace(22,5);
|
||||
arr.Replace(55,2);
|
||||
CheckOutputAfterInitialSeq(arr);
|
||||
CheckOutputAfterInitial(arr);
|
||||
end;
|
||||
'Arr_Find1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 5;
|
||||
CheckData(|cInt|*n, |cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
var has2 := 2 in a;
|
||||
|
|
@ -169,7 +169,7 @@ begin
|
|||
'Arr_Find3': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 5;
|
||||
CheckData(|cInt|*n, |cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n, cInt*n);
|
||||
TestCount := 10;
|
||||
GenerateTestData := tnum -> begin
|
||||
var a := ArrRandomInteger(n,1,99);
|
||||
|
|
@ -220,7 +220,7 @@ begin
|
|||
'Arr_Index2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
TestCount := 10;
|
||||
GenerateTestData := tnum -> begin
|
||||
var a := ArrRandomInteger(n,2,5);
|
||||
|
|
@ -236,17 +236,17 @@ begin
|
|||
'Arr_Index2a': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
var a := IntArr(n);
|
||||
var ind2 := a.IndexOf(2);
|
||||
var ind5 := a.IndexOf(5);
|
||||
CheckOutputAfterInitialSeq(|ind2,ind5|);
|
||||
CheckOutputAfterInitial(ind2,ind5);
|
||||
end;
|
||||
'Arr_Index3': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 20;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
TestCount := 10;
|
||||
GenerateTestData := tnum -> begin
|
||||
var a := ArrRandomInteger(n,2,5);
|
||||
|
|
@ -265,7 +265,7 @@ begin
|
|||
FilterOnlyNumbersAndBools;
|
||||
var n := 30;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
GenerateTests(10, tInt * n);
|
||||
var arr := IntArr(n);
|
||||
var ind := arr.IndexOf(2);
|
||||
ind := arr.IndexOf(2,ind + 1);
|
||||
|
|
@ -275,16 +275,17 @@ begin
|
|||
'Arr_MinMax1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt|*n);
|
||||
CheckData(InitialOutput := cInt * n);
|
||||
|
||||
var a := OutSliceIntArr(0,n-1);
|
||||
var a := OutSliceIntArr(0,n-1); // Ввода нет, поэтому пользуемся начальным выводом
|
||||
// Вот здесь если ученик его сотрёт, то будет плохо
|
||||
var min := a.Min;
|
||||
CheckOutputAfterInitial(min);
|
||||
end;
|
||||
'Arr_MinMax2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
|
|
@ -294,7 +295,7 @@ begin
|
|||
'Arr_MinMax3': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
|
|
@ -303,17 +304,17 @@ begin
|
|||
'Arr_MinMax4': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10,tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitialSeq(|a.Min,a.Max|);
|
||||
CheckOutputAfterInitial(a.Min,a.Max);
|
||||
end;
|
||||
|
||||
'Arr_Neighbors1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 20;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt*n);
|
||||
|
||||
var a := IntArr(n);
|
||||
|
|
@ -325,7 +326,7 @@ begin
|
|||
end;
|
||||
'Arr_MinMaxInd1': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateAutoTests(10);
|
||||
|
||||
var a := IntArr(n);
|
||||
|
|
@ -341,18 +342,18 @@ begin
|
|||
var indmax := a.IndexMax;
|
||||
var indmin := a.IndexMin;
|
||||
Swap(a[indmax],a[indmin]);
|
||||
CheckOutputSeq(acopy + a);
|
||||
CheckOutput(acopy, a);
|
||||
end;
|
||||
|
||||
'Arr_Fill1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
CheckData(Input := nil);
|
||||
CheckData(Input := Empty);
|
||||
|
||||
CheckOutput(ArrFill(10,1));
|
||||
end;
|
||||
'Arr_Fill2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
CheckData(Input := nil);
|
||||
CheckData(Input := Empty);
|
||||
|
||||
CheckOutput(ArrFill(10,1));
|
||||
end;
|
||||
|
|
@ -391,7 +392,7 @@ begin
|
|||
'Arr_Transf6': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
|
|
@ -403,37 +404,37 @@ begin
|
|||
|
||||
'Arr_Reverse1','Arr_Reverse2': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitialSeq(a.Reverse);
|
||||
CheckOutputAfterInitial(a.Reverse);
|
||||
end;
|
||||
'Arr_Reverse3': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
for var i:= 0 to n div 2 - 1 do
|
||||
Swap(a[i],a[i + n div 2]);
|
||||
CheckOutputAfterInitialSeq(a);
|
||||
CheckOutputAfterInitial(a);
|
||||
end;
|
||||
|
||||
'Arr_Reverse3a': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
|
||||
var out := IntArr(n);
|
||||
var out0 := Copy(out);
|
||||
Reverse(out, 0, 5);
|
||||
Reverse(out, 5, 5);
|
||||
CheckOutputSeq(out0 + out);
|
||||
CheckOutput(out0, out);
|
||||
end;
|
||||
|
||||
'Arr_Count1','Arr_Count2': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
|
|
@ -441,7 +442,7 @@ begin
|
|||
end;
|
||||
'Arr_Count3': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
|
|
@ -449,11 +450,11 @@ begin
|
|||
end;
|
||||
'Arr_Count4': begin
|
||||
var n := 30;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitialSeq(|a.CountOf(a.Min),a.CountOf(a.Max)|);
|
||||
CheckOutputAfterInitial(a.CountOf(a.Min),a.CountOf(a.Max));
|
||||
end;
|
||||
|
||||
'Arr_FindIndex1': begin
|
||||
|
|
@ -462,38 +463,38 @@ begin
|
|||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitialSeq(|a.FindIndex(x-> x.IsOdd),a.FindLastIndex(x-> x.IsOdd)|);
|
||||
CheckOutputAfterInitial(a.FindIndex(x-> x.IsOdd),a.FindLastIndex(x-> x.IsOdd));
|
||||
end;
|
||||
'Arr_FindIndex2': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
var i1 := a.FindIndex(x -> x.IsEven);
|
||||
var i2 := a.FindLastIndex(x -> x.IsOdd);
|
||||
Swap(a[i1],a[i2]);
|
||||
CheckOutputAfterInitialSeq(a);
|
||||
CheckOutputAfterInitial(a);
|
||||
end;
|
||||
|
||||
'Arr_Filter1': begin
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateTests(10, tInt(1,100) * n);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitialSeq(a.Where(x->x<50));
|
||||
CheckOutputAfterInitial(a.Where(x -> x < 50));
|
||||
end;
|
||||
'Arr_GenFilter1': begin
|
||||
CheckData(Input := Empty);
|
||||
var a := ArrGen(50,1,x->x+2);
|
||||
CheckOutputSeq(a.Where(x->x mod 7 = 0));
|
||||
var a := ArrGen(50, 1, x -> x+2);
|
||||
CheckOutput(a.Where(x -> x mod 7 = 0));
|
||||
end;
|
||||
'Arr_GenFilter2': begin
|
||||
var n := 40;
|
||||
CheckData(InitialOutput := |cInt|*n);
|
||||
var a := ArrGen(40,1,1,(x,y)->x+y);
|
||||
CheckOutputAfterInitialSeq(a.Where(x->x mod 5 = 0));
|
||||
CheckOutputAfterInitial(a.Where(x->x mod 5 = 0));
|
||||
end;
|
||||
|
||||
'Arr_Op1': begin
|
||||
|
|
@ -502,7 +503,7 @@ begin
|
|||
var b := |0| * 6 + |1| * 6;
|
||||
var c := |1,2,3|*3 + |4,5,6|*3;
|
||||
var d := |1| * 5 + |2| * 5 + |1| * 5 + |2| * 5;
|
||||
CheckOutputSeq(a+b+c+d);
|
||||
CheckOutput(a, b, c, d);
|
||||
end;
|
||||
|
||||
'Arr_Slice1': begin
|
||||
|
|
@ -510,28 +511,28 @@ begin
|
|||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
var a := Arr(0..9);
|
||||
CheckOutputSeq(a + a[2:6] + a[:4] + a[2:]);
|
||||
CheckOutput(a, a[2:6], a[:4], a[2:]);
|
||||
end;
|
||||
'Arr_Slice2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
var a := Arr(0..9);
|
||||
CheckOutputSeq(a + a[:2] + a[5:] + a[1:^1]);
|
||||
CheckOutput(a, a[:2], a[5:], a[1:^1]);
|
||||
end;
|
||||
'Arr_Slice3': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt| * n + |cInt| * 2);
|
||||
CheckData(InitialOutput := cInt * n + cInt * 2);
|
||||
var a := Arr(0..9);
|
||||
CheckOutputSeq(a + |9| + |8| + |7| + a[^2:] + a[1:^1])
|
||||
CheckOutput(a, 9, 8, 7, a[^2:], a[1:^1])
|
||||
end;
|
||||
'Arr_Slice7': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
CheckData(InitialOutput := cInt * n);
|
||||
var a := Arr(0..9);
|
||||
CheckOutputSeq(a + a[4::-1] + a[9::-2])
|
||||
CheckOutput(a, a[4::-1], a[9::-2])
|
||||
end;
|
||||
'Arr_Slice10': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
|
|
@ -556,37 +557,37 @@ begin
|
|||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
var a := Arr(0..9);
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
CheckOutputSeq(a + a[:5] + a[6:]);
|
||||
CheckData(InitialOutput := cInt * n);
|
||||
CheckOutput(a, a[:5], a[6:]);
|
||||
end;
|
||||
'Arr_InsDel2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
var a := Arr(0..9);
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
CheckOutputSeq(a + a[:5] + |333| + a[5:]);
|
||||
CheckData(InitialOutput := cInt * n);
|
||||
CheckOutput(a, a[:5], 333, a[5:]);
|
||||
end;
|
||||
'Arr_InsDel3': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
var a := Arr(0..9);
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
CheckOutputSeq(a + a[:1] + |555| + a[1:^1] + |555| + a[^1:]);
|
||||
CheckData(InitialOutput := cInt * n);
|
||||
CheckOutput(a, a[:1], 555, a[1:^1], 555, a[^1:]);
|
||||
end;
|
||||
|
||||
'Arr_Shift1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
var a := Arr(0..9);
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
CheckOutputSeq(a + a[1:] + |0|);
|
||||
CheckData(InitialOutput := cInt * n);
|
||||
CheckOutput(a, a[1:], 0);
|
||||
end;
|
||||
'Arr_Shift2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
var a := Arr(0..9);
|
||||
CheckData(InitialOutput := |cInt| * n);
|
||||
CheckOutputSeq(a + |0| + a[:^1]);
|
||||
CheckOutput(a, 0, a[:^1]);
|
||||
end;
|
||||
|
||||
'List1': begin
|
||||
|
|
@ -612,61 +613,61 @@ begin
|
|||
'List5': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateAutoTests(10);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitialSeq(a.Where(x->x.IsEven));
|
||||
CheckOutputAfterInitial(a.Where(x->x.IsEven));
|
||||
end;
|
||||
'List6': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(|cInt|*n, cInt*n);
|
||||
GenerateAutoTests(10);
|
||||
|
||||
var a := IntArr(n);
|
||||
CheckOutputAfterInitialSeq(a.Where(x->x.IsEven)+a.Where(x->x.IsOdd));
|
||||
CheckOutputAfterInitial(a.Where(x->x.IsEven), a.Where(x->x.IsOdd));
|
||||
end;
|
||||
'List6a': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
CheckData(InitialInput := |cInt|*3);
|
||||
CheckData(InitialInput := cInt * 3);
|
||||
GenerateAutoTests(10);
|
||||
|
||||
var a := IntArr(3);
|
||||
CheckOutputSeq(|1,3,5|+a);
|
||||
CheckOutput(1,3,5,a);
|
||||
end;
|
||||
'List6b': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(|1,3,5,2,4,6,9,8,7|);
|
||||
CheckOutput(1,3,5,2,4,6,9,8,7);
|
||||
end;
|
||||
'List7': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 20;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateAutoTests(5);
|
||||
var a := IntArr(10);
|
||||
var b := IntArr(10);
|
||||
CheckOutputAfterInitialSeq(a.Interleave(b));
|
||||
CheckOutputAfterInitial(a.Interleave(b));
|
||||
end;
|
||||
'List8': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt|*n);
|
||||
CheckData(InitialOutput := cInt*n);
|
||||
var a := OutSliceIntArr(0,n-1);
|
||||
var b := a.ToList;
|
||||
b.Insert(2,555);
|
||||
CheckOutputSeq(a+b);
|
||||
CheckOutput(a, b);
|
||||
end;
|
||||
'List9': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt|*n);
|
||||
CheckData(InitialOutput := cInt*n);
|
||||
var a := OutSliceIntArr(0,n-1);
|
||||
var b := a.ToList;
|
||||
if b.Count>0 then
|
||||
b.RemoveAt(2);
|
||||
CheckOutputSeq(a+b);
|
||||
CheckOutput(a, b);
|
||||
end;
|
||||
'List9a': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
|
|
@ -678,52 +679,52 @@ begin
|
|||
var n := 10;
|
||||
CheckData(InitialInput := |cInt|*n);
|
||||
var a := IntArr(n);
|
||||
CheckOutputSeq(a);
|
||||
CheckOutput(a);
|
||||
end;
|
||||
|
||||
'Sort1': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateAutoTests(5);
|
||||
var a := IntArr(n);
|
||||
CheckOutputSeq(a+a.Sorted);
|
||||
CheckOutput(a, a.Sorted);
|
||||
end;
|
||||
'Sort2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(cInt*n, cInt*n);
|
||||
GenerateAutoTests(5);
|
||||
var a := IntArr(n);
|
||||
CheckOutputSeq(a+a.SortedDescending);
|
||||
CheckOutput(a, a.SortedDescending);
|
||||
end;
|
||||
'Sort3': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 9;
|
||||
CheckData(InitialOutput := |cInt|*n);
|
||||
CheckData(InitialOutput := cInt*n);
|
||||
|
||||
var a := OutSliceIntArr(0,n-1);
|
||||
CheckOutputSeq(a + a.Sorted);
|
||||
CheckOutput(a, a.Sorted);
|
||||
end;
|
||||
'BubbleSort': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 10;
|
||||
CheckData(InitialOutput := |cInt|*n);
|
||||
CheckData(InitialOutput := cInt*n);
|
||||
|
||||
var a := OutSliceIntArr(0,n-1);
|
||||
var b := Copy(a);
|
||||
for var j:=n-1 downto 1 do
|
||||
if b[j-1] > b[j] then
|
||||
Swap(b[j-1], b[j]);
|
||||
CheckOutputSeq(a + b);
|
||||
CheckOutput(a, b);
|
||||
end;
|
||||
'BubbleSort2': begin
|
||||
FilterOnlyNumbersAndBools;
|
||||
var n := 9;
|
||||
CheckData(InitialOutput := |cInt|*n);
|
||||
CheckData(InitialOutput := cInt*n);
|
||||
|
||||
var a := OutSliceIntArr(0,n-1);
|
||||
CheckOutputSeq(a+a.Sorted);
|
||||
CheckOutput(a, a.Sorted);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -6,24 +6,25 @@ var AllTaskNames: array of string;
|
|||
|
||||
procedure CheckTaskT(name: string);
|
||||
begin
|
||||
FlattenOutput; // Во всех задачах на массивы
|
||||
ClearOutputListFromSpaces; // Это чтобы a.Print работал. По идее, надо писать всегда. Яне знаю задач, где пробелы в ответе
|
||||
|
||||
case name of
|
||||
'ДвумерныеМассивы1': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
//FilterOnlyNumbersAndBools;
|
||||
CheckOutputSeq(|5,4,5,5,2,4,3,3,5,3,5,4|);
|
||||
// Есть проблема - если при выводе вещественные будут перемежаться с целыми, то ошибка!
|
||||
ConvertStringsToNumbersInOutputList; // Это при выводе двумерных массивов возникают строки.
|
||||
// Если строка не преобразуется в массив, то так и останется строкой
|
||||
FilterOnlyNumbersAndBools; // после преобразования те строки, которые нельзя преобразовать в числа, отфильтровать
|
||||
CheckOutput(5,4,5,5,2,4,3,3,5,3,5,4);
|
||||
end;
|
||||
'ДвумерныеМассивы2': begin
|
||||
// Преобразовать в 6 целых по строкам
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
CheckOutputSeq(|5,4,5,5,2,4,3,3,5,3,5,4|);
|
||||
FilterOnlyNumbersAndBools;
|
||||
CheckOutput(5,4,5,5,2,4,3,3,5,3,5,4);
|
||||
end;
|
||||
'ДвумерныеМассивы3': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
CheckData(Input := |cInt|*12);
|
||||
CheckOutputSeq(InputList);
|
||||
CheckData(Input := cInt*12);
|
||||
CheckOutput(InputList);
|
||||
end;
|
||||
'Заполн1_Формула','Заполн2_Matr': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
|
|
@ -33,7 +34,7 @@ begin
|
|||
for var i:=0 to 8 do
|
||||
for var j:=0 to 8 do
|
||||
ob.Add((i+1)*(j+1));
|
||||
CheckOutputSeq(ob);
|
||||
CheckOutput(ob);
|
||||
end;
|
||||
'Заполн3_Шахм': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
|
|
@ -45,42 +46,42 @@ begin
|
|||
if (i + j).IsEven then
|
||||
ob.Add(1)
|
||||
else ob.Add(0);
|
||||
CheckOutputSeq(ob);
|
||||
CheckOutput(ob);
|
||||
end;
|
||||
'SumInMatr': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
var n := 12;
|
||||
CheckData(InitialInput := |cInt|*n, InitialOutput := |cInt|*n);
|
||||
CheckData(InitialInput := cInt*n, InitialOutput := cInt*n);
|
||||
var res := IntArr(n).Sum;
|
||||
CheckOutputAfterInitial(res);
|
||||
end;
|
||||
'MaxInMatr': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
var n := 12;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(InitialInput := cInt*n, InitialOutput := cInt*n);
|
||||
var res := IntArr(n).Max;
|
||||
CheckOutputAfterInitial(res);
|
||||
end;
|
||||
'СтрокаСтолбец1','СтрокаСтолбец3': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
var n := 54;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(InitialInput := cInt*n, InitialOutput := cInt*n);
|
||||
|
||||
var m := MatrByRow(6,9,IntArr(n));
|
||||
CheckOutputAfterInitialSeq(m.Row(2));
|
||||
CheckOutputAfterInitial(m.Row(2));
|
||||
end;
|
||||
'СтрокаСтолбец2','СтрокаСтолбец4': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
var n := 54;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(InitialInput := cInt*n, InitialOutput := cInt*n);
|
||||
|
||||
var m := MatrByRow(6,9,IntArr(n));
|
||||
CheckOutputAfterInitialSeq(m.Col(8));
|
||||
CheckOutputAfterInitial(m.Col(8));
|
||||
end;
|
||||
'MaxInRow': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
var n := 54;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(InitialInput := cInt*n, InitialOutput := cInt*n);
|
||||
|
||||
var m := MatrByRow(6,9,IntArr(n));
|
||||
CheckOutputAfterInitial(m.Row(0).Max,m.Row(5).Min,m.Col(4).Average);
|
||||
|
|
@ -88,7 +89,7 @@ begin
|
|||
'CountInRowsCols': begin
|
||||
ConvertStringsToNumbersInOutputList;
|
||||
var n := 54;
|
||||
CheckData(|cInt|*n, |cInt|*n);
|
||||
CheckData(InitialInput := cInt*n, InitialOutput := cInt*n);
|
||||
GenerateTests(10, tInt(1,5) * n);
|
||||
|
||||
var m := MatrByRow(6,9,IntArr(n));
|
||||
|
|
|
|||
|
|
@ -8,19 +8,18 @@ var AllTaskNames: array of string;
|
|||
|
||||
procedure CheckTaskT(name: string);
|
||||
begin
|
||||
FlattenOutput;
|
||||
ClearOutputListFromSpaces;
|
||||
|
||||
case name of
|
||||
'Char1': begin
|
||||
CheckData(Input := Empty);
|
||||
var a := Arr(word(48), word(100), word(68), word(1102), word(8594));
|
||||
CheckOutputSeq(a);
|
||||
CheckOutput(a);
|
||||
end;
|
||||
'Char2': begin
|
||||
CheckData(Input := Empty);
|
||||
var a := Arr(Chr(169), Chr(931), Chr(960), Chr(1105), Chr(8551), Chr(8734), Chr(8776), Chr(8986), Chr(9327), Chr(9775), Chr(9917), Chr(10054));
|
||||
CheckOutputSeq(a);
|
||||
CheckOutput(a);
|
||||
end;
|
||||
'CharTable': begin
|
||||
CheckData(Input := Empty);
|
||||
|
|
@ -29,23 +28,23 @@ begin
|
|||
begin
|
||||
Obj.Add(i); obj.Add(Chr(i));
|
||||
end;
|
||||
CheckOutputSeq(obj);
|
||||
CheckOutput(obj);
|
||||
end;
|
||||
'CharPredSucc': begin
|
||||
CheckData(Input := |cChar|);
|
||||
GenerateTests('b','c','2','y');
|
||||
var c := LightPT.Chr(0);
|
||||
var c := LightPT.Chr(0); // Нельзя вызывать Chr - это ошибка!!!
|
||||
CheckOutput(Pred(c),Succ(c));
|
||||
end;
|
||||
'CharIs': begin
|
||||
CheckData(Input := |cChar|);
|
||||
GenerateTests('b','X','2','ю');
|
||||
var c := LightPT.Chr(0);
|
||||
CheckOutputSeq(Arr(c.IsLetter, c.IsDigit, c.IsLower, c.IsUpper));
|
||||
CheckOutput(c.IsLetter, c.IsDigit, c.IsLower, c.IsUpper);
|
||||
end;
|
||||
'CharRange1': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('0'..'9')+Arr('a'..'z')+Arr('а'..'я'));
|
||||
CheckOutput('0'..'9', 'a'..'z', 'а'..'я');
|
||||
end;
|
||||
'CharRange2': begin
|
||||
CheckData(Input := |cChar|);
|
||||
|
|
@ -77,7 +76,7 @@ begin
|
|||
end;
|
||||
'Strings1': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq('трос'.ToCharArray);
|
||||
CheckOutput('трос'.ToCharArray);
|
||||
end;
|
||||
'Strings2': begin
|
||||
CheckData(Input := Empty);
|
||||
|
|
@ -85,17 +84,18 @@ begin
|
|||
end;
|
||||
'Strings2a': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('грозы','осы','ложки','кошки'));
|
||||
OutputList := OutputList;
|
||||
CheckOutput('грозы','осы','ложки','кошки');
|
||||
end;
|
||||
'Strings3': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('миг', 'мир', 'пир', 'пар'));
|
||||
CheckOutput('миг', 'мир', 'пир', 'пар');
|
||||
end;
|
||||
'Strings4': begin
|
||||
CheckData(Input := Empty);
|
||||
var hs := HSet('кошка','мышка','комик','комок','ножка','ножик','коржик','камыш');
|
||||
var hs1 := OutputListAsStrings.ToHashSet;
|
||||
if (hs*hs1).Count >= 5 then
|
||||
if (hs*hs1).Count >= 5 then // Это классная суперидея. Мы не просто сравниваем с решением один в один, а мы используем сложное сравнение
|
||||
TaskResult := Solved
|
||||
else begin
|
||||
TaskResult := PartialSolution;
|
||||
|
|
@ -104,25 +104,22 @@ begin
|
|||
end;
|
||||
'Strings5': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('********************', '010101010101010101010101010101'));
|
||||
CheckOutput('********************', '010101010101010101010101010101');
|
||||
end;
|
||||
'Strings6': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('кросс', 'атолл', 'Гримм', 'быстрее'));
|
||||
CheckOutput('кросс', 'атолл', 'Гримм', 'быстрее');
|
||||
end;
|
||||
'String13': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(9);
|
||||
end;
|
||||
'String15': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cStr|);
|
||||
var s := Str(0);
|
||||
CheckOutput(s.Count(c -> c.IsLetter and c.IsLower));
|
||||
end;
|
||||
'String16': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cStr|);
|
||||
GenerateTests('HeLLo','привет','ИНФОРМАТИКА');
|
||||
var s := Str(0);
|
||||
|
|
@ -130,7 +127,7 @@ begin
|
|||
end;
|
||||
'StrCode': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('рсйгжу', 'сткдзф', 'тулеих'));
|
||||
CheckOutput('рсйгжу', 'сткдзф', 'тулеих');
|
||||
end;
|
||||
'StrDeCode': begin
|
||||
CheckData(Input := Empty);
|
||||
|
|
@ -154,115 +151,95 @@ begin
|
|||
CheckOutput(14,15);
|
||||
end;
|
||||
'StrCountOf': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(3,5,2);
|
||||
end;
|
||||
'StrCreate1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput('abcdefghijklmnopqrstuvwxyz');
|
||||
end;
|
||||
'StrCreate2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput('каждый охотник желает знать где сидит фазан');
|
||||
end;
|
||||
'StrWhere1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('каждый охотник желает знать где сидит фазан','буря мглою небо кроет вихри снежные крутя'));
|
||||
CheckOutput('каждый охотник желает знать где сидит фазан','буря мглою небо кроет вихри снежные крутя');
|
||||
end;
|
||||
'StrWhere2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('1223113221113','12112571191460'));
|
||||
CheckOutput('1223113221113','12112571191460');
|
||||
end;
|
||||
'StrSelect1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('вфсѐ!ндмпя!ожвп!лспжу!гйцсй!тожзоьж!лсфуѐ'));
|
||||
CheckOutput('вфсѐ!ндмпя!ожвп!лспжу!гйцсй!тожзоьж!лсфуѐ');
|
||||
end;
|
||||
'StrSelect2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
var a := Arr(1082,1072,1078,1076,1099,1081,32,1086,1093,1086,1090,1085,1080,1082,32,1078,1077,1083,1072,1077,1090,32,1079,1085,1072,1090,1100,32,1075,1076,1077,32,1089,1080,1076,1080,1090,32,1092,1072,1079,1072,1085 );
|
||||
var a1 := a.Select(x->word(x));
|
||||
CheckOutputSeq(a1);
|
||||
CheckOutput(a1);
|
||||
end;
|
||||
'StrMinMax': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('а','ё'));
|
||||
CheckOutput('а','ё');
|
||||
end;
|
||||
'StrWhereSelect': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(23);
|
||||
end;
|
||||
'StrAllAny1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(True,False);
|
||||
end;
|
||||
'StrAllAny2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(True,False);
|
||||
end;
|
||||
'StrEachCount1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
var res := 'The grass is always greener on the other side of the fence'.EachCount;
|
||||
var ob := new ObjectList;
|
||||
foreach var x in res.ToArray do
|
||||
ob.Add(x);
|
||||
CheckOutputSeq(ob);
|
||||
CheckOutput(ob);
|
||||
end;
|
||||
'StrEachCount2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
var res := 'L1o24st tim437364e is nev567e9r fo089874u89nd041342 ag8432ai6897'.EachCount;
|
||||
var ob := new ObjectList;
|
||||
foreach var x in res.ToArray do
|
||||
if x.Key.IsDigit then
|
||||
ob.Add(x);
|
||||
CheckOutputSeq(ob);
|
||||
CheckOutput(ob);
|
||||
end;
|
||||
'StrOrder1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(' adefgilmnorstuv');
|
||||
end;
|
||||
'StrOrder2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput('0','1','3','5','8');
|
||||
end;
|
||||
'ToWords1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput('головой жак звонарь как однажды сломал фонарь');
|
||||
end;
|
||||
'ToWords2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput('как жак сломал фонарь однажды звонарь головой');
|
||||
end;
|
||||
'ToWordsWhere1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput('косой кривоногий косой косой косой косой');
|
||||
end;
|
||||
'Pos1': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr(2,9));
|
||||
CheckOutput(2,9);
|
||||
end;
|
||||
'Pos2': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr(7));
|
||||
CheckOutput(7);
|
||||
end;
|
||||
'Delete1': begin
|
||||
CheckData(Input := Empty);
|
||||
|
|
@ -302,7 +279,7 @@ begin
|
|||
end;
|
||||
'StrSlice1': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('Pascal','ABC','NET'));
|
||||
CheckOutput('Pascal','ABC','NET');
|
||||
end;
|
||||
'StrSlice2': begin
|
||||
CheckData(Input := Empty);
|
||||
|
|
@ -310,7 +287,7 @@ begin
|
|||
end;
|
||||
'StrSlice4': begin
|
||||
CheckData(Input := Empty);
|
||||
CheckOutputSeq(Arr('mydocument', 'docx', 'picture', 'jpg'));
|
||||
CheckOutput('mydocument', 'docx', 'picture', 'jpg');
|
||||
end;
|
||||
'Str_Number0': begin
|
||||
CheckData(Input := Empty);
|
||||
|
|
@ -318,23 +295,19 @@ begin
|
|||
end;
|
||||
'Str_Number03': begin
|
||||
CheckData(Input := Empty);
|
||||
ClearOutputListFromSpaces;
|
||||
CheckOutput(386);
|
||||
end;
|
||||
'Str_Number04': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := |cInt|);
|
||||
GenerateTests(2,34,567,67890);
|
||||
var n := Int(0);
|
||||
CheckOutput(n.ToString.Select(s->s.ToDigit).Sum);
|
||||
end;
|
||||
'Str_Number05': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(31.6666666666667,27.0,42.0);
|
||||
end;
|
||||
'Str_Number06': begin
|
||||
ClearOutputListFromSpaces;
|
||||
CheckData(Input := Empty);
|
||||
CheckOutput(420);
|
||||
end;
|
||||
|
|
|
|||
Loading…
Reference in a new issue