mirror of
https://github.com/kucherenko/jscpd.git
synced 2026-09-19 08:11:03 +08:00
64e471e2b0
Adds 92 new tests (178 → 270 total) with zero source-file modifications: - packages/finder: 13 new test files covering all reporters, subscribers, validators, hooks, utils, options, cloneFound, getFilesToDetect, and InFilesDetector; shared buildClone() factory helper - apps/jscpd: 3 new test files (options-unit, print, store) plus extensions to formats, modes, and options integration tests - vitest.config.ts added to both packages to restrict coverage.include to src/** only, eliminating bin/ and prism.js noise - Fixes 3 tokenizer bugs (trailing space in format lookup, tokenization edge cases) uncovered by the new format fixture suite - Adds fixture files for 40+ language formats to support formats.test.ts
54 lines
1.0 KiB
ObjectPascal
54 lines
1.0 KiB
ObjectPascal
program DataProcessor;
|
|
|
|
uses
|
|
SysUtils, Classes, Math;
|
|
|
|
type
|
|
TDataRecord = record
|
|
Id : Integer;
|
|
Name : string;
|
|
Value : Double;
|
|
Active: Boolean;
|
|
end;
|
|
|
|
function ValidateInput(const Value: string): Boolean;
|
|
begin
|
|
Result := (Length(Value) > 0) and (Length(Value) <= 255);
|
|
end;
|
|
|
|
function ParseIntSafe(const S: string; out Value: Integer): Boolean;
|
|
begin
|
|
Result := TryStrToInt(S, Value);
|
|
end;
|
|
|
|
procedure SortByValue(var Arr: array of Double);
|
|
var
|
|
I, J : Integer;
|
|
Temp : Double;
|
|
begin
|
|
for I := Low(Arr) to High(Arr) - 1 do
|
|
for J := Low(Arr) to High(Arr) - I - 1 do
|
|
if Arr[J] > Arr[J + 1] then
|
|
begin
|
|
Temp := Arr[J];
|
|
Arr[J] := Arr[J + 1];
|
|
Arr[J+1] := Temp;
|
|
end;
|
|
end;
|
|
|
|
// File-specific: compute minimum
|
|
function FindMinimum(const Arr: array of Double): Double;
|
|
var
|
|
I : Integer;
|
|
MinVal : Double;
|
|
begin
|
|
MinVal := Arr[Low(Arr)];
|
|
for I := Low(Arr) + 1 to High(Arr) do
|
|
if Arr[I] < MinVal then MinVal := Arr[I];
|
|
Result := MinVal;
|
|
end;
|
|
|
|
begin
|
|
WriteLn('Data Processor v2');
|
|
end.
|