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 | with Ada_Containers; use Ada_Containers; |
---|
33 | with Ada_Containers.AUnit_Lists; |
---|
34 | with AUnit.Options; |
---|
35 | with AUnit.Simple_Test_Cases; |
---|
36 | with AUnit.Test_Results; use AUnit.Test_Results; |
---|
37 | |
---|
38 | |
---|
39 | package AUnit.Test_Cases is |
---|
40 | |
---|
41 | type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with |
---|
42 | private; |
---|
43 | type Test_Case_Access is access all Test_Case'Class; |
---|
44 | |
---|
45 | type Test_Routine is access procedure (Test : in out Test_Case'Class); |
---|
46 | |
---|
47 | type Routine_Spec is record |
---|
48 | Routine : Test_Routine; |
---|
49 | Routine_Name : Message_String; |
---|
50 | end record; |
---|
51 | |
---|
52 | procedure Add_Routine (T : in out Test_Case'Class; Val : Routine_Spec); |
---|
53 | |
---|
54 | procedure Register_Tests (Test : in out Test_Case) is abstract; |
---|
55 | |
---|
56 | |
---|
57 | procedure Set_Up_Case (Test : in out Test_Case); |
---|
58 | |
---|
59 | |
---|
60 | procedure Tear_Down_Case (Test : in out Test_Case); |
---|
61 | |
---|
62 | |
---|
63 | package Registration is |
---|
64 | |
---|
65 | procedure Register_Routine |
---|
66 | (Test : in out Test_Case'Class; |
---|
67 | Routine : Test_Routine; |
---|
68 | Name : String); |
---|
69 | |
---|
70 | |
---|
71 | function Routine_Count (Test : Test_Case'Class) return Count_Type; |
---|
72 | |
---|
73 | |
---|
74 | end Registration; |
---|
75 | |
---|
76 | generic |
---|
77 | type Specific_Test_Case is abstract new Test_Case with private; |
---|
78 | package Specific_Test_Case_Registration is |
---|
79 | |
---|
80 | |
---|
81 | type Specific_Test_Routine is access procedure |
---|
82 | (Test : in out Specific_Test_Case'Class); |
---|
83 | |
---|
84 | procedure Register_Wrapper |
---|
85 | (Test : in out Specific_Test_Case'Class; |
---|
86 | Routine : Specific_Test_Routine; |
---|
87 | Name : String); |
---|
88 | |
---|
89 | end Specific_Test_Case_Registration; |
---|
90 | |
---|
91 | procedure Run |
---|
92 | (Test : access Test_Case; |
---|
93 | Options : AUnit.Options.AUnit_Options; |
---|
94 | R : in out Result'Class; |
---|
95 | Outcome : out Status); |
---|
96 | |
---|
97 | |
---|
98 | procedure Run_Test (Test : in out Test_Case); |
---|
99 | |
---|
100 | |
---|
101 | function Routine_Name (Test : Test_Case) return Message_String; |
---|
102 | |
---|
103 | |
---|
104 | private |
---|
105 | |
---|
106 | type Routine_Access is access all Routine_Spec; |
---|
107 | |
---|
108 | |
---|
109 | package Routine_Lists is new Ada_Containers.AUnit_Lists (Routine_Spec); |
---|
110 | |
---|
111 | |
---|
112 | package Failure_Lists is |
---|
113 | new Ada_Containers.AUnit_Lists (Message_String); |
---|
114 | |
---|
115 | |
---|
116 | type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with record |
---|
117 | Routines : aliased Routine_Lists.List; |
---|
118 | Routine : Routine_Spec; |
---|
119 | end record; |
---|
120 | |
---|
121 | end AUnit.Test_Cases; |
---|