Add basic AUnit testing structure for the library

This commit is contained in:
R. Tyler Croy 2011-04-10 11:16:53 -07:00
parent a392622c78
commit 4e0d978634
6 changed files with 54 additions and 1 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
*.so
build
obj
textrunner

View File

@ -1,7 +1,7 @@
GPRBUILD=gprbuild
GPRCLEAN=gprclean
TESTRUNNER=testrunner
TESTRUNNER=textrunner
lib: pre
$(GPRBUILD) -p redis.gpr
@ -13,9 +13,13 @@ pre:
syntax: pre
gnatmake -gnatc -gnat05 -P redis.gpr
test: lib
$(GPRBUILD) -p test/unit.gpr
./$(TESTRUNNER)
clean: pre
$(GPRCLEAN) redis.gpr
$(GPRCLEAN) test/unit.gpr
rm -rf build obj
rm -f *.so*

View File

@ -0,0 +1,11 @@
with Redis;
package body RedisSuite 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 Memcache.Client.Test.Client_Test);
return Result;
end Suite;
end RedisSuite;

View File

@ -0,0 +1,7 @@
with AUnit.Test_Suites;
use AUnit.Test_Suites;
package RedisSuite is
function Suite return Access_Test_Suite;
end RedisSuite;

View File

@ -0,0 +1,14 @@
with AUnit.Run;
with AUnit.Reporter.Text;
use AUnit.Reporter.Text;
with RedisSuite;
procedure TextRunner is
procedure Runner is new AUnit.Run.Test_Runner (RedisSuite.Suite);
Reporter : Text_Reporter;
begin
Set_Use_ANSI_Colors (Engine => Reporter,
Value => True);
Runner (Reporter);
end TextRunner;

16
test/unit.gpr Normal file
View File

@ -0,0 +1,16 @@
with "aunit";
with "../redis";
project Unit is
for Source_Dirs use ("harness", "scenarios");
for Main use ("textrunner.adb");
for Object_Dir use "../obj";
for Exec_Dir use "../";
package Compiler is
for Default_Switches("ada") use
("-g", "-gnateS", "-ftest-coverage", "-gnatv",
"-gnatf", "-gnatyabcefhiklmnprst", "-gnat05");
end Compiler;
end Unit;