Natools

Check-in [55b72004aa]
Login
Overview
Comment:time_statistics-tests: new test packge for Time_Statistics hierarchy
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 55b72004aacd7c4c508fb0c7b5c96f7efe65fc10
User & Date: nat on 2014-09-03 17:28:09
Other Links: manifest | tags
Context
2014-09-04
20:59
time_statistics-generic_timers: new package providing timers to feed accumulators check-in: 367f2398ce user: nat tags: trunk
2014-09-03
17:28
time_statistics-tests: new test packge for Time_Statistics hierarchy check-in: 55b72004aa user: nat tags: trunk
2014-09-02
17:21
time_statistics: new parent package for time statistics gathering check-in: 13debf8a9e user: nat tags: trunk
Changes

Added tests/natools-time_statistics-tests.adb version [d05f8e5e43].



































































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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté                                        --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

package body Natools.Time_Statistics.Tests is

   procedure Check is new NT.Generic_Check
     (Natural, "=", Natural'Image, False);

   procedure Check is new NT.Generic_Check
     (Duration, "=", Duration'Image, False);


   -------------------------
   -- Complete Test Suite --
   -------------------------

   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Summary_Accumulator (Report);
   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------

   procedure Summary_Accumulator (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Summary accumulator");
   begin
      declare
         Stats : Summary;
      begin
         Stats.Add (10.1);
         Stats.Add (9.9);

         Check (Test, 2, Stats.Sample_Count, "Sample count");
         Check (Test, 10.1, Stats.Maximum, "Maximum");
         Check (Test, 9.9, Stats.Minimum, "Minimum");
         Check (Test, 10.0, Stats.Mean, "Mean");

         Stats.Add (10.3);

         Check (Test, 3, Stats.Sample_Count, "Sample count");
         Check (Test, 10.3, Stats.Maximum, "Maximum");
         Check (Test, 9.9, Stats.Minimum, "Minimum");
         Check (Test, 10.1, Stats.Mean, "Mean");
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Summary_Accumulator;

end Natools.Time_Statistics.Tests;

Added tests/natools-time_statistics-tests.ads version [26921c27ee].

































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté                                        --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

------------------------------------------------------------------------------
-- Natools.Time_Statistics.Tests provides a test suite for the statistics   --
-- facilities rooted at package Natools.Time_Statistics.                    --
------------------------------------------------------------------------------

with Natools.Tests;

package Natools.Time_Statistics.Tests is

   package NT renames Natools.Tests;

   procedure All_Tests (Report : in out NT.Reporter'Class);

   procedure Summary_Accumulator (Report : in out NT.Reporter'Class);

end Natools.Time_Statistics.Tests;

Modified tests/test_all.adb from [f12c5e815d] to [2ff1b1f46f].

37
38
39
40
41
42
43

44
45
46
47
48
49
50
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51







+







with Natools.S_Expressions.Printers.Tests;
with Natools.S_Expressions.Printers.Pretty.Tests;
with Natools.S_Expressions.Printers.Pretty.Config.Tests;
with Natools.Static_Hash_Maps.S_Expressions.Tests;
with Natools.String_Slice_Set_Tests;
with Natools.String_Slice_Tests;
with Natools.Time_IO.Tests;
with Natools.Time_Statistics.Tests;
with Natools.Tests.Text_IO;

procedure Test_All is
   package Uneven_Chunked_Strings is new Natools.Chunked_Strings
     (Default_Allocation_Unit => 7,
      Default_Chunk_Size      => 15);
   package Uneven_Chunked_Strings_Tests is new Uneven_Chunked_Strings.Tests;
152
153
154
155
156
157
158




159
160
161
162
163
164
165
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170







+
+
+
+







   Report.Section ("String_Slices.Slice_Sets");
   Natools.String_Slice_Set_Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("Time_IO");
   Natools.Time_IO.Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("Time_Statistics");
   Natools.Time_Statistics.Tests.All_Tests (Report);
   Report.End_Section;

   Natools.Tests.Text_IO.Print_Results (Report.Total_Results);

   declare
      Results : constant Natools.Tests.Result_Summary := Report.Total_Results;
   begin
      if Results (Natools.Tests.Fail) > 0 or