My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
67
68
69
70
71
72
73
-----------------------------------------------------------------------
-- util-xunit - Unit tests on top of AUnit
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------

with AUnit;
with AUnit.Simple_Test_Cases;
with AUnit.Test_Suites;
with AUnit.Test_Fixtures;
with Ada.Strings.Unbounded;

with GNAT.Source_Info;

-- The <b>Util.XUnit</b> package exposes a common package definition used by the Ada testutil
-- library. It is intended to hide the details of the AUnit implementation.
-- A quite identical package exist for Ahven implementation.
package Util.XUnit is

use Ada.Strings.Unbounded;
use AUnit.Test_Suites;

subtype Status is AUnit.Status;

Success : constant Status := AUnit.Success;
Failure : constant Status := AUnit.Failure;

subtype Message_String is AUnit.Message_String;
subtype Test_Suite is AUnit.Test_Suites.Test_Suite;
subtype Access_Test_Suite is AUnit.Test_Suites.Access_Test_Suite;

function Format (S : in String) return Message_String renames AUnit.Format;

type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with null record;

-- maybe_overriding
procedure Assert (T : in Test_Case;
Condition : in Boolean;
Message : in String := "Test failed";
Source : in String := GNAT.Source_Info.File;
Line : in Natural := GNAT.Source_Info.Line);

type Test is abstract new AUnit.Test_Fixtures.Test_Fixture with null record;

-- maybe_overriding
procedure Assert (T : in Test;
Condition : in Boolean;
Message : in String := "Test failed";
Source : in String := GNAT.Source_Info.File;
Line : in Natural := GNAT.Source_Info.Line);

-- The main testsuite program. This launches the tests, collects the
-- results, create performance logs and set the program exit status
-- according to the testsuite execution status.
generic
with function Suite return Access_Test_Suite;
procedure Harness (Output : in Ada.Strings.Unbounded.Unbounded_String;
XML : in Boolean;
Result : out Status);

end Util.XUnit;

Change log

r381 by Stephane.Carrez on Nov 27, 2011   Diff
AUnit compilation fixes
- Since AUnit versions are not consistent,
provide a specific Test type
  that provides an Assert dispatching
operation.  Some AUnit version
  provide it some others don't.
Go to: 
Project members, sign in to write a code review

Older revisions

r380 by Stephane.Carrez on Nov 27, 2011   Diff
Aunit issues
- Override the Assert procedure as
older versions of Aunit don't provide
it
r379 by Stephane.Carrez on Nov 27, 2011   Diff
Cleanup AUnit implementation: remove
unused Assert_Equals procedures
r375 by Stephane.Carrez on Nov 26, 2011   Diff
Refactor 'testutil' to isolate the
AUnit files
- Move the AUnit specific files in
'testutil/aunit'
- Add a configure option '--enable-
...
All revisions of this file

File info

Size: 2951 bytes, 73 lines
Powered by Google Project Hosting