aunit-test_suites.ads

1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- A U N I T . T E S T _ S U I T E S --
6-- --
7-- S p e c --
8-- --
9-- --
10-- Copyright (C) 2000-2011, AdaCore --
11-- --
12-- GNAT is free software; you can redistribute it and/or modify it under --
13-- terms of the GNU General Public License as published by the Free Soft- --
14-- ware Foundation; either version 3, or (at your option) any later ver- --
15-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17-- or FITNESS FOR A PARTICULAR PURPOSE. --
18-- --
19-- As a special exception under Section 7 of GPL version 3, you are granted --
20-- additional permissions described in the GCC Runtime Library Exception, --
21-- version 3.1, as published by the Free Software Foundation. --
22-- --
23-- You should have received a copy of the GNU General Public License and --
24-- a copy of the GCC Runtime Library Exception along with this program; --
25-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26-- <http://www.gnu.org/licenses/>. --
27-- --
28-- GNAT is maintained by AdaCore (http://www.adacore.com) --
29-- --
30------------------------------------------------------------------------------
31
32-- A collection of test cases.
33
34with Ada_Containers;
35with Ada_Containers.AUnit_Lists;
36with AUnit.Options; use AUnit.Options;
37with AUnit.Simple_Test_Cases; use AUnit.Simple_Test_Cases;
38with AUnit.Tests;
39with AUnit.Test_Results; use AUnit.Test_Results;
40
41package AUnit.Test_Suites is
42
43 type Test_Suite is new AUnit.Tests.Test with private;
44 type Access_Test_Suite is access all Test_Suite'Class;
45
46 procedure Add_Test (S : access Test_Suite'Class;
47 T : access Test_Suite'Class);
48 procedure Add_Test (S : access Test_Suite'Class;
49 T : access Test_Case'Class);
50 -- Add a test case or suite to this suite
51
52 procedure Run (Suite : access Test_Suite;
53 Options : AUnit_Options;
54 R : in out Result'Class;
55 Outcome : out Status);
56 -- Run all tests collected into this suite
57
58 function New_Suite return Access_Test_Suite;
59 -- Create a new test suite
60
61private
62
63 type Test_Suite_Elt_Kind is
64 (TC_Elt,
65 TS_Elt);
66
67 type Test_Suite_Element (Kind : Test_Suite_Elt_Kind := TC_Elt) is record
68 case Kind is
69 when TC_Elt =>
70 TC : Test_Case_Access;
71 when TS_Elt =>
72 TS : Access_Test_Suite;
73 end case;
74 end record;
75
76 use Ada_Containers;
77
78 package Test_Lists is new Ada_Containers.AUnit_Lists (Test_Suite_Element);
79 use Test_Lists;
80 -- Containers for test cases and sub-suites
81
82 type Test_Suite is new AUnit.Tests.Test with record
83 Tests : aliased Test_Lists.List;
84 end record;
85
86end AUnit.Test_Suites;