aunit-simple_test_cases.ads

1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- A U N I T . S I M P L E _ T E S T _ C A S E S --
6-- --
7-- S p e c --
8-- --
9-- --
10-- Copyright (C) 2008-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-- This type is used to implement a simple test case: define a derived type
33-- that overrides the Run_Test and Name methods.
34--
35-- You don't usually need to use that type, but Test_Fixture/Test_Caller
36-- or Test_Case instead.
37
38with AUnit.Assertions;
39with AUnit.Options;
40with AUnit.Test_Results; use AUnit.Test_Results;
41
42package AUnit.Simple_Test_Cases is
43
44 type Test_Case is abstract new AUnit.Assertions.Test with private;
45 type Test_Case_Access is access all Test_Case'Class;
46
47 function Name (Test : Test_Case) return Message_String is abstract;
48 -- Test case name
49
50 function Routine_Name (Test : Test_Case) return Message_String;
51 -- Routine name. By default return a null Message_String
52
53 procedure Run_Test
54 (Test : in out Test_Case) is abstract;
55 -- Perform the test.
56
57 procedure Set_Up (Test : in out Test_Case);
58 -- Set up performed before each test
59
60 procedure Tear_Down (Test : in out Test_Case);
61 -- Tear down performed after each test
62
63 ----------------------------------------------
64 -- Below are internal routines. Do not use --
65 ----------------------------------------------
66
67 procedure Run (Test : access Test_Case;
68 Options : AUnit.Options.AUnit_Options;
69 R : in out Result'Class;
70 Outcome : out Status);
71 -- Run test case. Do not override
72
73private
74
75 type Test_Case is abstract new AUnit.Assertions.Test with null record;
76
77end AUnit.Simple_Test_Cases;