Files
kucherenko__jscpd/fixtures/ada/file1.ada
apk 64e471e2b0 test: raise coverage to 96%+ on @jscpd/finder and 98%+ on apps/jscpd
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
2026-05-09 15:00:38 +02:00

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 Maximum(Arr : Float_Array) return Float is
Max : Float := Arr(Arr'First);
begin
for I in Arr'Range loop
if Arr(I) > Max then
Max := Arr(I);
end if;
end loop;
return Max;
end Maximum;
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("Maximum: " & Float'Image(Maximum(Data)));
end Statistics;