Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a simple set of AUnit tests to experiment with Ada unit testing

  • Loading branch information...
commit 130b9555560ae5007a9ba4b807861b2d133d9cd2 1 parent fb50ac0
@rtyler authored
View
12 aunit-experiment/Makefile
@@ -0,0 +1,12 @@
+
+all:
+ mkdir -p build
+ gprbuild -p tests.gpr
+
+
+test: all
+ ./runtests
+
+clean:
+ rm -rf build
+ rm -f runtests
View
13 aunit-experiment/simpletest/runtests.adb
@@ -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;
View
12 aunit-experiment/simpletest/simpletest-suite.adb
@@ -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;
View
6 aunit-experiment/simpletest/simpletest-suite.ads
@@ -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;
View
22 aunit-experiment/simpletest/simpletest.adb
@@ -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;
+
View
12 aunit-experiment/simpletest/simpletest.ads
@@ -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;
View
13 aunit-experiment/tests.gpr
@@ -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;

0 comments on commit 130b955

Please sign in to comment.
Something went wrong with that request. Please try again.