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
38 lines
995 B
Ada
38 lines
995 B
Ada
with Ada.Text_IO; use Ada.Text_IO;
|
|
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
|
|
|
|
procedure Statistics is
|
|
type Float_Array is array (1 .. 10) of Float;
|
|
|
|
function Sum(Arr : Float_Array) return Float is
|
|
Total : Float := 0.0;
|
|
begin
|
|
for I in Arr'Range loop
|
|
Total := Total + Arr(I);
|
|
end loop;
|
|
return Total;
|
|
end Sum;
|
|
|
|
function Average(Arr : Float_Array) return Float is
|
|
begin
|
|
return Sum(Arr) / Float(Arr'Length);
|
|
end Average;
|
|
|
|
function Minimum(Arr : Float_Array) return Float is
|
|
Min : Float := Arr(Arr'First);
|
|
begin
|
|
for I in Arr'Range loop
|
|
if Arr(I) < Min then
|
|
Min := Arr(I);
|
|
end if;
|
|
end loop;
|
|
return Min;
|
|
end Minimum;
|
|
|
|
Data : Float_Array := (3.0, 7.0, 2.0, 9.0, 4.0, 6.0, 1.0, 8.0, 5.0, 10.0);
|
|
begin
|
|
Put_Line("Sum: " & Float'Image(Sum(Data)));
|
|
Put_Line("Average: " & Float'Image(Average(Data)));
|
|
Put_Line("Minimum: " & Float'Image(Minimum(Data)));
|
|
end Statistics;
|