-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a simple set of AUnit tests to experiment with Ada unit testing
- Loading branch information
R. Tyler Croy
committed
Nov 8, 2010
1 parent
fb50ac0
commit 130b955
Showing
7 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
all: | ||
mkdir -p build | ||
gprbuild -p tests.gpr | ||
|
||
|
||
test: all | ||
./runtests | ||
|
||
clean: | ||
rm -rf build | ||
rm -f runtests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
with AUnit.Reporter.Text; | ||
with AUnit.Run; | ||
|
||
with SimpleTest.Suite; | ||
use SimpleTest.Suite; | ||
|
||
procedure RunTests is | ||
procedure Runner is new AUnit.Run.Test_Runner (Suite); | ||
Reporter : AUnit.Reporter.Text.Text_Reporter; | ||
begin | ||
-- Set_Use_ANSI_Colors(); | ||
Runner(Reporter); | ||
end RunTests; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
with SimpleTest; | ||
|
||
|
||
package body SimpleTest.Suite is | ||
use AUnit.Test_Suites; | ||
function Suite return Access_Test_Suite is | ||
Result : constant Access_Test_Suite := new Test_Suite; | ||
begin | ||
Result.Add_Test(new SimpleTest.Test); | ||
return Result; | ||
end Suite; | ||
end SimpleTest.Suite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
with AUnit.Test_Suites; | ||
use AUnit.Test_Suites; | ||
|
||
package SimpleTest.Suite is | ||
function Suite return Access_Test_Suite; | ||
end SimpleTest.Suite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- | ||
-- Simple AUnit test package body | ||
-- | ||
|
||
with AUnit.Assertions; | ||
use AUnit.Assertions; | ||
|
||
package body SimpleTest is | ||
function Name(T: Test) return AUnit.Message_String is | ||
pragma Unreferenced(T); | ||
begin | ||
return AUnit.Format("SimpleTest package"); | ||
end Name; | ||
|
||
procedure Run_Test(T: In out Test) is | ||
pragma Unreferenced(T); | ||
begin | ||
Assert(True, "How can True be false!"); | ||
Assert(False, "False is False, a-doy"); | ||
end Run_Test; | ||
end SimpleTest; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- | ||
-- Simple AUnit (AdaUnit) test spec file | ||
-- | ||
|
||
with AUnit; | ||
with AUnit.Simple_Test_Cases; | ||
|
||
package SimpleTest is | ||
type Test is new AUnit.Simple_Test_Cases.Test_Case with null record; | ||
function Name (T : Test) return AUnit.Message_String; | ||
procedure Run_Test (T : in out Test); | ||
end SimpleTest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
with "aunit"; | ||
|
||
project Simpletest is | ||
for Source_Dirs use ("simpletest"); | ||
for Main use ("runtests.adb"); | ||
for Object_Dir use "build"; | ||
for Exec_Dir use "."; | ||
|
||
package Compiler is | ||
for Default_Switches("ada") use | ||
("-g", "-gnat05"); | ||
end Compiler; | ||
end Simpletest; |