aunit-21.0.0.fa386849/0000755000175000017500000000000013743420530013650 5ustar nicolasnicolasaunit-21.0.0.fa386849/Makefile0000644000175000017500000000233513743420530015313 0ustar nicolasnicolasRTS = TARGET = GPRBUILD = gprbuild GPRCLEAN = gprclean GPRINSTALL = gprinstall INSTALL:=$(shell exec=`which gprbuild`;if [ ! -x "$$exec" ]; then unset exec;fi;echo $$exec | sed -e 's/\/bin\/$(GPRBUILD).*//') ifeq ($(RTS),) RTS=full RTS_CONF = else RTS_CONF = --RTS=$(RTS) endif ifeq ($(TARGET),) TARGET=native TARGET_CONF = else TARGET_CONF = --target=$(TARGET) endif MODE = Install CONF_ARGS = $(TARGET_CONF) $(RTS_CONF) GPROPTS = $(CONF_ARGS) -XAUNIT_BUILD_MODE=$(MODE) -XAUNIT_RUNTIME=$(RTS) \ -XAUNIT_PLATFORM=$(TARGET) .PHONY: all clean targets install_clean install all: $(GPRBUILD) -p $(GPROPTS) lib/gnat/aunit.gpr clean-lib: $(RM) -fr lib/aunit lib/aunit-obj clean: clean-lib -${MAKE} -C docs clean install-clean-legacy: ifneq (,$(wildcard $(INSTALL)/lib/gnat/manifests/aunit)) -$(GPRINSTALL) $(GPROPTS) --uninstall --prefix=$(INSTALL) \ --project-subdir=lib/gnat aunit endif install-clean: install-clean-legacy ifneq (,$(wildcard $(INSTALL)/share/gpr/manifests/aunit)) -$(GPRINSTALL) $(GPROPTS) --uninstall --prefix=$(INSTALL) aunit endif install: install-clean $(GPRINSTALL) $(GPROPTS) -p -f --prefix=$(INSTALL) \ --no-build-var lib/gnat/aunit.gpr .PHONY: doc doc: ${MAKE} -C doc RM = rm aunit-21.0.0.fa386849/doc/0000755000175000017500000000000013743420530014415 5ustar nicolasnicolasaunit-21.0.0.fa386849/doc/Makefile0000644000175000017500000000505213530730011016047 0ustar nicolasnicolas# Makefile for Sphinx documentation # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = DOC_NAME=$* sphinx-build PAPER = BUILDDIR = build SOURCEDIR = . # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) \ -c $(SOURCEDIR)/share \ -d $(BUILDDIR)/$*/doctrees \ $(SOURCEDIR) DOC_LIST=aunit_cb FMT_LIST=html pdf txt info .PHONY: all help clean all: $(foreach doc, $(DOC_LIST), $(doc).all) help: @echo "Please use \`make ' where is one of" @echo " DOC_NAME.html to make standalone HTML files" @echo " DOC_NAME.pdf to make LaTeX files and run them through pdflatex" @echo " DOC_NAME.txt to make text files" @echo " DOC_NAME.texinfo to make Texinfo files" @echo " DOC_NAME.info to make info files" @echo " DOC_NAME.all to build DOC_NAME for all previous formats" @echo " all to build all documentations in all formats" @echo " html-all same as previous rule but only for HTML format" @echo " pdf-all same as previous rule but only for PDF format" @echo " txt-all same as previous rule but only for text format" @echo " texinfo-all same as previous rule but only for texinfo format" @echo " info-all same as previous rule but only for info format" @echo "" @echo "DOC_NAME should be a documentation name in the following list:" @echo " $(DOC_LIST)" @echo "" @echo "source and location can be overriden using SOURCEDIR and BUILDDIR variables" clean: -rm -rf $(BUILDDIR)/*/html \ $(BUILDDIR)/*/pdf \ $(BUILDDIR)/*/txt \ $(BUILDDIR)/*/info %.html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/$*/html %.pdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/$*/pdf cp $(SOURCEDIR)/share/sphinx.sty $(BUILDDIR)/$*/pdf $(MAKE) -C $(BUILDDIR)/$*/pdf all-pdf LATEXOPTS="-interaction=nonstopmode" %.txt: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/$*/txt $(MAKE) -C $(BUILDDIR)/$*/txt plaintext %.info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/$*/info $(MAKE) -C $(BUILDDIR)/$*/info info %.texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/$*/texinfo html-all: $(foreach doc, $(DOC_LIST), $(doc).html) pdf-all: $(foreach doc, $(DOC_LIST), $(doc).pdf) txt-all: $(foreach doc, $(DOC_LIST), $(doc).txt) texinfo-all: $(foreach doc, $(DOC_LIST), $(doc).texinfo) %.all: $(MAKE) $(foreach fmt, $(FMT_LIST), $*.$(fmt)) aunit-21.0.0.fa386849/doc/aunit_cb/0000755000175000017500000000000013646146735016217 5ustar nicolasnicolasaunit-21.0.0.fa386849/doc/aunit_cb/suite.rst0000644000175000017500000000741313530730011020061 0ustar nicolasnicolas.. _Suite: ***** Suite ***** Creating a Test Suite ===================== How do you run several test cases at once? .. index:: see: Test_Suite; AUnit.Test_Suites.Test_Suite see: Test_Suites; AUnit.Test_Suites .. index:: AUnit.Test_Suites package .. index:: AUnit.Test_Suites.Test_Suite type As soon as you have two tests, you'll want to run them together. You could run the tests one at a time yourself, but you would quickly grow tired of that. Instead, AUnit provides an object, ``Test_Suite``, that runs any number of test cases together. To create a suite of two test cases and run them together, first create a test suite: .. code-block:: ada with AUnit.Test_Suites; package My_Suite is function Suite return AUnit.Test_Suites.Access_Test_Suite; end My_Suite; .. code-block:: ada -- Import tests and sub-suites to run with Test_Case_1, Test_Case_2; package body My_Suite is use AUnit.Test_Suites; -- Statically allocate test suite: Result : aliased Test_Suite; -- Statically allocate test cases: Test_1 : aliased Test_Case_1.Test_Case; Test_2 : aliased Test_Case_2.Test_Case; function Suite return Access_Test_Suite is begin Add_Test (Result'Access, Test_Case_1'Access); Add_Test (Result'Access, Test_Case_2'Access); return Result'Access; end Suite; end My_Suite; .. index:: AUnit.Test_Suites.New_Suite, AUnit.Memory.Utils.Gen_Alloc Instead of statically allocating test cases and suites, you can also use ``AUnit.Test_Suites.New_Suite`` and/or ``AUnit.Memory.Utils.Gen_Alloc``. These routines emulate dynamic memory management (see :ref:`Using_AUnit_with_Restricted_Run-Time_Libraries`). Similarly, if you know that the tests will always be executed for a run-time profile that supports dynamic memory management, you can allocate these objects directly with the Ada ``new`` operation. The harness is: .. code-block:: ada with My_Suite; with AUnit.Run; with AUnit.Reporter.Text; procedure My_Tests is procedure Run is new AUnit.Run.Test_Runner (My_Suite.Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Run (Reporter); end My_Tests; .. index:: Composition of test suites Composition of Suites ===================== Typically, one will want the flexibility to execute a complete set of tests, or some subset of them. In order to facilitate this, we can compose both suites and test cases, and provide a harness for any given suite: .. code-block:: ada -- Composition package: with AUnit; use AUnit; package Composite_Suite is function Suite return Test_Suites.Access_Test_Suite; end Composite_Suite; -- Import tests and suites to run with This_Suite, That_Suite; with AUnit.Tests; package body Composite_Suite is use Test_Suites; -- Here we dynamically allocate the suite using the New_Suite function -- We use the 'Suite' functions provided in This_Suite and That_Suite -- We also use Ada 2005 distinguished receiver notation to call Add_Test function Suite return Access_Test_Suite is Result : Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin Result.Add_Test (This_Suite.Suite); Result.Add_Test (That_Suite.Suite); return Result; end Suite; end Composite_Suite; The harness remains the same: .. code-block:: ada with Composite_Suite; with AUnit.Run; procedure My_Tests is procedure Run is new AUnit.Run.Test_Runner (Composite_Suite.Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Run (Reporter); end My_Tests; As can be seen, this is a very flexible way of composing test cases into execution runs: any combination of test cases and sub-suites can be collected into a suite. aunit-21.0.0.fa386849/doc/aunit_cb/installation_and_use.rst0000644000175000017500000001043713530730011023127 0ustar nicolasnicolas.. _Installation_and_Use: ******************** Installation and Use ******************** .. index:: Installation of AUnit, ZFP profile, cert profile AUnit 3 contains support for restricted runtimes such as the zero-foot-print (ZFP) and certified (cert) profiles. It can now be installed simultaneously for several targets and runtimes. .. _Note_on_gprbuild: Note on gprbuild ================ .. index:: gprbuild, gprinstall In order to compile, install and use AUnit, you need `gprbuild` and `gprinstall` version 2.2.0 or above. .. _Support_for_other_platforms/run-times: Support for other platforms/run-times ===================================== AUnit should be built and installed separately for each target and runtime it is meant to be used with. The necessary customizations are performed at AUnit build time, so once the framework is installed, it is always referenced simply by adding the line :: with "aunit"; to your project. .. _Installing_AUnit: Installing AUnit ================ Normally AUnit comes preinstalled and ready-to-use for all runtimes in your GNAT distribution. The following instructions are for rebuilding it from sources for a custom configuration that the user may have. * Extract the archive: :: $ gunzip -dc aunit--src.tgz | tar xf - * To build AUnit for a full Ada run-time: :: $ cd aunit--src $ make .. index:: ZFP profile * To build AUnit for a ZFP run-time targeting powerpc-elf platform: :: $ cd aunit--src $ make TARGET=powerpc-elf RTS=zfp * To build AUnit for a reconfigurable runtime zfp-leon3 targeting leon3-elf platform: :: $ cd aunit--src $ make TARGET=leon3-elf RTS=zfp RTS_CONF="--RTS=zfp-leon3" Once the above build procedure has been performed for the desired platform, you can install AUnit: :: $ make install INSTALL= .. index:: gprbuild We recommend that you install AUnit into the standard location used by `gprbuild` to find the libraries for a given configuration. For example for the case above (runtime `zfp-leon3` targeting `leon3-elf`), the default location is :samp:`{}/leon3-elf/zfp-leon3`. If the runtime is located in a custom directory and specified by the full path, using this exact path also as ** is a sensible choice. If ``INSTALL`` is not specified, then AUnit will use the root directory where `gprbuild` is installed. * Specific installation: The AUnit makefile supports some specific options, activated using environment variables. The following options are defined: .. index:: INSTALL environment variable * ``INSTALL``: defines the AUnit base installation directory, set to gprbuild's base installation directory as found in the ``PATH``. .. index:: TARGET environment variable * ``TARGET``: defines the gnat tools prefix to use. For example, to compile AUnit for powerpc VxWorks, ``TARGET`` should be set to ``powerpc-wrs-vxworks``. If not set, the native compiler will be used. .. index:: RTS environment variable * ``RTS``: defines both the run-time used to compile AUnit and the value given to the AUnit project as ``RUNTIME`` scenario variable. .. index:: RTS_CONF environment variable * ``RTS_CONF``: defines the `gprbuild` Runtime config flag. The value is set to ``--RTS=$(RTS)`` by default. Can be used when compiling AUnit for a configurable run-time. * To test AUnit: The AUnit test suite is in the test subdirectory of the source package. :: $ cd test $ make The test suite's makefile supports the following variables: * ``RTS`` * ``TARGET`` .. _Installed_files: Installed files =============== The AUnit library is installed in the specified directory (** identifies the root installation directory as specified during the installation procedures above): .. index:: aunit.gpr project file * the :file:`aunit.gpr` project is installed in :samp:`{}/lib/gnat` * the AUnit source files are installed in :samp:`{}/include/aunit` * the AUnit library files are installed in :samp:`{}/lib/aunit` * the AUnit documentation is installed in :samp:`{}/share/doc/aunit` * the AUnit examples are installed in :samp:`{}/share/examples/aunit` aunit-21.0.0.fa386849/doc/aunit_cb/introduction.rst0000644000175000017500000000630713530730011021452 0ustar nicolasnicolas.. _Introduction: ************ Introduction ************ This is a short guide for using the AUnit test framework. AUnit is an adaptation of the Java :index:`JUnit` (Kent Beck, Erich Gamma) and C++ :index:`CppUnit` (M. Feathers, J. Lacoste, E. Sommerlade, B. Lepilleur, B. Bakker, S. Robbins) unit test frameworks for Ada code. What's new in AUnit 3 ===================== AUnit 3 brings several enhancements over AUnit 2 and AUnit 1: * Removal of the genericity of the AUnit framework, making the AUnit 3 API as close as possible to AUnit 1. * Emulates dynamic memory management for limited run-time profiles. * Provides a new XML reporter, and changes harness invocation to support easy switching among text, XML and customized reporters. * Provides new tagged types ``Simple_Test_Case``, ``Test_Fixture`` and ``Test_Caller`` that correspond to CppUnit's ``TestCase``, ``TestFixture`` and ``TestCaller`` classes. .. index:: ZFP profile .. index:: setjmp/longjmp * Emulates exception propagation for restricted run-time profiles (e.g. ZFP), by using the gcc builtin `setjmp` / `longjmp` mechanism. * Reports the source location of an error when possible. Typographic conventions ======================= .. index:: notational convention For notational convenience, `` will be used throughout this document to stand for the AUnit product version number. For example, aunit-**-src expands to aunit-|version|-src. Examples ======== With this version, we have provided new examples illustrating the enhanced features of the framework. These examples are in the AUnit installation directory: :file:`/share/examples/aunit`, and are also available in the source distribution :samp:`aunit-{}-src/examples`. The following examples are provided: * simple_test: shows use of AUnit.Simple_Test_Cases (see :ref:`AUnit.Simple_Test_Cases`). * test_caller: shows use of AUnit.Test_Caller (see :ref:`AUnit.Test_Caller`). * test_fixture: example of a test fixture (see :ref:`Fixture`). * liskov: This suite tests conformance to the Liskov Substitution Principle of a pair of simple tagged types. (see :ref:`OOP_considerations`) * failures: example of handling and reporting failed tests (see :ref:`Reporting`). * calculator: a full example of test suite organization. Note about limited run-time libraries ===================================== AUnit allows a great deal of flexibility for the structure of test cases, suites and harnesses. The templates and examples given in this document illustrate how to use AUnit while staying within the constraints of the GNAT Pro restricted and Zero Footprint (ZFP) run-time libraries. Therefore, they avoid the use of dynamic allocation and some other features that would be outside of the profiles corresponding to these libraries. Tests targeted to the full Ada run-time library need not comply with these constraints. Thanks ====== This document is adapted from the JUnit and CppUnit Cookbooks documents contained in their respective release packages. .. |c-cedilla-lc| unicode:: 0xE7 :trim: Special thanks to Fran |c-cedilla-lc| ois Brun of Thales Avionics for his ideas about support for OOP testing. aunit-21.0.0.fa386849/doc/aunit_cb/fixture.rst0000644000175000017500000000763113530730011020420 0ustar nicolasnicolas.. _Fixture: ******* Fixture ******* .. index:: see: Test fixture; Fixture .. index:: Fixture Tests need to run against the background of a set of known entities. This set is called a *test fixture*. When you are writing tests you will often find that you spend more time writing code to set up the fixture than you do in actually testing values. You can make writing fixture code easier by sharing it. Often you will be able to use the same fixture for several different tests. Each case will send slightly different messages or parameters to the fixture and will check for different results. When you have a common fixture, here is what you do: * Create a *Test Case* package as in previous section. * Declare variables or components for elements of the fixture either as part of the test case type or in the package body. * According to the Test_Case type used, override its ``Set_Up`` and/or ``Set_Up_Case`` subprogram: .. index:: AUnit.Simple_Test_Cases.Set_Up procedure * ``AUnit.Simple_Test_Cases``: ``Set_Up`` is called before ``Run_Test``. .. index:: AUnit.Test_Cases.Set_Up procedure .. index:: AUnit.Test_Cases.Set_Up_Case procedure * ``AUnit.Test_Cases``: ``Set_Up`` is called before each test routine while ``Set_Up_Case`` is called once before the routines are run. .. index:: AUnit.Test_Fixtures.Set_Up_Case procedure * ``AUnit.Test_Fixtures``: ``Set_Up`` is called before each test case created using ``Aunit.Test_Caller``. * You can also override ``Tear_Down`` and/or ``Tear_Down_Case`` that are executed after the test is run. For example, to write several test cases that want to work with different combinations of 12 Euros, 14 Euros, and 26 US Dollars, first create a fixture. The package spec is now: .. code-block:: ada with AUnit; use AUnit; package Money_Tests is use Test_Results; type Money_Test is new Test_Cases.Test_Case with null record; procedure Register_Tests (T: in out Money_Test); -- Register routines to be run function Name (T : Money_Test) return Test_String; -- Provide name identifying the test case procedure Set_Up (T : in out Money_Test); -- Set up performed before each test routine -- Test Routines: procedure Test_Simple_Add (T : in out Test_Cases.Test_Case'Class); end Money_Tests; The body becomes: .. code-block:: ada package body Money_Tests is use Assertions; -- Fixture elements EU_12, EU_14 : Euro; US_26 : US_Dollar; -- Preparation performed before each routine procedure Set_Up (T: in out Money_Test) is begin EU_12 := 12; EU_14 := 14; US_26 := 26; end Set_Up; procedure Test_Simple_Add (T : in out Test_Cases.Test_Case'Class) is X, Y : Some_Currency; begin Assert (EU_12 + EU_14 /= US_26, "US and EU currencies not differentiated"); end Test_Simple_Add; -- Register test routines to call procedure Register_Tests (T: in out Money_Test) is use Test_Cases.Registration; begin -- Repeat for each test routine: Register_Routine (T, Test_Simple_Add'Access, "Test Addition"); end Register_Tests; -- Identifier of test case function Name (T: Money_Test) return Test_String is begin return Format ("Money Tests"); end Name; end Money_Tests; Once you have the fixture in place, you can write as many test routines as you like. Calls to ``Set_Up`` and ``Tear_Down`` bracket the invocation of each test routine. Once you have several test cases, organize them into a Suite. .. index:: AUnit.Test_Fixtures You can find a compilable example of fixture set up using ``AUnit.Test_Fixtures`` in your AUnit installation directory: :samp:`{}/share/examples/aunit/test_fixture/` or from the AUnit source distribution :samp:`aunit-{}-src/examples/test_fixture/`. aunit-21.0.0.fa386849/doc/aunit_cb/overview.rst0000644000175000017500000001645413530730011020603 0ustar nicolasnicolas.. |nbsp| unicode:: 0xA0 :trim: .. _Overview: ******** Overview ******** How do you write testing code? The simplest approach is as an expression in a debugger. You can change debug expressions without recompiling, and you can wait to decide what to write until you have seen the running objects. You can also write test expressions as statements that print to the standard output stream. Both styles of tests are limited because they require human judgment to analyze their results. Also, they don't compose nicely - you can only execute one debug expression at a time and a program with too many print statements causes the dreaded "Scroll Blindness". AUnit tests do not require human judgment to interpret, and it is easy to run many of them at the same time. When you need to test something, here is what you do: .. index:: AUnit.Simple_Test_Cases.Test_Case type .. index:: AUnit.Test_Cases.Test_Case type .. index:: AUnit.Test_Fixtures.Test_Fixture type * Derive a test case type from ``AUnit.Simple_Test_Cases.Test_Case``. Several test case types are available: * ``AUnit.Simple_Test_Cases.Test_Case``: the base type for all test cases. Needs overriding of ``Name`` and ``Run_Test``. * ``AUnit.Test_Cases.Test_Case``: the traditional AUnit test case type, allowing multiple test routines to be registered, where each one is run and reported independently. * ``AUnit.Test_Fixtures.Test_Fixture``: used together with ``AUnit.Test_Caller``, this allows easy creation of test suites comprising several test cases that share the same fixture (see :ref:`Fixture`). See :ref:`Test_Case` for simple examples of using these types. * When you want to check a value [#]_ use one of the following Assert [#]_ methods: .. [#] While :index:`JUnit` and some other members of the xUnit family of unit test frameworks provide specialized forms of assertions (e.g. `assertEqual`), we took a design decision in AUnit not to provide such forms. Ada has a much richer type system giving a large number of possible scalar types, and leading to an explosion of possible special forms of assert routines. This is exacerbated by the lack of a single root type for most types, as is found in Java. With the introduction of AUnit |nbsp| 2 for use with restricted run-time profiles, where even ``'Image`` is missing, providing a comprehensive set of special assert routines in the framework itself becomes even more unrealistic. Since AUnit is intended to be an extensible toolkit, users can certainly write their own custom collection of such assert routines to suit local usage. .. index:: see: Assert subprogram; AUnit.Assertions.Assert .. [#] Note that in AUnit |nbsp| 3, and contrary to AUnit |nbsp| 2, the procedural form of `Assert` has the same behavior whatever the underlying Ada run-time library: a failed assertion will cause the execution of the calling test routine to be abandoned. The functional form of `Assert` always continues on a failed assertion, and provides you with a choice of behaviors. .. index:: AUnit.Assertions.Assert .. code-block:: ada AUnit.Assertions.Assert (Boolean_Expression, String_Description); or: .. code-block:: ada if not AUnit.Assertions.Assert (Boolean_Expression, String_Description) then return; end if; .. index:: Assert_Exception subprogram If you need to test that a subprogram raises an expected exception, there is the procedure ``Assert_Exception`` that takes an access value designating the procedure to be tested as a parameter: .. code-block:: ada type Throwing_Exception_Proc is access procedure; procedure Assert_Exception (Proc : Throwing_Exception_Proc; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line); -- Test that Proc throws an exception and record "Message" if not. Example: .. code-block:: ada -- Declared at library level: procedure Test_Raising_Exception is begin call_to_the_tested_method (some_args); end Test_Raising_Exception; -- In test routine: procedure My_Routine (...) is begin Assert_Exception (Test_Raising_Exception'Access, **String_Description**); end My_Routine; This procedure can handle exceptions with all run-time profiles (including zfp). If you are using a run-time library capable of propagating exceptions, you can use the following idiom instead: .. code-block:: ada procedure My_Routine (...) is begin ... -- Call subprogram expected to raise an exception: Call_To_The_Tested_Method (some_args); Assert (False, 'exception not raised'); exception when desired_exception => null; end My_Routine; An unexpected exception will be recorded as such by the framework. If you want your test routine to continue beyond verifying that an expected exception has been raised, you can nest the call and handler in a block. .. index:: ZFP profile .. index:: cert profile .. index:: AUnit.Memory.Utils.Gen_Alloc .. index:: AUnit.Test_Caller.Create .. index:: AUnit.Test_Suites.New_Suite * Create a suite function inside a package to gather together test cases and sub-suites. (If either the ZFP or the cert run-time profiles ia being used, test cases and suites must be allocated using ``AUnit.Memory.Utils.Gen_Alloc``, ``AUnit.Test_Caller.Create``, ``AUnit.Test_Suites.New_Suite``, or else they must be statically allocated.) .. index:: AUnit.Run.Test_Runner .. index:: AUnit.Run.Test_Runner_With_Status * At any level at which you wish to run tests, create a harness by instantiating procedure ``AUnit.Run.Test_Runner`` or function ``AUnit.Run.Test_Runner_With_Status`` with the top-level suite function to be executed. This instantiation provides a routine that executes all of the tests in the suite. We will call this user-instantiated routine `Run` in the text for backward compatibility with tests developed for AUnit |nbsp| 1. Note that only one instance of `Run` can execute at a time. This is a tradeoff made to reduce the stack requirement of the framework by allocating test result reporting data structures statically. .. index:: see: Test_Runner; AUnit.Run.Test_Runner .. index:: ZFP profile It is possible to pass a filter to a `Test_Runner`, so that only a subset of the tests run. In particular, this filter could be initialized from a command line parameter. See the package ``AUnit.Test_Filters`` for an example of such a filter. AUnit does not automatically initialize this filter from the command line both because it would not be supported with some of the limited run-time profiles (ZFP for instance), and because you might want to pass the argument in different ways (as a parameter to switch, or a stand-alone command line argument for instance). .. index:: AUnit.Options package It is also possible to control the contents of the output report by passing an object of type ``AUnit_Options`` to the `Test_Runner`. See package ``AUnit.Options`` for details. * Build the code that calls the harness `Run` routine using `gnatmake` or `gprbuild`. The GNAT project file :file:`aunit.gpr` contains all necessary switches, and should be imported into your root project file. aunit-21.0.0.fa386849/doc/aunit_cb/test_organization.rst0000644000175000017500000003533513646146735022525 0ustar nicolasnicolas.. index:: Test organization .. _Test_Organization: ***************** Test Organization ***************** .. _General_considerations: General considerations ====================== This section will discuss an approach to organizing an AUnit test harness, considering some possibilities offered by Ada language features. The general idea behind this approach to test organization is that making the test case a child of the unit under test gives some useful facilities. The test case gains visibility to the private part of the unit under test. This offers a more 'white box' approach to examining the state of the unit under test than would, for instance, accessor functions defined in a separate fixture that is a child of the unit under test. Making the test case a child of the unit under test also provides a way to make the test case share certain characteristics of the unit under test. For instance, if the unit under test is generic, then any child package (here the test case) must be also generic: any instantiation of the parent package will require an instantiation of the test case in order to accomplish its aims. Another useful concept is matching the test case type to that of the unit under test, for example: * When testing a generic package, the test package should also be generic. * When testing a tagged type, then test routines should be dispatching, and the test case type for a derived tagged type should be a derivation of the test case type for the parent. Maintaining such similarity of properties between the test case and unit under test can facilitate the testing of units derived in various ways. The following sections will concentrate on applying these concepts to the testing of tagged type hierarchies and to the testing of generic units. A full example of this kind of test organization is available in the AUnit installation directory: :samp:`{}/share/examples/aunit/calculator`, or from the AUnit source distribution :samp:`aunit-{}-src/examples/calculator`. .. index:: OOP considerations (in test organization) .. _OOP_considerations: OOP considerations ================== When testing a hierarchy of tagged types, one will often want to run tests for parent types against their derivations without rewriting those tests. We will illustrate some of the possible solutions available in AUnit, using the following simple example that we want to test: First we consider a ``Root`` package defining the ``Parent`` tagged type, with two procedures ``P1`` and ``P2``. .. code-block:: ada package Root is type Parent is tagged private; procedure P1 (P : in out Parent); procedure P2 (P : in out Parent); private type Parent is tagged record Some_Value : Some_Type; end record; end Root; We will also consider a derivation from type ``Parent``: .. code-block:: ada with Root; package Branch is type Child is new Root.Parent with private; procedure P2 (C : in out Child); procedure P3 (C : in out Child); private type Child is new Root.Parent with null record; end Branch; Note that ``Child`` retains the parent implementation of ``P1``, overrides ``P2`` and adds ``P3``. Its test will override ``Test_P2`` when we override ``P2`` (not necessary, but certainly possible). .. index:: AUnit.Test_Fixtures.Test_Fixture type Using AUnit.Test_Fixtures ------------------------- Using type ``Test_Fixture``, we first test ``Parent`` using the following test case: .. code-block:: ada with AUnit; use AUnit; with AUnit.Test_Fixtures; use AUnit.Test_Fixtures; -- We make this package a child package of Parent so that it can have -- visibility to its private part package Root.Tests is type Parent_Access is access all Root.Parent'Class; -- Reference an object of type Parent'Class in the test object, so -- that test procedures can have access to it. type Parent_Test is new Test_Fixture with record Fixture : Parent_Access; end record; -- This will initialize P. procedure Set_Up (P : in out Parent_Test); -- Test routines. If derived types are declared in child packages, -- these can be in the private part. procedure Test_P1 (P : in out Parent_Test); procedure Test_P2 (P : in out Parent_Test); end Root.Tests; .. code-block:: ada package body Root.Tests is Fixture : aliased Parent; -- We set Fixture in Parent_Test to an object of type Parent. procedure Set_Up (P : in out Parent_Test) is begin P.Fixture := Parent_Access (Fixture'Access); end Set_Up; -- Test routines: References to the Parent object are made via -- P.Fixture.all, and are thus dispatching. procedure Test_P1 (P : in out Parent_Test) is ...; procedure Test_P2 (P : in out Parent_Test) is ...; end Root.Tests; The associated test suite will be: .. code-block:: ada with AUnit.Test_Caller; with Root.Tests; package body Root_Suite is package Caller is new AUnit.Test_Caller with (Root.Tests.Parent_Test); function Suite return AUnit.Test_Suites.Access_Test_Suite is Ret : Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin AUnit.Test_Suites.Add_Test (Ret, Caller.Create ("Test Parent : P1", Root.Tests.Test_P1'Access)); AUnit.Test_Suites.Add_Test (Ret, Caller.Create ("Test Parent : P2", Root.Tests.Test_P2'Access)); return Ret; end Suite; end Root_Suite; Now we define the test suite for the ``Child`` type. To do this, we inherit a test fixture from ``Parent_Test``, overriding the ``Set_Up`` procedure to initialize ``Fixture`` with a ``Child`` object. We also override ``Test_P2`` to adapt it to the new implementation. We define a new ``Test_P3`` to test ``P3``. And we inherit ``Test_P1``, since ``P1`` is unchanged. .. code-block:: ada with Root.Tests; use Root.Tests; with AUnit; use AUnit; with AUnit.Test_Fixtures; use AUnit.Test_Fixtures; package Branch.Tests is type Child_Test is new Parent_Test with null record; procedure Set_Up (C : in out Child_Test); -- Test routines: -- Test_P2 is overridden procedure Test_P2 (C : in out Child_Test); -- Test_P3 is new procedure Test_P3 (C : in out Child_Test); end Branch.Tests; .. code-block:: ada package body Branch.Tests is use Assertions; Fixture : Child; -- This could also be a field of Child_Test procedure Set_Up (C : in out Child_Test) is begin -- The Fixture for this test will now be a Child C.Fixture := Parent_Access (Fixture'Access); end Set_Up; -- Test routines: procedure Test_P2 (C : in out Child_Test) is ...; procedure Test_P3 (C : in out Child_Test) is ...; end Branch.Tests; The suite for Branch.Tests will now be: .. code-block:: ada with AUnit.Test_Caller; with Branch.Tests; package body Branch_Suite is package Caller is new AUnit.Test_Caller with (Branch.Tests.Parent_Test); -- In this suite, we use Ada 2005 distinguished receiver notation to -- simplify the code. function Suite return Access_Test_Suite is Ret : Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin -- We use the inherited Test_P1. Note that it is -- Branch.Tests.Set_Up that will be called, and so Test_P1 will be run -- against an object of type Child Ret.Add_Test (Caller.Create ("Test Child : P1", Branch.Tests.Test_P1'Access)); -- We use the overridden Test_P2 Ret.Add_Test (Caller.Create ("Test Child : P2", Branch.Tests.Test_P2'Access)); -- We use the new Test_P2 Ret.Add_Test (Caller.Create ("Test Child : P3", Branch.Tests.Test_P3'Access)); return Ret; end Suite; end Branch_Suite; Using AUnit.Test_Cases ---------------------- .. index:: AUnit.Test_Cases.Test_Case type Using an ``AUnit.Test_Cases.Test_Case`` derived type, we obtain the following code for testing ``Parent``: .. code-block:: ada with AUnit; use AUnit; with AUnit.Test_Cases; package Root.Tests is type Parent_Access is access all Root.Parent'Class; type Parent_Test is new AUnit.Test_Cases.Test_Case with record Fixture : Parent_Access; end record; function Name (P : Parent_Test) return Message_String; procedure Register_Tests (P : in out Parent_Test); procedure Set_Up_Case (P : in out Parent_Test); -- Test routines. If derived types are declared in child packages, -- these can be in the private part. procedure Test_P1 (P : in out Parent_Test); procedure Test_P2 (P : in out Parent_Test); end Root.Tests; .. index:: AUnit.Test_Cases.Specific_Test_Case_Registration generic package The body of the test case will follow the usual pattern, declaring one or more objects of type ``Parent``, and executing statements in the test routines against them. However, in order to support dispatching to overriding routines of derived test cases, we need to introduce class-wide wrapper routines for each primitive test routine of the parent type that we anticipate may be overridden. Instead of registering the parent's overridable primitive operations directly using ``Register_Routine``, we register the wrapper using ``Register_Wrapper``. This latter routine is exported by instantiating ``AUnit.Test_Cases.Specific_Test_Case_Registration`` with the actual parameter being the parent test case type. .. code-block:: ada with AUnit.Assertions; use AUnit.Assertions package body Root.Tests is -- Declare class-wide wrapper routines for any test routines that will be -- overridden: procedure Test_P1_Wrapper (P : in out Parent_Test'Class); procedure Test_P2_Wrapper (P : in out Parent_Test'Class); function Name (P : Parent_Test) return Message_String is ...; -- Set the fixture in P Fixture : aliased Parent; procedure Set_Up_Case (P : in out Parent_Test) is begin P.Fixture := Parent_Access (Fixture'Access); end Set_Up_Case; -- Register Wrappers: procedure Register_Tests (P : in out Parent_Test) is package Register_Specific is new Test_Cases.Specific_Test_Case_Registration (Parent_Test); use Register_Specific; begin Register_Wrapper (P, Test_P1_Wrapper'Access, "Test P1"); Register_Wrapper (P, Test_P2_Wrapper'Access, "Test P2"); end Register_Tests; -- Test routines: procedure Test_P1 (P : in out Parent_Test) is ...; procedure Test_P2 (C : in out Parent_Test) is ...; -- Wrapper routines. These dispatch to the corresponding primitive -- test routines of the specific types. procedure Test_P1_Wrapper (P : in out Parent_Test'Class) is begin Test_P1 (P); end Test_P1_Wrapper; procedure Test_P2_Wrapper (P : in out Parent_Test'Class) is begin Test_P2 (P); end Test_P2_Wrapper; end Root.Tests; The code for testing the `Child` type will now be: .. code-block:: ada with Parent_Tests; use Parent_Tests; with AUnit; use AUnit; package Branch.Tests is type Child_Test is new Parent_Test with private; function Name (C : Child_Test) return Message_String; procedure Register_Tests (C : in out Child_Test); -- Override Set_Up_Case so that the fixture changes. procedure Set_Up_Case (C : in out Child_Test); -- Test routines: procedure Test_P2 (C : in out Child_Test); procedure Test_P3 (C : in out Child_Test); private type Child_Test is new Parent_Test with null record; end Branch.Tests; .. code-block:: ada with AUnit.Assertions; use AUnit.Assertions; package body Branch.Tests is -- Declare wrapper for Test_P3: procedure Test_P3_Wrapper (C : in out Child_Test'Class); function Name (C : Child_Test) return Test_String is ...; procedure Register_Tests (C : in out Child_Test) is package Register_Specific is new Test_Cases.Specific_Test_Case_Registration (Child_Test); use Register_Specific; begin -- Register parent tests for P1 and P2: Parent_Tests.Register_Tests (Parent_Test (C)); -- Repeat for each new test routine (Test_P3 in this case): Register_Wrapper (C, Test_P3_Wrapper'Access, "Test P3"); end Register_Tests; -- Set the fixture in P Fixture : aliased Child; procedure Set_Up_Case (C : in out Child_Test) is begin C.Fixture := Parent_Access (Fixture'Access); end Set_Up_Case; -- Test routines: procedure Test_P2 (C : in out Child_Test) is ...; procedure Test_P3 (C : in out Child_Test) is ...; -- Wrapper for new routine: procedure Test_P3_Wrapper (C : in out Child_Test'Class) is begin Test_P3 (C); end Test_P3_Wrapper; end Branch.Tests; Note that inherited and overridden tests do not need to be explicitly re-registered in derived test cases - one just calls the parent version of ``Register_Tests``. If the application tagged type hierarchy is organized into parent and child units, one could also organize the test cases into a hierarchy that reflects that of the units under test. .. index:: Generic units (testing) .. _Testing_generic_units: Testing generic units ===================== When testing generic units, one would like to apply the same generic tests to all instantiations in an application. A simple approach is to make the test case a child package of the unit under test (which then must also be generic). For instance, suppose the generic unit under test is a package (it could be a subprogram, and the same principle would apply): .. code-block:: ada generic -- Formal parameter list package Template is -- Declarations end Template; The corresponding test case would be: .. code-block:: ada with AUnit; use AUnit; with AUnit.Test_Fixtures; generic package Template.Gen_Tests is type Template_Test is new AUnit.Test_Fixtures.Test_Fixture with ...; -- Declare test routines end Template.Gen_Tests; The body will follow the usual patterns with the fixture based on the parent package ``Template``. Note that due to an Ada AI, accesses to test routines, along with the test routine specifications, must be defined in the package specification rather than in its body. Instances of ``Template`` will automatically define the ``Tests`` child package that can be directly instantiated as follows: .. code-block:: ada with Template.Gen_Test; with Instance_Of_Template; package Instance_Of_Template.Tests is new Instance_Of_Template.Gen_Test; The instantiated test case objects are added to a suite in the usual manner. aunit-21.0.0.fa386849/doc/aunit_cb/gps_support.rst0000644000175000017500000000056513530730011021316 0ustar nicolasnicolas*********** GPS Support *********** .. index:: GPS support The GPS IDE relies on the `gnattest` tool that creates unit-test skeletons as well as a test driver infrastructure (harness). A harness can be generated for a project hierarchy, a single project or a package. The generation process can be launched from the `Tools` -> `GNATtest` menu or from a contextual menu. aunit-21.0.0.fa386849/doc/aunit_cb/using_aunit_with_restricted_run-time_libraries.rst0000644000175000017500000000750013530730011030411 0ustar nicolasnicolas.. |nbsp| unicode:: 0xA0 :trim: .. |AUnit 3| replace:: AUnit |nbsp| 3 .. |AUnit 2| replace:: AUnit |nbsp| 2 .. _Using_AUnit_with_Restricted_Run-Time_Libraries: ********************************************** Using AUnit with Restricted Run-Time Libraries ********************************************** .. index:: Restricted run-time libraries (usage with AUnit) .. index:: ZFP profile, cert profile .. index:: VxWorks 653 (and restricted run-time profiles) |AUnit 3| - like |AUnit 2| - is designed so that it can be used in environments with restricted Ada run-time libraries, such as ZFP and the cert run-time profile on Wind River's VxWorks 653. The patterns given in this document for writing tests, suites and harnesses are not the only patterns that can be used with AUnit, but they are compatible with the restricted run-time libraries provided with GNAT Pro. .. index:: Dynamic allocation (in test code) In general, dynamic allocation and deallocation must be used carefully in test code. For the cert profile on VxWorks 653, all dynamic allocation must be done prior to setting the application partition into 'normal' mode. Deallocation is prohibited in this profile. For some restricted profiles, dynamic memory management is not provided as part of the run-time, and should not be used unless you have provided implementations as described in the GNAT User's Guide Supplement for GNAT Pro Safety-Critical and GNAT Pro High-Security. Starting with |AUnit 3|, a simple memory management mechanism has been included in the framework, using a kind of storage pool. This memory management mechanism uses a static array allocated at startup, and simulates dynamic allocation afterwards by allocating parts of this array upon request. Deallocation is not permitted. By default, an array of 100KB is allocated. The size can be changed by modifying the value in the file :samp:`aunit-{}-src/aunit/framework/staticmemory/aunit-memory.adb` before building AUnit. .. index:: AUnit.Memory.Utils.Gen_Alloc To allocate a new object, you use ``AUnit.Memory.Utils.Gen_Alloc``. Additional restrictions relevant to the default ZFP profile include: .. index:: __gnat_last_chance_handler (for ZFP) .. index:: pragma Weak_External * Normally the ZFP profile requires a user-defined ``__gnat_last_chance_handler`` routine to handle raised exceptions. However, AUnit now provides a mechanism to simulate exception propagation using gcc builtin :index:`setjmp/longjmp` mechanism. This mechanism defines the ``__gnat_last_chance_handler`` routine, so it should not be redefined elsewhere. In order to be compatible with this restriction, the user-defined last chance handler routine can be defined as a "weak" symbol; this way, it will still be linked into the standalone executable, but will be replaced by the AUnit implementation when linked with the harness. The pragma ``Weak_External`` can be used for that; e.g.: .. code-block:: ada pragma Weak_External (Last_Chance_Handler); .. index:: GNAT.IO .. index:: cert profile * AUnit requires ``GNAT.IO`` provided in :samp:`g-io.ad{?}` in the full or cert profile run-time library sources (or as implemented by the user). Since this is a run-time library unit it must be compiled with the gnatmake :option:`-a` switch. .. index:: Secondary stack, memcpy, memset * The AUnit framework has been modified so that no call to the secondary stack is performed, nor any call to ``memcpy`` or ``memset``. However, if the unit under test, or the tests themselves require use of those routines, then the application or test framework must define those symbols and provide the requisite implementations. .. index:: ZFP profile .. index:: Ada.Calendar * The timed parameter of the Harness ``Run`` routine has no effect when used with the ZFP profile, and on profiles not supporting ``Ada.Calendar``. aunit-21.0.0.fa386849/doc/aunit_cb/test_case.rst0000644000175000017500000002020113530730011020670 0ustar nicolasnicolas.. _Test_Case: ********* Test Case ********* In this chapter, we will introduce how to use the various forms of Test Cases. We will illustrate with a very simple test routine, which verifies that the sum of two Money values with the same currency unit is a value that is the sum of the two values: .. code-block:: ada declare X, Y: Some_Currency; begin X := 12; Y := 14; Assert (X + Y = 26, "Addition is incorrect"); end; The following sections will show how to use this test method using the different test case types available in AUnit. .. index:: AUnit.Simple_Test_Cases.Test_Case type .. _AUnit-Simple_Test_Cases: AUnit.Simple_Test_Cases ======================= ``AUnit.Simple_Test_Cases.Test_Case`` is the root type of all test cases. Although generally not meant to be used directly, it provides a simple and quick way to run a test. This tagged type has several methods that need to be defined, or may be overridden. .. index:: Name abstract function * ``function Name (T : Test_Case) return Message_String is abstract``: This function returns the Test name. You can easily translate regular strings to ``Message_String`` using ``AUnit.Format``. For example: .. code-block:: ada function Name (T : Money_Test) return Message_String is begin return Format ("Money Tests"); end Name; .. index:: Run_Test abstract function * ``procedure Run_Test (T : in out Test_Case) is abstract``: This procedure contains the test code. For example: .. code-block:: ada procedure Run_Test (T : in out Money_Test) is X, Y: Some_Currency; begin X := 12; Y := 14; Assert (X + Y = 26, "Addition is incorrect"); end Run_Test; .. index:: Set_Up procedure, Tear_Down procedure * ``procedure Set_Up (T : in out Test_Case);`` and ``procedure Tear_Down (T : in out Test_Case);`` (default implementations do nothing): These procedures are meant to respectively set up or tear down the environment before running the test case. See :ref:`Fixture` for examples of how to use these methods. You can find a compilable example of ``AUnit.Simple_Test_Cases.Test_Case`` usage in your AUnit installation directory: :samp:`{}/share/examples/aunit/simple_test/` or from the source distribution :samp:`aunit-{}-src/examples/simple_test/`. .. _AUnit-Test_Cases: AUnit.Test_Cases ================ ``AUnit.Test_Cases.Test_Case`` is derived from ``AUnit.Simple_Test_Cases.Test_Case`` and defines its ``Run_Test`` procedure. It allows a very flexible composition of Test routines inside a single test case, each being reported independently. The following subprograms must be considered for inheritance, overriding or completion: .. index:: Name abstract function (for AUnit.Test_Cases.Test_Case) * ``function Name (T : Test_Case) return Message_String is abstract;`` Inherited. See :ref:`AUnit.Simple_Test_Cases`. .. index:: Set_Up procedure (for AUnit.Test_Cases.Test_Case) .. index:: Tear_Down procedure (for AUnit.Test_Cases.Test_Case) * | ``procedure Set_Up (T : in out Test_Case);`` | ``procedure Tear_Down (T : in out Test_Case);`` Inherited. See :ref:`AUnit.Simple_Test_Cases`. .. index:: Set_Up_Case procedure (for AUnit.Test_Cases.Test_Case) .. index:: Tear_Down_Case procedure (for AUnit.Test_Cases.Test_Case) * | ``procedure Set_Up_Case (T : in out Test_Case);`` | ``procedure Tear_Down_Case (T : in out Test_Case);`` Default implementation does nothing. These last two procedures provide an opportunity to set up and tear down the test case before and after all test routines have been executed. In contrast, the inherited ``Set_Up`` and ``Tear_Down`` are called before and after the execution of each individual test routine. .. index:: Register abstract procedure (for AUnit.Test_Cases.Test_Case) * ``procedure Register_Tests (T : in out Test_Case) is abstract;`` .. index:: Registration.Register_Routine .. index:: Specific_Test_Case.Register_Wrapper This procedure must be overridden. It is responsible for registering all the test routines that will be run. You need to use either ``Registration.Register_Routine`` or the generic ``Specific_Test_Case.Register_Wrapper`` subprograms defined in ``AUnit.Test_Cases`` to register a routine. A test routine has the form: .. code-block:: ada procedure Test_Routine (T : in out Test_Case'Class); or .. code-block:: ada procedure Test_Wrapper (T : in out Specific_Test_Case'Class); The former procedure is used mainly for dispatching calls (see :ref:`OOP_considerations`). Using this type to test our money addition, the package spec is: .. code-block:: ada with AUnit; use AUnit; with AUnit.Test_Cases; use AUnit.Test_Cases; package Money_Tests is type Money_Test is new Test_Cases.Test_Case with null record; procedure Register_Tests (T: in out Money_Test); -- Register routines to be run function Name (T: Money_Test) return Message_String; -- Provide name identifying the test case -- Test Routines: procedure Test_Simple_Add (T : in out Test_Cases.Test_Case'Class); end Money_Tests The package body is: .. code-block:: ada with AUnit.Assertions; use AUnit.Assertions; package body Money_Tests is procedure Test_Simple_Add (T : in out Test_Cases.Test_Case'Class) is X, Y : Some_Currency; begin X := 12; Y := 14; Assert (X + Y = 26, "Addition is incorrect"); end Test_Simple_Add; -- Register test routines to call procedure Register_Tests (T: in out Money_Test) is use AUnit.Test_Cases.Registration; begin -- Repeat for each test routine: Register_Routine (T, Test_Simple_Add'Access, "Test Addition"); end Register_Tests; -- Identifier of test case function Name (T: Money_Test) return Test_String is begin return Format ("Money Tests"); end Name; end Money_Tests; .. index:: AUnit.Test_Caller generic package .. _AUnit-Test_Caller: AUnit.Test_Caller ================= .. index:: AUnit.Test_Fixtures.Test_Fixture type ``Test_Caller`` is a generic package that is used with ``AUnit.Test_Fixtures.Test_Fixture``. ``Test_Fixture`` is a very simple type that provides only the ``Set_Up`` and ``Tear_Down`` procedures. This type is meant to contain a set of user-defined test routines, all using the same set up and tear down mechanisms. Once those routines are defined, the ``Test_Caller`` package is used to incorporate them directly into a test suite. With our money example, the ``Test_Fixture`` is: .. code-block:: ada with AUnit.Test_Fixtures; package Money_Tests is type Money_Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Simple_Add (T : in out Money_Test); end Money_Tests; The test suite (see :ref:`Suite`) calling the test cases created from this Test_Fixture is: .. code-block:: ada with AUnit.Test_Suites; package Money_Suite is function Suite return AUnit.Test_Suites.Access_Test_Suite; end Money_Suite; Here is the corresponding body: .. code-block:: ada with AUnit.Test_Caller; with Money_Tests; package body Money_Suite is package Money_Caller is new AUnit.Test_Caller (Money_Tests.Money_Test); function Suite return Aunit.Test_Suites.Access_Test_Suite is Ret : AUnit.Test_Suites.Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin Ret.Add_Test (Money_Caller.Create ("Money Test : Test Addition", Money_Tests.Test_Simple_Add'Access)); return Ret; end Suite; end Money_Suite; Note that ``New_Suite`` and ``Create`` are fully compatible with limited run-time libraries (in particular, those without dynamic allocation support). However, for non-native run-time libraries, you cannot extend ``Test_Fixture`` with a controlled component. You can find a compilable example of ``AUnit.Test_Caller`` usage in the AUnit installation directory: :samp:`{}/share/examples/aunit/test_caller/` or from the source distribution :samp:`aunit-{}-src/examples/test_caller/`. aunit-21.0.0.fa386849/doc/aunit_cb/reporting.rst0000644000175000017500000000666613530730011020752 0ustar nicolasnicolas.. _Reporting: ********* Reporting ********* .. index:: Reporting .. index:: AUnit.Reporter.Text.Text_Reporter type .. index:: AUnit.Reporter.XML.XML_Reporter type .. index:: AUnit.Run.Test_Runner Test results can be reported using several `Reporters`. By default, two reporters are available in AUnit: ``AUnit.Reporter.Text.Text_Reporter`` and ``AUnit.Reporter.XML.XML_Reporter``. The first one is a simple console reporting routine, while the second one outputs the result using an XML format. These are invoked when the ``Run`` routine of an instantiation of ``AUnit.Run.Test_Runner`` is called. .. index:: AUnit.Reporter.Reporter New reporters can be created using children of ``AUnit.Reporter.Reporter``. The Reporter is selected by specifying it when calling ``Run``: .. code-block:: ada with A_Suite; with AUnit.Run; with AUnit.Reporter.Text; procedure My_Tests is procedure Run is new AUnit.Run.Test_Runner (A_Suite.Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Run (Reporter); end My_Tests; .. index:: Test_Result type The final report is output once all tests have been run, so that they can be grouped depending on their status (passed or fail). If you need to output the tests as they are run, you should consider extending the `Test_Result` type and do some output every time a success or failure is registered. Text output =========== Here is an example where the test harness runs 4 tests, one reporting an assertion failure, one reporting an unexpected error (exception): :: -------------------- Total Tests Run: 4 Successful Tests: 2 Test addition Test subtraction Failed Assertions: 1 Test addition (failure expected) Test should fail this assertion, as 5+3 /= 9 at math-test.adb:29 Unexpected Errors: 1 Test addition (error expected) CONSTRAINT_ERROR Time: 2.902E-4 seconds .. index:: Colors (in report output) This reporter can optionally use colors (green to report success, red to report errors). Since not all consoles support it, this is off by default, but you can call ``Set_Use_ANSI_Colors`` to activate support for colors. .. index:: XML output XML output ========== Following is the same harness run using XML output. The XML format used matches the one used by :index:`CppUnit`. .. index:: UTF-8 character encoding Note that text set in the `Assert` subprograms or as test case names should be compatible with utf-8 character encoding, or the XML will not be correctly formatted. :: 4 2 1 1 Test addition Test subtraction Test addition (failure expected) Assertion Test should fail this assertion, as 5+3 /= 9 math-test.adb 29 Test addition (error expected) Error CONSTRAINT_ERROR aunit-21.0.0.fa386849/doc/share/0000755000175000017500000000000013530730011015507 5ustar nicolasnicolasaunit-21.0.0.fa386849/doc/share/adacore_transparent.png0000644000175000017500000001511013530730011022232 0ustar nicolasnicolas‰PNG  IHDRª3“ tEXtSoftwareAdobe ImageReadyqÉe<êIDATxÚì]xÕµ>3[$Y²dÙ–-Ù8Æ6Œ©ǘ’$ „ÄSbƒß ð¤‘Nz!¼pxÄ”4 <Ó›!‡ÀWܰd«n›yçÌü£½ºº³Ú]Éâ} ó}çÓîìÌ[þ{Îν3ŠÒÜÅôϱþ޵ ß+X?Ïú‡»CÆ%*‹ÑwN›E%1Ê8. ÉàI´ˆk*YG²:Ê1‹õÖ®w©%¬qÔK=öÿM¤ŸªX„îÇZƒ‰ÅDkC_®…ndmjáò{Ö³XÛ•cå¬?býÖÐÜ7ÊÁ¬ X?ÂZ pZùØq€v'ëÖÞ¯hxþ4Ö+à 4p¿Ã‡0ÙC&³þ‘õuÖ+Ye“'HE"¬ãXgä4ÔüäÜ.uëg†°ÙMîb}ƒunŽ~N±6²naÝ̺uF«yzÈõç/3•Ï.:4¢›Çzëû¤û³þ‰õˆß·²ÞÇú ëJÖ] ··à¡êXaÍúIÖѬK‡€šŸHÇ |_Ãz¯ÆKå÷²þó}ÚŸ2‘ÿî]—¿²ÞÆúkKŽ2‚`ê5Ö;пÓT ¹þ±V=()¨ÿ2”ê9˜2}6mбv‚÷®GßåC!,62†lÄXÖÃñW‚ê'‘½ÈU?9¿õ‹`\›P¿5!¼€:ÖÁ>¨|^ˆô\Íý¿÷@ç%§³^®[nø]:úyÖëYïkXˆÈêÕq¬°ƒÉ 9Wû2ë¬÷øV5BÿØÙLK¦Èf ëºÞ2êWATy AÕ`Éñ¬—€fÔ…œ“P…²-w“ ŒñX\'ãpèHë—X¿ð©êw†òdîjÖO¿ØaÇgYë§ uýŸÔbfŽ*·kßź~ªÀÎàüà;)¤Áä:v,n*ò?ŠHZ@t>,a$ÇùÃpŸ»Q¯éžûom£–Öª×uû HÒågƒÐ£žD Q—ãÜèɵäçw¿K~¾—BŒP½©¸F&ô(ü6™‹j 5ÉïUÖ‹r€4À¢ô÷ŸÑçû Ô‹ AT»vìCúäÃtø  g„üî¢óô §‘ŸŸ’Ç=$à™f(w,ÿ›ä/UfBê·”ZCI‡Z:<[¬àþº5kÿÄ €TèÆã¬gÆ1×6¸V]0ßøM5üž4Œqté ÏëVTÊ¿ÔM-û L®eðÈú¸J›$ÅùÁ|]¿E3µ¸7ÄM® uJµTäqwRïeEÐSp¡¯âÕ¬G²žÃ: ®ü0Õ¥ÜK“Ï¡“Rè„Ç•ŽjCÛJQÖ§àJÇ*×ïËúKrœ ·ín¥ý÷#>ØpŸG¤ß†eÔE¨ÊmÈÛp§5è³€¨c.}÷¨Ã6v,òu :FÛÀé«À5 Öð!ôY mðL×+ŽBÇŽµø¸2†²Áè¬'ʘõÔKµïOÀ}šä4‹( Z€™&G‘Ÿ×—eÿ ¹ÖpÍ ¬7a å8œª/Ùˆö,Ëä$1)D—€&¨}[Õ¿®nh¾ÿ„Œ×Ï0”±·—:ç@*“ø  d#,¡¸Ö»@Y™‚¶žªñBÝÊ`¿ý†õ䯬e°ÀX,Öúm&É+!}þT‚òi†R(ÆÕvAÔIÚ±‡sœÿ”XsÁõÂd¡¤2Ð'‡€T•ÑyÍy° ­Dâo!XÐe^:;„£ €Ù¼A*ô§†ã—‡€” mÞœˆVÝ¢ÎB%mü&ý¥,W1n'i€ÿêòcÖ¿02ÉîÃÚé±<Çù†ˆïð “Ì2ðßp¯|÷_¾‚Žß["Êë=)¿}ì–ÖŽáÉTIJ,=8h§ÂWž ‘kبrkH¤&Âréò-ÍC„¥ÿ¾8Å$ã ô9Î7É5”ݤ´.ÉT}'Ô -já¯]}ä`»-“SŠ ZY˜^ÙKÀpz[v«’RéÇ‘ U‰ÁjgöR]&2 mEf<‹Pµ9}\·.?LÎÔŒ›LÜ› ¬ÛzÎŽ êCziIƒ°ÖºšI=wÞyºÓ \eQ.®åC9Ü›*†\l™càÑ>R^ý‘Ù†tÐÝH*­ˆ)L^4—ü|3Wu~×Ó„[ †`&Òin ©SÎá& 7pÇ¥š«8ƒéj7̬§Èe êòj?]t!VSV“ÎBÇ–,¦*‰^Ó³3iËšÿ„²’úŒ“ÑûN¶î N6ÛÐòêѶ^”’ùÙ7™°Ûs”7ÒTÝ€ì Ž\è>è¨é‚c 7ÔwÿH^îÐntÜÊËønÚ¯ÙŸÁÍ÷ÑŽ‘Ú:°Ð÷4YJe¬TÚájí2\$¢ë–1>ÜÞò¤]) ¨U9€š¡Ü+€Õ†I?`|ÝÔ 3I·v-H+@ £ {S"ˆÐyù¿ÉÏ1 íØ•o`–H¥¥ å\òõ{¡þö—gêo5ŒÆ0—A€Çò˜o ì|½ ”¹Cj™!ˆzYs1rá6¸þTˆE×Ó"Âo’¿Ø´ƒgÄwº*§¢O¹æk¬¿*:ðÙíjn§é-Éù^­ýzÊ>åÅp ³Yäíö•ezü2<|‹Òkoí  ;)î§£åÑŒŸΜŒ +ûa?]`ìòDBxÿu†1¼3O° §ý³![ [ÿ ÀD’Ô–l*Ò7æÈŽ*Ù˜2¾Àò‚çØºzžá¤{(¥ògÃñ`çö!îFhÈ °Dâ¢&ÂÍ ç™ƒëRhÂ2êý PT)g—!à û`¦žùÂ*Dð’%¸AI·i¶4È'ºtï›(í8dùO¦Š¥º-$Ý%í…É#.FÛ$ ™z>7 œûX¨Õ `G+–o•Vv5â‰ëA9ª•zVã˜L"YrÕd;ã×K¯BÚÏħWÁΆW«ÃD•%âihç…0BÁ˜Es ÊWhl#:¶m*~¬³š,þ7xeR$·Sø{«œçTqƒ»‘MïiYƒË+ñY2o5K!šÞŽz|i´ ®˜_Ô®ûyÒDŠ.úðatèäñü±;ó2Vnb–ÈEŒ–T ]­L(é³O†”Õ¨x’ [Óf™3˜\¾ˆ3µ”ÞA!Ù ¡x7Sø~ä$ÆÕU KÜ%¾|Ά;ipÙm4ÃÖ¸¨¬õŸªpÈùèøÎz2 .3®åäîÀ›©wB\ÍŠUÿ²ÁÒI§L¡ì#7µ PÖ‹¨÷EÖ}Û-Û°ƒR\)oQyå‰õËgÃL•kåGݕ߂q»Ñàf#Zg@k ïóßÈÂ즽#2QO‚‘Ê„dk*1éª(ûx·.³œ€4bÀ¥â¿À Ͻ…²o®kÄlš§ÍÖ aúe#p®ÓIpØ#` ÒÐm¸W#ePåW Pî•(ñ.—Á¯Ü žÝ¦Ô=k¹#QÚ´±þµ¹ž¢%edÙQr}° YŒÁ e[Ý&ÊýÛAjp)øò× Þà pàïÀ…çJҧѶ«pÍU”;ù¾GÁ…|n2õ›´×ŽÄ¼¿Úu$èÌ ,¬ÝâÑÿ#´8pý£µ ¸ì@®½Ç0{\ë5zÇ2À”å¬y,øÛŠ+®GG/'óû*qŸà¹ÎÁàá O«$Ë{/!Ó‘özÄ-»Ã+ßå‘4Í)k£iãªi⸲ªêÈ.eåÁ³l²œ 9Nw¬'AÌ~à¤û‚/VâNí˜ ;á¶ßB;{l%´,‡Þ) [¨ÃÁñ„rŒÆ¤Ø‰¶I»Þ4MÛŽËJ™”Z®Úæ-V˜²-Çéh¢ÔÖU­C±qþâ¢+™ŒqT¢ŽÓà!†Sv»d#ºÚÙ30x7ßá0LÖŽìÒš.öÖ™Hï̓êv§ ó¿O÷4´²eö¸‡‹cø=ÂãéDzžã±Hu`ß;º™&W´SŸ+®?•f÷/£HiÅËÇÍ TÖP$^N[—A+@°Êk,®·Ë5Û9ß³\ÉN9‹Üã2“ÖÎAÃd‚èïÇr3Þ…n°³J™®¼Ÿ ™©KG3Åk&“뀥^…½ˆÓ¶›:6¿Léæm䦻<à–eü•TPdø(ŠÇ'³wqÂËêK‚>’>‰¾« 劜=º‰®l¡4÷rG:F ‰8Õ'c´5£zÇ¢(¯‹f耲.ϼÞ^æZFű{:”úCFÄviJpÄú’g‘Æ‚K;¶Jùä Æ´}`†QÚ›\ÝèáŠmÿ»]€#–É ´Æò(ùÞ‚ë÷€ÚÆ+áÝ/^.@ezÓÕìyŸ ýö ‚”kxTe;}±¶žêz‚”×#üÛùþ4ˆ·¬¹O À&@‘ëSŠfœì±´$â[G9?Pò÷Ûþ¹ÓÈé®âßÊYkpL¢Sõqœ[p|¸w_¤¥X¬¨WæGã»”½Ñ6»DØ›-Ûó^GNRž_ÅÀYÄfµV¸¬ÍçÉ_±š¢v´¤H+,S3Ñ´™­c«wŽw¾ù8ƒôqÜw²›å|¿¼XnˆR^÷ﮇÔ.-¢-´Ão_ mŠz4HΠÝÉö]ìÚ}:!m¶ý~ˆ&H«K“tJMƒžTo·ù=X®có|iRr¢êîó¤á.%°P×5º¥³°"ÕŽ”Ž h"QV³–NRTKáWV{9UIˆK¾ðý\ä-¯GÙ Q×i¹áñHý i¬Ká=®6¬®¥•쉕m»í ¢–s\Š~úÚ7‰zî³ÐOÉiº8<„‹ºÆÈ¼g"(+aÈ•*©Ãð{ØQ×UB[mBvGƒgQ¹KF ?´ÄÂoû8V™‚§#×RöŸ2•¥Å§¾¸²ûP§ãø,Qþ˜zo –޹Vì‘êz  êÀb°êbõ¾ª¹qU®Â’ ¬½Ýï=]&ÆŸ¨÷žíø;e7‰ŒF’^v!}ÖðBL’;ñ=x=Ï‘†:‡Áý^Ʋm° îBä6·biöë”ýKaTîq1Vüäü›”•Æpî³H¥=¬ÔG&ðJ”±}+nΓEŠÇЖ§‘‚œŠº~YiË/Ñw¥D4ˆ®ßòƒ‘<²³¹ê$ï¸$«FÁFï[)û…Òß X‡äûÛ˜ È+1X_E~3 @¯Â@} Ñ­÷Ñæ_(ûôÀÂ"ze$&Dðb‰]8v øøF¬"ý ¼ãl°J+ïX,–Üe¸×™XÈ)ÅÂëXwÿ2¬çlò_¤ö"úðSË"xƒË°¬^ŠþOV¸äº_ã>ãqý©˜\Wb,Ôïrä«ïÀ÷ïÐ5XÀ°1a/§ì‹ˆ¨N*Q>GÓ'V÷ûm7‹0CoRÈ“°âô :q­’Ô×-jn¿ ç.PŽÎïR–!oU¾Lq{Á4 &ÈðÑg0I&ЩÇéà’‘¿™û&e™øf d3¨… ìÏ01~ƒvOÓU*`ÉMKÑŸÀßo`~ í½„²¥,p‚DÏ£ÁË*jºð<èÎÀ…gb²ß…þ˜¥-™g°.c®ÀÓˆ?¤_åå²×BöQœ€ú<œõÊ#‰îú9ʾ4–¢…µ ~Õ?¶±FÙpÖà³ÇcV AŒn[1ˆ“°r#ß¡ì?ÇPm}\Ño1(û„f„²/» îþHeAª K9m²§´Á¼à‘ëqø«¾Ô"Ø?0L[RÝÏqhȪQö±ôàÿ®Ö .eŸË À¸C‹ TÙ­-·@*#ÛO¦žoô äMe Ó ½çáÚveÂô#˜b¼]T»›Æ”$|—žC$?c~šrŒiXŠÙ€?¢¸ßý ä'8ðù¤~ˆ‰æ(ÿ'p[sp}.r*"þ°€Ã`e…Ž|“òªUÖòÃ^¼€#ØÒ7“D&A°÷´^»æo˜°âuæÃ»TÀ »žN‡<.öi€.¢ÜÓÊÈIUO²å ¼{æQÏý¯a)‡MèϹè¿%¤lÝ,¨ŽEÇT¶Ñ>å”áÏù¼l©KjiMüÕV¢üFI×bê‘9ø4õÞ4ýXùp·Û©çëÁõ{n€•þ®Ò_Á«(/W¬a°Ž}‰²ÛöìmŒäø-¸n%&ÖµhO¼Âï©÷3N‹aÝÏGP¹ùâ‡1‘ÎÇ]€ú¶‚£vá~¶æìc²¸e–Tê÷${.hÉtÅ{DBúXý~/¨Gš´—±EèàÓŠ2h'j¡ véŽ@+-Hàloi®íQtDðªôÇ`5ž‡Å6ØÜ·¡sµøÙ W]‰ÙûWÜ7+¼°x;RTáÜ:tèCPïxßF£—#erIdÞ4üÖ‰¶6(4`@·ÜðÇËQ2'I´gê»AY¶§Þ•ðLi[ƒº§Q‡7•:-ŵóQæã0׃;õ‰º|Ù…1NÚ¼NI»IÛ‚§_¦{Š´§+Š[™bW?¿®žê†u乌8$ï!ùhÏx¥xõÇœ]‚ø€úÏQ‡äý*]°œ XfTFÀºŒ²ÿ&¨[þO€ùòKXWóIEND®B`‚aunit-21.0.0.fa386849/doc/share/favicon.ico0000644000175000017500000000157613530730011017641 0ustar nicolasnicolash(   Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡¼“m“Q“QñéâÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿëÞÓ“Q“QØ·¡Ø·¡ëÞÓ“Q“Qг˜ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¼“m“Q“QØ·¡Ø·¡ÿÿÿ¡g2“Q§rAÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿš\$“Q¡g2Ø·¡Ø·¡ÿÿÿг˜“Q“QñéâÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÖ½§“Q“Qг˜Ø·¡Ø·¡ÿÿÿñéâ“Q“Qг˜ÿÿÿµˆ^“Q“Q“Q“Q“Q“QøôðØ·¡Ø·¡ÿÿÿÿÿÿµˆ^“Q¡g2ÿÿÿÝȶ®}P®}P®}P“Q“Qµˆ^ÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÝȶ“Q“QëÞÓÿÿÿÿÿÿÿÿÿÖ½§“Q“QÝȶÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÿÿÿš\$“QÂ|ÿÿÿÿÿÿÿÿÿµˆ^“Qš\$ÿÿÿÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÿÿÿÂ|“Q¡g2ÿÿÿÿÿÿñéâ“Q“QÂ|ÿÿÿÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÿÿÿëÞÓ“Q“QäÓÄÿÿÿг˜“Q“QñéâÿÿÿÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÿÿÿÿÿÿ§rA“Q¼“mÿÿÿ§rA“Q§rAÿÿÿÿÿÿÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÿÿÿÿÿÿÖ½§“Qš\$ëÞÓ“Q“QÖ½§ÿÿÿÿÿÿÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÿÿÿÿÿÿøôð“Q“Q§rA“Qš\$øôðÿÿÿÿÿÿÿÿÿØ·¡Ø·¡ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¼“m“Q“Q“Q¼“mÿÿÿÿÿÿÿÿÿÿÿÿØ·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡Ø·¡le:Ph<ey <ri>fe:lolht/gBk/DAREibaunit-21.0.0.fa386849/doc/share/gnu_free_documentation_license.rst0000644000175000017500000005507013530730011024475 0ustar nicolasnicolas.. _gnu_fdl: ****************************** GNU Free Documentation License ****************************** Version 1.3, 3 November 2008 Copyright 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. **Preamble** The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. **1. APPLICABILITY AND DEFINITIONS** This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The **Document**, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "**you**". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "**Modified Version**" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "**Secondary Section**" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "**Invariant Sections**" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "**Cover Texts**" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "**Transparent**" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called **Opaque**. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "**Title Page**" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The "**publisher**" means any person or entity that distributes copies of the Document to the public. A section "**Entitled XYZ**" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "**Acknowledgements**", "**Dedications**", "**Endorsements**", or "**History**".) To "**Preserve the Title**" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. **2. VERBATIM COPYING** You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. **3. COPYING IN QUANTITY** If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. **4. MODIFICATIONS** You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties---for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. **5. COMBINING DOCUMENTS** You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements". **6. COLLECTIONS OF DOCUMENTS** You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. **7. AGGREGATION WITH INDEPENDENT WORKS** A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. **8. TRANSLATION** Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. **9. TERMINATION** You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. **10. FUTURE REVISIONS OF THIS LICENSE** The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. **11. RELICENSING** "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. "Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. **ADDENDUM: How to use this License for your documents** To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright © YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with ... Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. aunit-21.0.0.fa386849/doc/share/ada_pygments.py0000644000175000017500000001643713530730011020547 0ustar nicolasnicolas"""Alternate Ada and Project Files parsers for Sphinx/Rest""" import re from pygments.lexer import RegexLexer, bygroups from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation def get_lexer_tokens(tag_highlighting=False, project_support=False): """Return the tokens needed for RegexLexer :param tag_highlighting: if True we support tag highlighting. See AdaLexerWithTags documentation :type tag_highlighting: bool :param project_support: if True support additional keywors associated with project files. :type project_support: bool :return: a dictionary following the structure required by RegexLexer :rtype: dict """ if project_support: project_pattern = r'project\s+|' project_pattern2 = r'project|' else: project_pattern = r'' project_pattern2 = r'' result = { 'root': [ # Comments (r'--.*$', Comment), # Character literal (r"'.'", String.Char), # Strings (r'"[^"]*"', String), # Numeric # Based literal (r'[0-9][0-9_]*#[0-9a-f][0-9a-f_]*#(E[\+-]?[0-9][0-9_]*)?', Number.Integer), (r'[0-9][0-9_]*#[0-9a-f][0-9a-f_]*' r'\.[0-9a-f][0-9a-f_]*#(E[\+-]?[0-9][0-9_]*)?', Number.Float), # Decimal literal (r'[0-9][0-9_]*\.[0-9][0-9_](E[\+-]?[0-9][0-9_]*)?', Number.Float), (r'[0-9][0-9_]*(E[\+-]?[0-9][0-9_]*)?', Number.Integer), # Match use and with statements # The first part of the pattern is be sure we don't match # for/use constructs. (r'(\n\s*|;\s*)(with|use)(\s+[\w\.]+)', bygroups(Punctuation, Keyword.Reserved, Name.Namespace)), # Match procedure, package and function declarations (r'end\s+(if|loop|record)', Keyword), (r'(package(?:\s+body)?\s+|' + project_pattern + r'function\s+|end\s+|procedure\s+)([\w\.]+)', bygroups(Keyword, Name.Function)), # Ada 2012 standard attributes, GNAT specific ones and # Spark 2014 ones ('Update and 'Loop_Entry) # (reversed order to avoid having for # example Max before Max_Alignment_For_Allocation). (r'\'(Write|Width|Wide_Width|Wide_Wide_Width|Wide_Wide_Value|' r'Wide_Wide_Image|Wide_Value|Wide_Image|Word_Size|Wchar_T_Size|' r'Version|Value_Size|Value|Valid_Scalars|VADS_Size|Valid|Val|' r'Update|Unrestricted_Access|Universal_Literal_String|' r'Unconstrained_Array|Unchecked_Access|Unbiased_Rounding|' r'Truncation|Type_Class|To_Address|Tick|Terminated|' r'Target_Name|Tag|System_Allocator_Alignment|Succ|Stub_Type|' r'Stream_Size|Storage_Unit|Storage_Size|Storage_Pool|Small|Size|' r'Simple_Storage_Pool|Signed_Zeros|Scaling|Scale|' r'Scalar_Storage_Order|Safe_Last|Safe_Large|Safe_First|' r'Safe_Emax|Rounding|Round|Result|Remainder|Ref|Read|' r'Range_Length|Range|Priority|Pred|' r'Position|Pos|Pool_Address|Passed_By_Reference|Partition_Id|' r'Overlaps_Storage|Output|Old|Object_Size|Null_Parameter|Modulus|' r'Model_Small|Model_Mantissa|Model_Epsilon|Model_Emin|Model|Mod|' r'Min|Mechanism_Code|Maximum_Alignment|' r'Max_Size_In_Storage_Elements|Max_Priority|' r'Max_Interrupt_Priority|Max_Alignment_For_Allocation|' r'Max|Mantissa|Machine_Size|Machine_Rounds|Machine_Rounding|' r'Machine_Radix|Machine_Overflows|Machine_Mantissa|Machine_Emin|' r'Machine_Emax|Machine|Loop_Entry|Length|Length|Leading_Part|' r'Last_Valid|Last_Bit|Last|Large|Invalid_Value|Integer_Value|' r'Input|Image|Img|Identity|Has_Same_Storage|Has_Discriminants|' r'Has_Access_Values|Fraction|Fore|Floor|Fixed_Value|First_Valid|' r'First_Bit|First|External_Tag|Exponent|Epsilon|Enum_Val|' r'Enum_Rep|Enabled|Emax|Elaborated|Elab_Subp_Body|Elab_Spec|' r'Elab_Body|Descriptor_Size|Digits|Denorm|Delta|Definite|' r'Default_Bit_Order|Count|Copy_Sign|Constrained|' r'Compose|Component_Size|Compiler_Version|Code_Address|Class|' r'Ceiling|Caller|Callable|Body_Version|Bit_Order|Bit_Position|' r'Bit|Base|Asm_Output|Asm_Input|Alignment|Aft|Adjacent|' r'Address_Size|Address|Access|Abort_Signal|AST_Entry)', Name.Attribute), # All Ada2012 reserved words (r'(abort|abstract|abs|accept|access|aliased|all|and|array|at|' r'begin|body|case|constant|declare|delay|delta|digits|do|' r'else|elsif|end|entry|exception|exit|for|function|generic|goto|' r'if|interface|in|is|limited|loop|mod|new|not|null|' r'of|or|others|out|overriding|' + project_pattern2 + r'package|pragma|private|procedure|protected|' r'raise|range|record|rem|renames|requeue|return|reverse|' r'select|separate|some|subtype|synchronized|' r'tagged|task|terminate|then|type|until|use|when|while|with|xor' r')([\s;,])', bygroups(Keyword.Reserved, Punctuation)), # Two characters operators (r'=>|\.\.|\*\*|:=|/=|>=|<=|<<|>>|<>', Operator), # One character operators (r'&|\'|\(|\)|\*|\+|-|\.|/|:|<|=|>|\|', Operator), (r',|;', Punctuation), # Spaces (r'\s+', Text), # Builtin values (r'False|True', Keyword.Constant), # Identifiers (r'[\w\.]+', Name)], } # Insert tag highlighting before identifiers if tag_highlighting: result['root'].insert(-1, (r'\[[\w ]*\]', Name.Tag)) return result class AdaLexer(RegexLexer): """Alternate Pygments lexer for Ada source code and project files The default pygments lexer always fails causing disabling of syntax highlighting in Sphinx. This lexer is simpler but safer. In order to use this lexer in your Sphinx project add the following code at the end of your conf.py .. code-block:: python import gnatpython.ada_pygments def setup(app): app.add_lexer('ada', gnatpython.ada_pygments.AdaLexer()) """ name = 'Ada' aliases = ['ada', 'ada83', 'ada95', 'ada2005', 'ada2012'] filenames = ['*.adb', '*.ads', '*.ada'] mimetypes = ['text/x-ada'] flags = re.MULTILINE | re.I # Ignore case tokens = get_lexer_tokens() class TaggedAdaLexer(AdaLexer): """Alternate Pygments lexer for Ada source code with tags A tag is a string of the form:: [MY STRING] Only alphanumerical characters and spaces are considered inside the brackets. """ name = 'TaggedAda' aliases = ['tagged_ada'] tokens = get_lexer_tokens(True) class GNATProjectLexer(RegexLexer): """Pygment lexer for project files This is the same as the AdaLexer but with support of ``project`` keyword. """ name = 'GPR' aliases = ['gpr'] filenames = ['*.gpr'] mimetypes = ['text/x-gpr'] flags = re.MULTILINE | re.I # Ignore case tokens = get_lexer_tokens(project_support=True) aunit-21.0.0.fa386849/doc/share/latex_elements.py0000644000175000017500000000240413530730011021072 0ustar nicolasnicolas# define some latex elements to be used for PDF output PAGE_BLANK = r''' \makeatletter \def\cleartooddpage{%% \cleardoublepage%% } \def\cleardoublepage{%% \clearpage%% \if@twoside%% \ifodd\c@page%% %% nothing to do \else%% \hbox{}%% \thispagestyle{plain}%% \vspace*{\fill}%% \begin{center}%% \textbf{\em This page is intentionally left blank.}%% \end{center}%% \vspace{\fill}%% \newpage%% \if@twocolumn%% \hbox{}%% \newpage%% \fi%% \fi%% \fi%% } \makeatother ''' TOC_DEPTH = r''' \pagenumbering{arabic} \setcounter{tocdepth}{3} ''' TOC_CMD = r''' \makeatletter \def\tableofcontents{%% \pagestyle{plain}%% \chapter*{\contentsname}%% \@mkboth{\MakeUppercase{\contentsname}}%% {\MakeUppercase{\contentsname}}%% \@starttoc{toc}%% } \makeatother ''' TOC = r''' \cleardoublepage \tableofcontents \cleardoublepage\pagestyle{plain} ''' LATEX_HYPHEN = r''' \hyphenpenalty=5000 \tolerance=1000 ''' def doc_settings(full_document_name, version): return '\n'.join([ r'\newcommand*{\GNATFullDocumentName}[0]{' + full_document_name + r'}', r'\newcommand*{\GNATVersion}[0]{' + version + r'}']) aunit-21.0.0.fa386849/doc/share/sphinx.sty0000644000175000017500000004147113530730011017570 0ustar nicolasnicolas% % sphinx.sty % % Adapted from the old python.sty, mostly written by Fred Drake, % by Georg Brandl. % \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesPackage{sphinx}[2010/01/15 LaTeX package (Sphinx markup)] \@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}} \RequirePackage{textcomp} \RequirePackage{fancybox} \RequirePackage{titlesec} \RequirePackage{tabulary} \RequirePackage{amsmath} % for \text \RequirePackage{makeidx} \RequirePackage{framed} \RequirePackage{ifthen} \RequirePackage{color} % For highlighted code. \RequirePackage{fancyvrb} % For table captions. \RequirePackage{threeparttable} % Handle footnotes in tables. \RequirePackage{footnote} \makesavenoteenv{tabulary} % For floating figures in the text. \RequirePackage{wrapfig} % Separate paragraphs by space by default. \RequirePackage{parskip} \RequirePackage{lastpage} % Redefine these colors to your liking in the preamble. \definecolor{TitleColor}{rgb}{0.126,0.263,0.361} \definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486} \definecolor{OuterLinkColor}{rgb}{0.216,0.439,0.388} % Required to preserve indentation settings in minipage constructs % (otherwise parskip is set to 0 by default. minipagerestore is called % each time we enter a minipage environment) \newcommand{\@minipagerestore}{\setlength{\parskip}{\medskipamount}} % Redefine these colors to something not white if you want to have colored % background and border for code examples. \definecolor{VerbatimColor}{rgb}{1,1,1} \definecolor{VerbatimBorderColor}{rgb}{1,1,1} % Uncomment these two lines to ignore the paper size and make the page % size more like a typical published manual. %\renewcommand{\paperheight}{9in} %\renewcommand{\paperwidth}{8.5in} % typical squarish manual %\renewcommand{\paperwidth}{7in} % O'Reilly ``Programmming Python'' % use pdfoutput for pTeX and dvipdfmx \ifx\kanjiskip\undefined\else \ifx\Gin@driver{dvipdfmx.def}\undefined\else \newcount\pdfoutput\pdfoutput=0 \fi \fi % For graphicx, check if we are compiling under latex or pdflatex. \ifx\pdftexversion\undefined \usepackage{graphicx} \else \usepackage[pdftex]{graphicx} \fi % for PDF output, use colors and maximal compression \newif\ifsphinxpdfoutput\sphinxpdfoutputfalse \ifx\pdfoutput\undefined\else\ifcase\pdfoutput \let\py@NormalColor\relax \let\py@TitleColor\relax \else \sphinxpdfoutputtrue \input{pdfcolor} \def\py@NormalColor{\color[rgb]{0.0,0.0,0.0}} \def\py@TitleColor{\color{TitleColor}} \pdfcompresslevel=9 \fi\fi % XeLaTeX can do colors, too \ifx\XeTeXrevision\undefined\else \def\py@NormalColor{\color[rgb]{0.0,0.0,0.0}} \def\py@TitleColor{\color{TitleColor}} \fi % Increase printable page size (copied from fullpage.sty) \topmargin 0pt \advance \topmargin by -\headheight \advance \topmargin by -\headsep % attempt to work a little better for A4 users \textheight \paperheight \advance\textheight by -2in \oddsidemargin 0pt \evensidemargin 0pt %\evensidemargin -.25in % for ``manual size'' documents \marginparwidth 0.5in \textwidth \paperwidth \advance\textwidth by -2in % Style parameters and macros used by most documents here \raggedbottom \sloppy \hbadness = 5000 % don't print trivial gripes \pagestyle{empty} % start this way \renewcommand{\maketitle}{% \begin{titlepage}% \let\footnotesize\small \let\footnoterule\relax \rule{\textwidth}{1pt}% \ifsphinxpdfoutput \begingroup % These \defs are required to deal with multi-line authors; it % changes \\ to ', ' (comma-space), making it pass muster for % generating document info in the PDF file. \def\\{, } \def\and{and } \pdfinfo{ /Author (\@author) /Title (\@title) } \endgroup \fi \begin{flushright}% \sphinxlogo% {\rm\Huge \@title \par}% {\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par} \vfill {\LARGE\py@HeaderFamily \par} \vfill\vfill {\large \@date \par \vfill \py@authoraddress \par }% \end{flushright}%\par \@thanks \end{titlepage}% \cleardoublepage% \setcounter{footnote}{0}% \let\thanks\relax\let\maketitle\relax } % Use this to set the font family for headers and other decor: \newcommand{\py@HeaderFamily}{\sffamily\bfseries} % Redefine the 'normal' header/footer style when using "fancyhdr" package: \@ifundefined{fancyhf}{}{ % Use \pagestyle{normal} as the primary pagestyle for text. \fancypagestyle{normal}{ \fancyhf{} \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage\ of \pageref*{LastPage}}} \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}} \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}} \fancyhead[LE,RO]{{\py@HeaderFamily \@title, \py@release}} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt} % define chaptermark with \@chappos when \@chappos is available for Japanese \ifx\@chappos\undefined\else \def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}} \fi } % Update the plain style so we get the page number & footer line, % but not a chapter or section title. This is to keep the first % page of a chapter and the blank page between chapters `clean.' \fancypagestyle{plain}{ \fancyhf{} \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage\ of \pageref*{LastPage}}} \fancyfoot[LO,RE]{{\py@HeaderFamily \GNATFullDocumentName}} \fancyhead[LE,RO]{{\py@HeaderFamily \@title\ \GNATVersion}} \renewcommand{\headrulewidth}{0.0pt} \renewcommand{\footrulewidth}{0.4pt} } } % Some custom font markup commands. % \newcommand{\strong}[1]{{\textbf{#1}}} \newcommand{\code}[1]{\texttt{#1}} \newcommand{\bfcode}[1]{\code{\bfseries#1}} \newcommand{\email}[1]{\textsf{#1}} % Redefine the Verbatim environment to allow border and background colors. % The original environment is still used for verbatims within tables. \let\OriginalVerbatim=\Verbatim \let\endOriginalVerbatim=\endVerbatim % Play with vspace to be able to keep the indentation. \newlength\distancetoright \def\mycolorbox#1{% \setlength\distancetoright{\linewidth}% \advance\distancetoright -\@totalleftmargin % \fcolorbox{VerbatimBorderColor}{VerbatimColor}{% \begin{minipage}{\distancetoright}% #1 \end{minipage}% }% } \def\FrameCommand{\mycolorbox} \renewcommand{\Verbatim}[1][1]{% % list starts new par, but we don't want it to be set apart vertically \bgroup\parskip=0pt% \smallskip% % The list environement is needed to control perfectly the vertical % space. \list{}{% \setlength\parskip{0pt}% \setlength\itemsep{0ex}% \setlength\topsep{0ex}% \setlength\partopsep{0pt}% \setlength\leftmargin{0pt}% }% \item\MakeFramed {\FrameRestore}% \small% \OriginalVerbatim[#1]% } \renewcommand{\endVerbatim}{% \endOriginalVerbatim% \endMakeFramed% \endlist% % close group to restore \parskip \egroup% } % \moduleauthor{name}{email} \newcommand{\moduleauthor}[2]{} % \sectionauthor{name}{email} \newcommand{\sectionauthor}[2]{} % Augment the sectioning commands used to get our own font family in place, % and reset some internal data items: \titleformat{\section}{\Large\py@HeaderFamily}% {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor} \titleformat{\subsection}{\large\py@HeaderFamily}% {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} \titleformat{\subsubsection}{\py@HeaderFamily}% {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} \titleformat{\paragraph}{\small\py@HeaderFamily}% {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor} % {fulllineitems} is the main environment for object descriptions. % \newcommand{\py@itemnewline}[1]{% \@tempdima\linewidth% \advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}% } \newenvironment{fulllineitems}{ \begin{list}{}{\labelwidth \leftmargin \labelsep 0pt \rightmargin 0pt \topsep -\parskip \partopsep \parskip \itemsep -\parsep \let\makelabel=\py@itemnewline} }{\end{list}} % \optional is used for ``[, arg]``, i.e. desc_optional nodes. \newcommand{\optional}[1]{% {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}} \newlength{\py@argswidth} \newcommand{\py@sigparams}[2]{% \parbox[t]{\py@argswidth}{#1\code{)}#2}} \newcommand{\pysigline}[1]{\item[#1]\nopagebreak} \newcommand{\pysiglinewithargsret}[3]{% \settowidth{\py@argswidth}{#1\code{(}}% \addtolength{\py@argswidth}{-2\py@argswidth}% \addtolength{\py@argswidth}{\linewidth}% \item[#1\code{(}\py@sigparams{#2}{#3}]} % Production lists % \newenvironment{productionlist}{ % \def\optional##1{{\Large[}##1{\Large]}} \def\production##1##2{\\\code{##1}&::=&\code{##2}} \def\productioncont##1{\\& &\code{##1}} \parindent=2em \indent \begin{tabular}{lcl} }{% \end{tabular} } % Notices / Admonitions % \newlength{\py@noticelength} \newcommand{\py@heavybox}{ \setlength{\fboxrule}{1pt} \setlength{\fboxsep}{6pt} \setlength{\py@noticelength}{\linewidth} \addtolength{\py@noticelength}{-2\fboxsep} \addtolength{\py@noticelength}{-2\fboxrule} %\setlength{\shadowsize}{3pt} \noindent\Sbox \minipage{\py@noticelength} } \newcommand{\py@endheavybox}{ \endminipage \endSbox \fbox{\TheSbox} } \newcommand{\py@lightbox}{{% \setlength\parskip{0pt}\par \noindent\rule[0ex]{\linewidth}{0.5pt}% \par\noindent\vspace{-0.5ex}% }} \newcommand{\py@endlightbox}{{% \setlength{\parskip}{0pt}% \par\noindent\rule[0.5ex]{\linewidth}{0.5pt}% \par\vspace{-0.5ex}% }} % Some are quite plain: \newcommand{\py@noticestart@note}{\py@lightbox} \newcommand{\py@noticeend@note}{\py@endlightbox} \newcommand{\py@noticestart@hint}{\py@lightbox} \newcommand{\py@noticeend@hint}{\py@endlightbox} \newcommand{\py@noticestart@important}{\py@lightbox} \newcommand{\py@noticeend@important}{\py@endlightbox} \newcommand{\py@noticestart@tip}{\py@lightbox} \newcommand{\py@noticeend@tip}{\py@endlightbox} % Others gets more visible distinction: \newcommand{\py@noticestart@warning}{\py@heavybox} \newcommand{\py@noticeend@warning}{\py@endheavybox} \newcommand{\py@noticestart@caution}{\py@heavybox} \newcommand{\py@noticeend@caution}{\py@endheavybox} \newcommand{\py@noticestart@attention}{\py@heavybox} \newcommand{\py@noticeend@attention}{\py@endheavybox} \newcommand{\py@noticestart@danger}{\py@heavybox} \newcommand{\py@noticeend@danger}{\py@endheavybox} \newcommand{\py@noticestart@error}{\py@heavybox} \newcommand{\py@noticeend@error}{\py@endheavybox} \newenvironment{notice}[2]{ \def\py@noticetype{#1} \csname py@noticestart@#1\endcsname \strong{#2} }{\csname py@noticeend@\py@noticetype\endcsname} % Allow the release number to be specified independently of the % \date{}. This allows the date to reflect the document's date and % release to specify the release that is documented. % \newcommand{\py@release}{} \newcommand{\version}{} \newcommand{\shortversion}{} \newcommand{\releaseinfo}{} \newcommand{\releasename}{GNAT} \newcommand{\release}[1]{% \renewcommand{\py@release}{\releasename\space\version}% \renewcommand{\version}{#1}} \newcommand{\setshortversion}[1]{% \renewcommand{\shortversion}{#1}} \newcommand{\setreleaseinfo}[1]{% \renewcommand{\releaseinfo}{#1}} % Allow specification of the author's address separately from the % author's name. This can be used to format them differently, which % is a good thing. % \newcommand{\py@authoraddress}{} \newcommand{\authoraddress}[1]{\renewcommand{\py@authoraddress}{#1}} % This sets up the fancy chapter headings that make the documents look % at least a little better than the usual LaTeX output. % \@ifundefined{ChTitleVar}{}{ \ChNameVar{\raggedleft\normalsize\py@HeaderFamily} \ChNumVar{\raggedleft \bfseries\Large\py@HeaderFamily} \ChTitleVar{\raggedleft \textrm{\Huge\py@HeaderFamily}} % This creates chapter heads without the leading \vspace*{}: \def\@makechapterhead#1{% {\parindent \z@ \raggedright \normalfont \ifnum \c@secnumdepth >\m@ne \DOCH \fi \interlinepenalty\@M \DOTI{#1} } } } % Redefine description environment so that it is usable inside fulllineitems. % \renewcommand{\description}{% \list{}{\labelwidth\z@% \itemindent-\leftmargin% \labelsep5pt% \let\makelabel=\descriptionlabel}} % Definition lists; requested by AMK for HOWTO documents. Probably useful % elsewhere as well, so keep in in the general style support. % \newenvironment{definitions}{% \begin{description}% \def\term##1{\item[##1]\mbox{}\\*[0mm]} }{% \end{description}% } % Tell TeX about pathological hyphenation cases: \hyphenation{Base-HTTP-Re-quest-Hand-ler} % The following is stuff copied from docutils' latex writer. % \newcommand{\optionlistlabel}[1]{\bf #1 \hfill} \newenvironment{optionlist}[1] {\begin{list}{} {\setlength{\labelwidth}{#1} \setlength{\rightmargin}{1cm} \setlength{\leftmargin}{\rightmargin} \addtolength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\optionlistlabel}} }{\end{list}} \newlength{\lineblockindentation} \setlength{\lineblockindentation}{2.5em} \newenvironment{lineblock}[1] {\begin{list}{} {\setlength{\partopsep}{\parskip} \addtolength{\partopsep}{\baselineskip} \topsep0pt\itemsep0.15\baselineskip\parsep0pt \leftmargin#1} \raggedright} {\end{list}} % Redefine includgraphics for avoiding images larger than the screen size % If the size is not specified. \let\py@Oldincludegraphics\includegraphics \newbox\image@box% \newdimen\image@width% \renewcommand\includegraphics[2][\@empty]{% \ifx#1\@empty% \setbox\image@box=\hbox{\py@Oldincludegraphics{#2}}% \image@width\wd\image@box% \ifdim \image@width>\linewidth% \setbox\image@box=\hbox{\py@Oldincludegraphics[width=\linewidth]{#2}}% \box\image@box% \else% \py@Oldincludegraphics{#2}% \fi% \else% \py@Oldincludegraphics[#1]{#2}% \fi% } % to make pdf with correct encoded bookmarks in Japanese % this should precede the hyperref package \ifx\kanjiskip\undefined\else \usepackage{atbegshi} \ifx\ucs\undefined \ifnum 42146=\euc"A4A2 \AtBeginShipoutFirst{\special{pdf:tounicode EUC-UCS2}} \else \AtBeginShipoutFirst{\special{pdf:tounicode 90ms-RKSJ-UCS2}} \fi \else \AtBeginShipoutFirst{\special{pdf:tounicode UTF8-UCS2}} \fi \fi % Include hyperref last. \RequirePackage[colorlinks,breaklinks,destlabel, linkcolor=InnerLinkColor,filecolor=OuterLinkColor, menucolor=OuterLinkColor,urlcolor=OuterLinkColor, citecolor=InnerLinkColor]{hyperref} % Fix anchor placement for figures with captions. % (Note: we don't use a package option here; instead, we give an explicit % \capstart for figures that actually have a caption.) \RequirePackage{hypcap} % From docutils.writers.latex2e \providecommand{\DUspan}[2]{% {% group ("span") to limit the scope of styling commands \@for\node@class@name:=#1\do{% \ifcsname docutilsrole\node@class@name\endcsname% \csname docutilsrole\node@class@name\endcsname% \fi% }% {#2}% node content }% close "span" } \providecommand*{\DUprovidelength}[2]{ \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{} } \DUprovidelength{\DUlineblockindent}{2.5em} \ifthenelse{\isundefined{\DUlineblock}}{ \newenvironment{DUlineblock}[1]{% \list{}{\setlength{\partopsep}{\parskip} \addtolength{\partopsep}{\baselineskip} \setlength{\topsep}{0pt} \setlength{\itemsep}{0.15\baselineskip} \setlength{\parsep}{0pt} \setlength{\leftmargin}{#1}} \raggedright } {\endlist} }{} % From footmisc.sty: allows footnotes in titles \let\FN@sf@@footnote\footnote \def\footnote{\ifx\protect\@typeset@protect \expandafter\FN@sf@@footnote \else \expandafter\FN@sf@gobble@opt \fi } \edef\FN@sf@gobble@opt{\noexpand\protect \expandafter\noexpand\csname FN@sf@gobble@opt \endcsname} \expandafter\def\csname FN@sf@gobble@opt \endcsname{% \@ifnextchar[%] \FN@sf@gobble@twobracket \@gobble } \def\FN@sf@gobble@twobracket[#1]#2{} % adjust the margins for footer, % this works with the jsclasses only (Japanese standard document classes) \ifx\@jsc@uplatextrue\undefined\else \hypersetup{setpagesize=false} \setlength\footskip{2\baselineskip} \addtolength{\textheight}{-2\baselineskip} \fi % fix the double index and bibliography on the table of contents % in jsclasses (Japanese standard document classes) \ifx\@jsc@uplatextrue\undefined\else \renewcommand{\theindex}{ \cleardoublepage \phantomsection \py@OldTheindex } \renewcommand{\thebibliography}[1]{ \cleardoublepage \phantomsection \py@OldThebibliography{1} } \fi % do not use \@chappos in Appendix in pTeX \ifx\kanjiskip\undefined\else \renewcommand{\appendix}{\par \setcounter{chapter}{0} \setcounter{section}{0} \gdef\@chapapp{\appendixname} \gdef\@chappos{} \gdef\thechapter{\@Alph\c@chapter} } \fi aunit-21.0.0.fa386849/doc/share/conf.py0000644000175000017500000000512013530730011017004 0ustar nicolasnicolas# -*- coding: utf-8 -*- # # GNAT build configuration file import sys import os import time import re sys.path.append('.') import ada_pygments import latex_elements # Some configuration values for the various documentation handled by # this conf.py DOCS = { 'aunit_cb': { 'title': u'AUnit Cookbook'}} # Then retrieve the source directory root_source_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) texi_fsf = True # Set to False when FSF doc is switched to sphinx by default def get_copyright(): return u'2008-%s, AdaCore' % time.strftime('%Y') def get_version(): # Assumes that version number is defined in file version_information # two directory levels up, as the first line in this file try: with open('../../version_information') as vinfo: line = (vinfo.readline()).strip() return line except: print 'Error opening or reading version_information file' sys.exit(1) # First retrieve the name of the documentation we are building doc_name = os.environ.get('DOC_NAME', None) if doc_name is None: print 'DOC_NAME environment variable should be set' sys.exit(1) if doc_name not in DOCS: print '%s is not a valid documentation name' % doc_name sys.exit(1) # Exclude sources that are not part of the current documentation exclude_patterns = [] for d in os.listdir(root_source_dir): if d not in ('share', doc_name, doc_name + '.rst'): exclude_patterns.append(d) print 'ignoring %s' % d extensions = [] templates_path = ['_templates'] source_suffix = '.rst' master_doc = doc_name # General information about the project. project = DOCS[doc_name]['title'] copyright = get_copyright() version = get_version() release = get_version() pygments_style = 'sphinx' html_theme = 'sphinxdoc' if os.path.isfile('adacore_transparent.png'): html_logo = 'adacore_transparent.png' if os.path.isfile('favicon.ico'): html_favicon = 'favicon.ico' html_static_path = ['_static'] latex_elements = { 'preamble': latex_elements.TOC_DEPTH + latex_elements.PAGE_BLANK + latex_elements.TOC_CMD + latex_elements.LATEX_HYPHEN + latex_elements.doc_settings(DOCS[doc_name]['title'], get_version()), 'tableofcontents': latex_elements.TOC} latex_documents = [ (master_doc, '%s.tex' % doc_name, project, u'AdaCore', 'manual')] texinfo_documents = [ (master_doc, doc_name, project, u'AdaCore', doc_name, doc_name, '')] def setup(app): app.add_lexer('ada', ada_pygments.AdaLexer()) app.add_lexer('gpr', ada_pygments.GNATProjectLexer()) aunit-21.0.0.fa386849/doc/aunit_cb.rst0000644000175000017500000000160013743420530016730 0ustar nicolasnicolasAUnit Cookbook ============== *Ada Unit Testing Framework* | Version |version| | Date: |today| AdaCore Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled :ref:`gnu_fdl`. .. toctree:: :numbered: :maxdepth: 3 aunit_cb/introduction aunit_cb/overview aunit_cb/test_case aunit_cb/fixture aunit_cb/suite aunit_cb/reporting aunit_cb/test_organization aunit_cb/using_aunit_with_restricted_run-time_libraries aunit_cb/installation_and_use aunit_cb/gps_support .. raw:: latex \appendix .. toctree:: :maxdepth: 3 share/gnu_free_documentation_license aunit-21.0.0.fa386849/README0000644000175000017500000000264113740342126014534 0ustar nicolasnicolasAUnit README This is the Ada unit test framework AUnit, derived from the JUnit/CPPUnit frameworks for Java/C++. Read the AUnit Cookbook, available in doc/ in a number of formats, for installation and usage. AUnit is maintained by AdaCore. Please report problems at report@adacore.com NOTE FOR CONTRIBUTORS --------------------- AUnit is intended to be used on bareboard targets that have a very limited runtime library, so many things like containers, finalization, exception propagation and so on cannot be used in the main framework unconditionally. For full list of restrictions see following parts of GNAT User’s Guide Supplement for Cross Platforms: * [4.2.2. Ada Restrictions in the Zero Footprint Profile](http://docs.adacore.com/live/wave/gnat_ugx/html/gnat_ugx/gnat_ugx/the_predefined_profiles.html#ada-restrictions-in-the-zero-footprint-profile) * [4.2.3. Predefined Packages in the Zero Footprint Profile](http://docs.adacore.com/live/wave/gnat_ugx/html/gnat_ugx/gnat_ugx/the_predefined_profiles.html#predefined-packages-in-the-zero-footprint-profile) Other language features and predefined packages may be used in conditional way, by either providing the same API across different scenarios or adding new units for full runtime scenario only. An example of such conditional usage is FileIO variable from lib/gnat/aunit_shared.gpr that selects between include/aunit/framework/fileio and include/aunit/framework/nofileio. aunit-21.0.0.fa386849/template/0000755000175000017500000000000013530730011015453 5ustar nicolasnicolasaunit-21.0.0.fa386849/template/sample.gpr0000644000175000017500000000116113530730011017445 0ustar nicolasnicolaswith "aunit.gpr"; project Sample is for Languages use ("Ada"); for Source_Dirs use ("./"); for Object_Dir use "./"; for Exec_Dir use "./"; for Main use ("harness.adb"); package Builder is for Default_Switches ("ada") use ("-g", "-gnatQ"); for Executable ("harness.adb") use "harness"; end Builder; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Compiler is for Default_Switches ("ada") use ("-gnatf", "-g"); end Compiler; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; end Sample; aunit-21.0.0.fa386849/template/pr_xxxx_xxx.ads0000644000175000017500000000116213530730011020573 0ustar nicolasnicolaswith AUnit; use AUnit; with AUnit.Test_Cases; package PR_XXXX_XXX is type Test_Case is new AUnit.Test_Cases.Test_Case with null record; -- Override: -- Register routines to be run: procedure Register_Tests (T : in out Test_Case); -- Provide name identifying the test case: function Name (T : Test_Case) return Message_String; -- Override if needed. Default empty implementations provided: -- Preparation performed before each routine: procedure Set_Up (T : in out Test_Case); -- Cleanup performed after each routine: procedure Tear_Down (T : in out Test_Case); end PR_XXXX_XXX; aunit-21.0.0.fa386849/template/pr_xxxx_xxx.adb0000644000175000017500000000300413530730011020547 0ustar nicolasnicolaswith AUnit.Assertions; use AUnit.Assertions; -- Template for test case body. package body PR_XXXX_XXX is -- Example test routine. Provide as many as are needed: procedure Test1 (R : in out AUnit.Test_Cases.Test_Case'Class); procedure Set_Up (T : in out Test_Case) is begin -- Do any necessary set ups. If there are none, -- omit from both spec and body, as a default -- version is provided in Test_Cases. null; end Set_Up; procedure Tear_Down (T : in out Test_Case) is begin -- Do any necessary cleanups, so the next test -- has a clean environment. If there is no -- cleanup, omit spec and body, as default is -- provided in Test_Cases. null; end Tear_Down; -- Example test routine. Provide as many as are needed: procedure Test1 (R : in out AUnit.Test_Cases.Test_Case'Class) is begin -- Do something: null; -- Test for expected conditions. Multiple assertions -- and actions are ok: Assert (True, "Indication of what failed"); end Test1; -- Register test routines to call: procedure Register_Tests (T : in out Test_Case) is use Test_Cases, Test_Cases.Registration; begin -- Repeat for each test routine. Register_Routine (T, Test1'Access, "Description of test routine"); end Register_Tests; -- Identifier of test case: function Name (T : Test_Case) return Message_String is begin return Format ("Test case name"); end Name; end PR_XXXX_XXX; aunit-21.0.0.fa386849/template/sample_suite.adb0000644000175000017500000000044713530730011020622 0ustar nicolasnicolaswith PR_XXXX_XXX; package body Sample_Suite is Result : aliased Test_Suite; Test_Case : aliased PR_XXXX_XXX.Test_Case; function Suite return Access_Test_Suite is begin Add_Test (Result'Access, Test_Case'Access); return Result'Access; end Suite; end Sample_Suite; aunit-21.0.0.fa386849/template/harness.adb0000644000175000017500000000042413530730011017566 0ustar nicolasnicolaswith AUnit.Reporter.Text; with AUnit.Run; -- Suite for this level of tests: with Sample_Suite; procedure Harness is procedure Run is new AUnit.Run.Test_Runner (Sample_Suite.Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Run (Reporter); end Harness; aunit-21.0.0.fa386849/template/sample_suite.ads0000644000175000017500000000020613530730011020634 0ustar nicolasnicolaswith AUnit.Test_Suites; use AUnit.Test_Suites; package Sample_Suite is function Suite return Access_Test_Suite; end Sample_Suite; aunit-21.0.0.fa386849/version_information0000644000175000017500000000000413530730011017647 0ustar nicolasnicolas0.0 aunit-21.0.0.fa386849/COPYING30000644000175000017500000010451313530730011014762 0ustar nicolasnicolas GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . aunit-21.0.0.fa386849/internal/0000755000175000017500000000000013530730011015454 5ustar nicolasnicolasaunit-21.0.0.fa386849/internal/README.gpl0000644000175000017500000000042113530730011017112 0ustar nicolasnicolasAUnit README This is the GNAT GPL release of the Ada unit test framework AUnit, derived from the JUnit/CPPUnit frameworks for Java/C++. Read the AUnit Cookbook, available in doc/ in a number of formats, for installation and usage. Maintainer: AdaCore (sales@adacore.com) aunit-21.0.0.fa386849/internal/release.txt0000644000175000017500000000646713530730011017652 0ustar nicolasnicolasThis file contains information about the various steps required for producing a new AUnit release, and testing it: ------------------- / Release process / ------------------ * verify the version number in version_information, README remove the 'w' wavefront indication in version_information * verify the copyright notice in docs/aunit.texi * review the README for content, changelog. Verify the date is correct. * preform a Sanity-checking for linux native, windows native, windows native using zfp runtime, cross ppc-vxworks on both linux and windows. * put a tag in the CVS repository corresponding to the sources used by the release: $cvs tag aunit-2_02 * switch nightly builds to use the branch by modifying the aunit line in 'build-tags' (from scripts/nightly CVS repository), and update this script on nile, e.g: aunit aunit-2_02 * verify that aunit installs correctly on all supported platforms. * redo the sanity-checking AFTER RELEASE * update the version number in version_information, README verify that the 'w' wavefront indication is present after MINOR_VERSION. * switch back the 'build-tags' script to HEAD. ------------------- / Sanity-checking / ------------------ for Native and cross-platforms, non Windows platforms. * verify that AUnit can be compiled and installed correctly (non Windows platform case). $ gunzip -dc aunit--src.tgz | tar -xf - $ cd aunit- $ ./configure --prefix= $ make install For cross compiler, use $ make install TOOL_PREFIX= For compilation with a ZFP run-time, use $ make install RTS=zfp Verify that in aunit- directory the autom4te.cache, config.log, config.status, makefile, release.txt files are *not* present. If the installation directory is not GNAT's directory, you need to set ADA_PROJECT_PATH environment variable to /lib/gnat * verify that AUnit can be compiled and installed correctly (Windows case). Make sure that the GNAT compiler you want to use has been installed using the InstallShield. Make sure that this compiler is *not* in the PATH. Use the install-shield to install AUnit, verify that it is correctly compiled and installed. * review the documentation Verify that the documentation is correctly installed in /share/doc/aunit In particular, make sure that pdf, txt, html, info formats are available, and that the pdf version is properly formatted. If the installation directory is not GPS's directory, you need to set GPS_CUSTOM_PATH to /share/gps/plug-ins Launch gps and verify that the menu Help->AUnit->AUnit User's Guide exists and correctly launches an explorer with aunit.html document. * verify that the aunit examples can be directly loaded by GPS, and can be compiled without error: $ cd /share/examples/aunit $ gps -Psample Then press F4 to compile. * verify that the test suite can be compiled, and can be executed. Verify that the results are clean: errors displayed should tell that they are expected. $ cd /test $ make Note that TOOL_PREFIX and RTS must be used here with the same values as when compiling. The test suite should compile fine with any native compiler with full or zfp run-times and vxworks cross compiler with full or zfp run-time. aunit-21.0.0.fa386849/support/0000755000175000017500000000000013530730011015354 5ustar nicolasnicolasaunit-21.0.0.fa386849/support/aunit.xml0000644000175000017500000000056213530730011017221 0ustar nicolasnicolas share/doc/aunit /Help/AUnit aunit.html AUnit User's Guide AUnit /Help/AUnit/AUnit User's Guide aunit-21.0.0.fa386849/support/exclude.txt0000644000175000017500000000000513530730011017541 0ustar nicolasnicolas.svn aunit-21.0.0.fa386849/lib/0000755000175000017500000000000013530730011014406 5ustar nicolasnicolasaunit-21.0.0.fa386849/lib/gnat/0000755000175000017500000000000013743420530015347 5ustar nicolasnicolasaunit-21.0.0.fa386849/lib/gnat/aunit_shared.gpr0000644000175000017500000000354513743420530020536 0ustar nicolasnicolasproject AUnit_Shared is Target := external ("AUNIT_PLATFORM", "native"); type Runtime_Type is ( "full", -- used for all full capability runtimes "zfp", -- used for typical zfp/sfp/minimal runtimes "zfp-cross", -- used for zfp runtimes on some cross ports "ravenscar", -- used for full ravenscar runtimes "ravenscar-cert", -- used for ravenscar-cert runtimes "cert" -- used for cert runtimes ); Runtime : Runtime_Type := external ("AUNIT_RUNTIME", "full"); Library_Dir := external ("AUNIT_LIBDIR", "../aunit/" & Target & "-" & Runtime); for Source_Dirs use (); type Exception_Type is ("fullexception", "certexception", "zfpexception"); type Calendar_Type is ("calendar", "nocalendar"); type Memory_type is ("nativememory", "nodealloc", "staticmemory"); type FileIO_Type is ("fileio", "nofileio"); Except : Exception_Type := "fullexception"; Calend : Calendar_Type := "calendar"; Memory : Memory_Type := "nativememory"; FileIO : FileIO_Type := "fileio"; case Runtime is when "zfp" => Except := "zfpexception"; Calend := "nocalendar"; Memory := "nodealloc"; FileIO := "nofileio"; when "zfp-cross" => Except := "zfpexception"; Calend := "nocalendar"; Memory := "staticmemory"; FileIO := "nofileio"; when "ravenscar" => Except := "certexception"; Calend := "nocalendar"; FileIO := "nofileio"; when "ravenscar-cert" => Except := "certexception"; Calend := "nocalendar"; Memory := "staticmemory"; FileIO := "nofileio"; when "cert" => Except := "certexception"; Memory := "staticmemory"; FileIO := "nofileio"; when others => end case; end AUnit_Shared; aunit-21.0.0.fa386849/lib/gnat/aunit.gpr0000644000175000017500000000363613743420530017211 0ustar nicolasnicolas with "aunit_shared"; project AUnit is type Compilation_Mode_Type is ("Devel", "Install"); Mode : Compilation_Mode_Type := external ("AUNIT_BUILD_MODE", "Install"); for Source_Dirs use ("../../include/aunit/framework", "../../include/aunit/containers", "../../include/aunit/reporters", "../../include/aunit/framework/" & AUnit_Shared.Except, "../../include/aunit/framework/" & AUnit_Shared.Calend, "../../include/aunit/framework/" & AUnit_Shared.Memory, "../../include/aunit/framework/" & AUnit_Shared.FileIO); for Library_Dir use AUnit_Shared.Library_Dir; Obj_Dir := external ("AUNIT_OBJDIR", "../aunit-obj/" & AUnit_Shared.Target & "-" & AUnit_Shared.Runtime); for Object_Dir use Obj_Dir; for Library_Name use "aunit"; for Library_Kind use "static"; -------------- -- Compiler -- -------------- package Compiler is case Mode is when "Devel" => for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty"); when "Install" => for Default_Switches ("ada") use ("-O2", "-gnatp", "-gnatn", "-gnatwa.X"); end case; for Switches ("aunit.adb") use Compiler'Default_Switches ("ada") & ("-fno-strict-aliasing"); end Compiler; ------------- -- Install -- ------------- package Install is for Artifacts ("share/doc/aunit/pdf") use ("../../doc/pdf/**"); for Artifacts ("share/doc/aunit/txt") use ("../../doc/txt/**"); for Artifacts ("share/doc/aunit/info") use ("../../doc/info/**"); for Artifacts ("share/doc/aunit/html") use ("../../doc/html/**"); for Artifacts ("share/gps/plug-ins") use ("../../support/aunit.xml"); for Artifacts ("share/examples/aunit") use ("../../examples/*"); end Install; end AUnit; aunit-21.0.0.fa386849/examples/0000755000175000017500000000000013530730011015456 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/calculator/0000755000175000017500000000000013530730011017607 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/calculator/Makefile0000644000175000017500000000041013530730011021242 0ustar nicolasnicolasall: gprbuild -p -f -Pharness coverage: gprbuild -p -f -Pharness -XCOVERAGE=yes ./test_calculator cd obj; gcov ../../tested_lib/obj/*.gcda clean: gprclean -Pharness gprclean -Ptested_lib/testlib -rm -rf obj -rm -rf tested_lib/obj -rm -rf tested_lib/lib aunit-21.0.0.fa386849/examples/calculator/tested_lib/0000755000175000017500000000000013530730011021725 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/calculator/tested_lib/src/0000755000175000017500000000000013530730011022514 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operations-subtraction.ads0000644000175000017500000000040513530730011027722 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operands.Ints; with Operations.Binary; with Operations.Ints; package Operations.Subtraction is new Operations.Binary (T => Operands.Ints.Int, T_Ret => Operands.Ints.Int, The_Operation => Operations.Ints."-"); aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operations-addition.ads0000644000175000017500000000040213530730011027155 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operands.Ints; with Operations.Binary; with Operations.Ints; package Operations.Addition is new Operations.Binary (T => Operands.Ints.Int, T_Ret => Operands.Ints.Int, The_Operation => Operations.Ints."+"); aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operations-binary.adb0000644000175000017500000000112513530730011026630 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Operations.Binary is --------- -- Pop -- --------- procedure Pop (Op : in out Binary_Operation) is begin Op.Op2 := T (Stack.Pop); Op.Op1 := T (Stack.Pop); end Pop; ---------- -- Push -- ---------- procedure Push (Op : in out Binary_Operation) is begin Stack.Push (Op.Res); end Push; ------------- -- Execute -- ------------- procedure Execute (Op : in out Binary_Operation) is begin Op.Res := The_Operation (Op.Op1, Op.Op2); end Execute; end Operations.Binary; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operands-ints.ads0000644000175000017500000000055313530730011025776 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Operands.Ints is type Int is new Operand with private; function Image (Opnd : Int) return String; function Value (Opnd : Int) return Integer; procedure Set (Opnd : in out Int; Value : Integer); private type Int is new Operand with record Value : Integer; end record; end Operands.Ints; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operands-ints.adb0000644000175000017500000000062513530730011025755 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Operands.Ints is function Image (Opnd : Int) return String is begin return Integer'Image (Opnd.Value); end Image; function Value (Opnd : Int) return Integer is begin return Opnd.Value; end Value; procedure Set (Opnd : in out Int; Value : Integer) is begin Opnd.Value := Value; end Set; end Operands.Ints; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operations.ads0000644000175000017500000000062713530730011025375 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Operations is type Operation is abstract tagged null record; procedure Pop (Op : in out Operation) is abstract; -- Pops the operands from the stack procedure Push (Op : in out Operation) is abstract; -- Pushes the operands in the stack procedure Execute (Op : in out Operation) is abstract; -- Execute the operation end Operations; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operations-binary.ads0000644000175000017500000000237413530730011026660 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operands; use Operands; with Stack; generic type T is new Operands.Operand with private; type T_Ret is new Operands.Operand with private; with function The_Operation (T1, T2 : T) return T_Ret; package Operations.Binary is type Binary_Operation is new Operation with private; procedure Pop (Op : in out Binary_Operation); pragma Precondition (Stack.Length >= 2 and then Stack.Top in T'Class and then Stack.Next_To_Top in T'Class, "precondition for Operations.Binary.Pop"); pragma Postcondition (Stack.Length = Stack.Length'Old - 2, "postcondition for Operations.Binary.Pop"); -- Pops the operands from the stack procedure Push (Op : in out Binary_Operation); pragma Precondition (Stack.Length < Stack.Max_Stack_Size, "precondition for Operations.Binary.Push"); pragma Postcondition (Stack.Length = Stack.Length'Old + 1, "postcondition for Operations.Binary.Push"); -- Pushes the operands in the stack procedure Execute (Op : in out Binary_Operation); -- Execute the operation private type Binary_Operation is new Operation with record Op1 : T; Op2 : T; Res : T_Ret; end record; end Operations.Binary; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operands.ads0000644000175000017500000000035513530730011025023 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Operands is type Operand is abstract tagged null record; type Operand_Access is access all Operand'Class; function Image (Opnd : Operand) return String is abstract; end Operands; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/stack.adb0000644000175000017500000000300413530730011024266 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Stack is ---------- -- Push -- ---------- procedure Push (Op : Operands.Operand'Class) is begin if The_Stack_Index = Stack_Index'Last then raise Stack_Overflow; end if; The_Stack_Index := The_Stack_Index + 1; The_Stack (The_Stack_Index) := new Operands.Operand'Class'(Op); end Push; --------- -- Pop -- --------- function Pop return Operands.Operand'Class is begin if The_Stack_Index = Empty_Stack then raise Stack_Empty; end if; declare Op : constant Operands.Operand'Class := The_Stack (The_Stack_Index).all; begin Free (The_Stack (The_Stack_Index)); The_Stack_Index := The_Stack_Index - 1; return Op; end; end Pop; ------------ -- Length -- ------------ function Length return Natural is begin return Natural (The_Stack_Index); end Length; -------------- -- Top_Type -- -------------- function Top return Operands.Operand'Class is begin if The_Stack_Index = 0 then raise Stack_Empty; end if; return The_Stack (The_Stack_Index).all; end Top; ---------------------- -- Next_To_Top_Type -- ---------------------- function Next_To_Top return Operands.Operand'Class is begin if The_Stack_Index < 2 then raise Stack_Empty; end if; return The_Stack (The_Stack_Index - 1).all; end Next_To_Top; end Stack; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operations-ints.adb0000644000175000017500000000057213530730011026326 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Operations.Ints is function "+" (Op1, Op2 : Int) return Int is Ret : Int; begin Ret.Set (Op1.Value + Op2.Value); return Ret; end "+"; function "-" (Op1, Op2 : Int) return Int is Ret : Int; begin Ret.Set (Op1.Value - Op2.Value); return Ret; end "-"; end Operations.Ints; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/operations-ints.ads0000644000175000017500000000033313530730011026342 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operands.Ints; use Operands.Ints; package Operations.Ints is function "+" (Op1, Op2 : Int) return Int; function "-" (Op1, Op2 : Int) return Int; end Operations.Ints; aunit-21.0.0.fa386849/examples/calculator/tested_lib/src/stack.ads0000644000175000017500000000234613530730011024317 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Ada.Unchecked_Deallocation; with Operands; use Operands; package Stack is Stack_Overflow : exception; Stack_Empty : exception; Max_Stack_Size : constant Natural := 128; procedure Push (Op : Operands.Operand'Class); -- Push an operand on the stack -- Raises Stack_Overflow if the stack is full function Pop return Operands.Operand'Class; -- Pop an operand from the stack -- Raises Stack_Empty if the stack is empty function Length return Natural; -- Return the number of objects in the stack function Top return Operands.Operand'Class; -- Return the operand on the top of the stack without removing it from the -- stack. function Next_To_Top return Operands.Operand'Class; -- Return he operand on the next to top of the stack without removing it -- from the stack private type Stack_Index is new Natural range 0 .. Max_Stack_Size; Empty_Stack : constant Stack_Index := 0; The_Stack : array (Stack_Index range 1 .. Stack_Index'Last) of Operand_Access; The_Stack_Index : Stack_Index := Empty_Stack; procedure Free is new Ada.Unchecked_Deallocation (Operands.Operand'Class, Operand_Access); end Stack; aunit-21.0.0.fa386849/examples/calculator/tested_lib/testlib.gpr0000644000175000017500000000126513530730011024111 0ustar nicolasnicolasproject TestLib is type Yes_No is ("yes", "no"); Coverage : Yes_No := External ("COVERAGE", "no"); for Source_Dirs use ("src"); for Languages use ("Ada"); for Object_Dir use "obj"; for Library_Dir use "lib"; for Library_Name use "testlib"; for Library_Kind use "static"; package Compiler is for Default_Switches ("ada") use ("-g", "-O0", "-gnat05", "-gnatwae", "-gnaty", "-gnata"); case Coverage is when "yes" => for Default_Switches ("ada") use Compiler'Default_Switches ("ada") & ("-fprofile-arcs", "-ftest-coverage"); when others => end case; end Compiler; end TestLib; aunit-21.0.0.fa386849/examples/calculator/fixture/0000755000175000017500000000000013530730011021275 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/calculator/fixture/operations-binary-gen_test-gen_suite.adb0000644000175000017500000000111513530730011031176 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Operations.Binary.Gen_Test.Gen_Suite is function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (Caller.Create ("Test " & Instance_Name & ".Pop", Test_Pop_Access)); Ret.Add_Test (Caller.Create ("Test " & Instance_Name & ".Push", Test_Push_Access)); Ret.Add_Test (Caller.Create ("Test " & Instance_Name & ".Execute", Test_Execute_Access)); return Ret; end Suite; end Operations.Binary.Gen_Test.Gen_Suite; aunit-21.0.0.fa386849/examples/calculator/fixture/test_calculator.adb0000644000175000017500000000045313530730011025137 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Reporter.Text; with AUnit.Run; with Main_Suite; use Main_Suite; procedure Test_Calculator is procedure Runner is new AUnit.Run.Test_Runner (Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Runner (Reporter); end Test_Calculator; aunit-21.0.0.fa386849/examples/calculator/fixture/operations-binary-gen_test-gen_suite.ads0000644000175000017500000000111213530730011031214 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; with AUnit.Test_Caller; generic Instance_Name : String; package Operations.Binary.Gen_Test.Gen_Suite is function Suite return Access_Test_Suite; private package Caller is new AUnit.Test_Caller (Operations.Binary.Gen_Test.Test); Test_Pop_Access : constant Caller.Test_Method := Test_Pop'Access; Test_Push_Access : constant Caller.Test_Method := Test_Push'Access; Test_Execute_Access : constant Caller.Test_Method := Test_Execute'Access; end Operations.Binary.Gen_Test.Gen_Suite; aunit-21.0.0.fa386849/examples/calculator/fixture/operands-ints-test-suite.adb0000644000175000017500000000116013530730011026635 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Caller; package body Operands.Ints.Test.Suite is package Caller is new AUnit.Test_Caller (Operands.Ints.Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (Caller.Create ("Test Operands.Ints.Image", Test_Image'Access)); Ret.Add_Test (Caller.Create ("Test Operands.Ints.Value", Test_Value'Access)); Ret.Add_Test (Caller.Create ("Test Operands.Ints.Set", Test_Set'Access)); return Ret; end Suite; end Operands.Ints.Test.Suite; aunit-21.0.0.fa386849/examples/calculator/fixture/operands-ints-test-suite.ads0000644000175000017500000000030613530730011026657 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; package Operands.Ints.Test.Suite is function Suite return Access_Test_Suite; end Operands.Ints.Test.Suite; aunit-21.0.0.fa386849/examples/calculator/fixture/operations-subtraction-test-suite.ads0000644000175000017500000000030613530730011030607 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operations.Binary.Gen_Test.Gen_Suite; package Operations.Subtraction.Test.Suite is new Operations.Subtraction.Test.Gen_Suite ("Operations.Subtraction"); aunit-21.0.0.fa386849/examples/calculator/fixture/main_suite.ads0000644000175000017500000000025213530730011024122 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; package Main_Suite is function Suite return Access_Test_Suite; end Main_Suite; aunit-21.0.0.fa386849/examples/calculator/fixture/main_suite.adb0000644000175000017500000000110313530730011024075 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Stack.Test.Suite; with Operations.Addition.Test.Suite; with Operations.Subtraction.Test.Suite; with Operands.Ints.Test.Suite; package body Main_Suite is function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (Stack.Test.Suite.Suite); Ret.Add_Test (Operations.Addition.Test.Suite.Suite); Ret.Add_Test (Operations.Subtraction.Test.Suite.Suite); Ret.Add_Test (Operands.Ints.Test.Suite.Suite); return Ret; end Suite; end Main_Suite; aunit-21.0.0.fa386849/examples/calculator/fixture/operations-addition-test-suite.ads0000644000175000017500000000033413530730011030046 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operations.Binary.Gen_Test.Gen_Suite; with Operations.Addition.Test; package Operations.Addition.Test.Suite is new Operations.Addition.Test.Gen_Suite ("Operations.Addition"); aunit-21.0.0.fa386849/examples/calculator/fixture/stack-test-suite.adb0000644000175000017500000000136013530730011025156 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Caller; package body Stack.Test.Suite is package Caller is new AUnit.Test_Caller (Stack.Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (Caller.Create ("Test Stack.Push", Test_Push'Access)); Ret.Add_Test (Caller.Create ("Test Stack.Pop", Test_Pop'Access)); Ret.Add_Test (Caller.Create ("Test Stack.Length", Test_Length'Access)); Ret.Add_Test (Caller.Create ("Test Stack.Top", Test_Top'Access)); Ret.Add_Test (Caller.Create ("Test Stack.Next_To_Top", Test_Next_To_Top'Access)); return Ret; end Suite; end Stack.Test.Suite; aunit-21.0.0.fa386849/examples/calculator/fixture/stack-test-suite.ads0000644000175000017500000000026613530730011025203 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; package Stack.Test.Suite is function Suite return Access_Test_Suite; end Stack.Test.Suite; aunit-21.0.0.fa386849/examples/calculator/harness.gpr0000644000175000017500000000144513530730011021770 0ustar nicolasnicolaswith "aunit"; with "tested_lib/testlib"; project Harness is for Languages use ("Ada"); for Main use ("test_calculator.adb"); for Source_Dirs use ("fixture", "tests"); for Exec_Dir use "."; for Object_Dir use "obj"; package Linker is for Default_Switches ("ada") use ("-g"); case TestLib.Coverage is when "yes" => for Default_Switches ("ada") use Linker'Default_Switches("ada") & "-fprofile-arcs"; when others => end case; end Linker; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; package Compiler is for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty", "-gnat05"); end Compiler; end Harness; aunit-21.0.0.fa386849/examples/calculator/tests/0000755000175000017500000000000013530730011020751 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/calculator/tests/operations-subtraction-test.ads0000644000175000017500000000041613530730011027136 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operations.Binary.Gen_Test; with Operations.Subtraction; with Operations.Subtraction_Test_Fixture; use Operations.Subtraction_Test_Fixture; package Operations.Subtraction.Test is new Operations.Subtraction.Gen_Test (Set_Up); aunit-21.0.0.fa386849/examples/calculator/tests/operations-addition_test_fixture.ads0000644000175000017500000000053213530730011030223 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operands.Ints; use Operands.Ints; with Operations.Addition; package Operations.Addition_Test_Fixture is procedure Set_Up (Op : out Operations.Addition.Binary_Operation; Test_Op1 : out Int; Test_Op2 : out Int; Exp_Res : out Int); end Operations.Addition_Test_Fixture; aunit-21.0.0.fa386849/examples/calculator/tests/operations-addition-test.ads0000644000175000017500000000037713530730011026402 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operations.Binary.Gen_Test; with Operations.Addition; with Operations.Addition_Test_Fixture; use Operations.Addition_Test_Fixture; package Operations.Addition.Test is new Operations.Addition.Gen_Test (Set_Up); aunit-21.0.0.fa386849/examples/calculator/tests/operands-ints-test.adb0000644000175000017500000000145213530730011025166 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body Operands.Ints.Test is procedure Test_Image (T : in out Test) is pragma Unreferenced (T); I : Int; begin I.Value := 0; Assert (I.Image = " 0", "Wrong image for 0"); I.Value := 9657; Assert (I.Image = " 9657", "Wrong image for 9657"); I.Value := -45879876; Assert (I.Image = "-45879876", "Wrong image for -45879876"); end Test_Image; procedure Test_Value (T : in out Test) is pragma Unreferenced (T); begin Assert (False, "test not implemented"); end Test_Value; procedure Test_Set (T : in out Test) is pragma Unreferenced (T); begin Assert (False, "test not implemented"); end Test_Set; end Operands.Ints.Test; aunit-21.0.0.fa386849/examples/calculator/tests/operations-subtraction_test_fixture.adb0000644000175000017500000000065313530730011030750 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Operations.Subtraction_Test_Fixture is procedure Set_Up (Op : out Operations.Subtraction.Binary_Operation; Test_Op1 : out Int; Test_Op2 : out Int; Exp_Res : out Int) is pragma Unreferenced (Op); begin Test_Op1.Set (4); Test_Op2.Set (6); Exp_Res.Set (-2); end Set_Up; end Operations.Subtraction_Test_Fixture; aunit-21.0.0.fa386849/examples/calculator/tests/stack-test.ads0000644000175000017500000000110713530730011023523 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Fixtures; package Stack.Test is type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Tear_Down (T : in out Test); procedure Test_Push (T : in out Test); -- Test for Stack.Push procedure Test_Pop (T : in out Test); -- Test for Stack.Pop procedure Test_Length (T : in out Test); -- Test for Stack.Length procedure Test_Top (T : in out Test); -- Test for Stack.Top procedure Test_Next_To_Top (T : in out Test); -- Test for Stack.Next_To_Top end Stack.Test; aunit-21.0.0.fa386849/examples/calculator/tests/operations-binary-gen_test.ads0000644000175000017500000000140313530730011026713 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Fixtures; generic with procedure Set_Up (The_Op : out Binary_Operation; Test_Op1 : out T; Test_Op2 : out T; Exp_Res : out T_Ret); package Operations.Binary.Gen_Test is type Test is new AUnit.Test_Fixtures.Test_Fixture with private; procedure Set_Up (T : in out Test); procedure Tear_Down (T : in out Test); procedure Test_Pop (T : in out Test); procedure Test_Push (T : in out Test); procedure Test_Execute (T : in out Test); private type Test is new AUnit.Test_Fixtures.Test_Fixture with record Op : Operations.Binary.Binary_Operation; Test_Op1 : T; Test_Op2 : T; Exp_Res : T_Ret; end record; end Operations.Binary.Gen_Test; aunit-21.0.0.fa386849/examples/calculator/tests/operations-addition_test_fixture.adb0000644000175000017500000000064213530730011030204 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Operations.Addition_Test_Fixture is procedure Set_Up (Op : out Operations.Addition.Binary_Operation; Test_Op1 : out Int; Test_Op2 : out Int; Exp_Res : out Int) is pragma Unreferenced (Op); begin Test_Op1.Set (4); Test_Op2.Set (6); Exp_Res.Set (10); end Set_Up; end Operations.Addition_Test_Fixture; aunit-21.0.0.fa386849/examples/calculator/tests/operations-subtraction_test_fixture.ads0000644000175000017500000000054513530730011030771 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Operands.Ints; use Operands.Ints; with Operations.Subtraction; package Operations.Subtraction_Test_Fixture is procedure Set_Up (Op : out Operations.Subtraction.Binary_Operation; Test_Op1 : out Int; Test_Op2 : out Int; Exp_Res : out Int); end Operations.Subtraction_Test_Fixture; aunit-21.0.0.fa386849/examples/calculator/tests/operations-binary-gen_test.adb0000644000175000017500000000522013530730011026673 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Ada.Exceptions; with System.Assertions; with AUnit.Assertions; use AUnit.Assertions; with Stack; use Stack; package body Operations.Binary.Gen_Test is ------------ -- Set_Up -- ------------ procedure Set_Up (T : in out Test) is begin Set_Up (T.Op, T.Test_Op1, T.Test_Op2, T.Exp_Res); end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (T : in out Test) is pragma Unreferenced (T); begin -- Make sure the stack is empty after each test. while Stack.Length > 0 loop declare Op : constant Operands.Operand'Class := Stack.Pop; pragma Unreferenced (Op); begin null; end; end loop; end Tear_Down; -------------- -- Test_Pop -- -------------- procedure Test_Pop (T : in out Test) is begin begin Pop (T.Op); Assert (False, "stack is empty, it should have raised an exception"); exception when System.Assertions.Assert_Failure => -- Precondition failed. OK null; when E : others => Assert (False, "Wrong exception raised: " & Ada.Exceptions.Exception_Name (E)); end; Stack.Push (T.Test_Op1); Stack.Push (T.Test_Op2); Pop (T.Op); Assert (Stack.Length = 0, "Wrong pop operation"); Assert (T.Op.Op1 = T.Test_Op1, "Wrong first value poped"); Assert (T.Op.Op2 = T.Test_Op2, "Wrong 2nd value poped"); end Test_Pop; --------------- -- Test_Push -- --------------- procedure Test_Push (T : in out Test) is begin T.Op.Res := T.Exp_Res; T.Op.Push; Assert (Stack.Length = 1, "Wrong push on stack"); Assert (Stack.Top = Operands.Operand'Class (T.Exp_Res), "Wrong value pushed"); for J in 2 .. Stack.Max_Stack_Size loop Stack.Push (T.Test_Op1); end loop; begin T.Op.Push; Assert (False, "stack is full, it should have raised an exception"); exception when System.Assertions.Assert_Failure => null; -- Expected when E : others => Assert (False, "Wrong exception raised: " & Ada.Exceptions.Exception_Name (E)); end; end Test_Push; ------------------ -- Test_Execute -- ------------------ procedure Test_Execute (T : in out Test) is begin T.Op.Op1 := T.Test_Op1; T.Op.Op2 := T.Test_Op2; T.Op.Execute; Assert (T.Op.Res = T.Exp_Res, "Incorrect result set after Execute"); end Test_Execute; end Operations.Binary.Gen_Test; aunit-21.0.0.fa386849/examples/calculator/tests/operands-ints-test.ads0000644000175000017500000000050213530730011025202 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Fixtures; package Operands.Ints.Test is type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Image (T : in out Test); procedure Test_Value (T : in out Test); procedure Test_Set (T : in out Test); end Operands.Ints.Test; aunit-21.0.0.fa386849/examples/calculator/tests/stack-test.adb0000644000175000017500000001377613530730011023521 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; with Ada.Exceptions; with Operands.Ints; use Operands.Ints; package body Stack.Test is --------------- -- Tear_Down -- --------------- procedure Tear_Down (T : in out Test) is pragma Unreferenced (T); begin -- Make sure the stack is empty after each test. while Stack.The_Stack_Index > 0 loop Free (Stack.The_Stack (Stack.The_Stack_Index)); The_Stack_Index := The_Stack_Index - 1; end loop; end Tear_Down; --------------- -- Test_Push -- --------------- procedure Test_Push (T : in out Test) is pragma Unreferenced (T); I1, I2 : Int; begin I1.Set (3); I2.Set (-4); -- Test single push Stack.Push (I1); Assert (Stack.The_Stack_Index = 1, "Wrong stack index after push"); Assert (Stack.The_Stack (1).all = Operand'Class (I1), "Wrong value pushed on the stack"); -- Test second push Stack.Push (I2); Assert (Stack.The_Stack_Index = 2, "Wrong stack index after 2nd push"); Assert (Stack.The_Stack (1).all = Operand'Class (I1) and then Stack.The_Stack (2).all = Operand'Class (I2), "Wrong value order after two pushes on the stack"); -- Test overflow begin for J in The_Stack_Index .. The_Stack'Last loop Stack.Push (I2); end loop; Assert (False, "Stack_Overflow should have been raised"); exception when Stack.Stack_Overflow => null; when E : others => Assert (False, "Wrong exception raised : " & Ada.Exceptions.Exception_Name (E)); end; end Test_Push; -------------- -- Test_Pop -- -------------- procedure Test_Pop (T : in out Test) is pragma Unreferenced (T); I1, I2 : Int; I3 : Int; pragma Unreferenced (I3); begin I1.Set (3); I2.Set (-4); The_Stack (1) := new Operand'Class'(Operand'Class (I1)); The_Stack (2) := new Operand'Class'(Operand'Class (I2)); The_Stack_Index := 2; Assert (Stack.Pop = Operand'Class (I2), "Wrong value poped with 2 values on the stack"); Assert (The_Stack_Index = 1, "Wrong stack index after pop"); Assert (Stack.Pop = Operand'Class (I1), "Wrong value poped with 1 value on the stack"); Assert (The_Stack_Index = 0, "Wrong stack index after 2nd pop"); begin I3 := Int (Stack.Pop); Assert (False, "Stack_Empty should have been raised"); exception when Stack.Stack_Empty => -- Expected exception null; when E : others => Assert (False, "Wrong exception raised : " & Ada.Exceptions.Exception_Name (E)); end; end Test_Pop; ----------------- -- Test_Length -- ----------------- procedure Test_Length (T : in out Test) is pragma Unreferenced (T); I1, I2 : Int; I3 : Int; pragma Unreferenced (I3); begin I1.Set (3); I2.Set (-4); Stack.Push (I1); Assert (Stack.Length = 1, "Wrong length after 1 push"); Stack.Push (I2); Assert (Stack.Length = 2, "Wrong length after 2 push"); I3 := Int (Stack.Pop); Assert (Stack.Length = 1, "Wrong length after 2 pushes and 1 pop"); begin for J in 1 .. Stack.The_Stack'Last loop Stack.Push (I2); end loop; exception when Stack_Overflow => Assert (Stack.Length = Natural (Stack.The_Stack'Last), "Stack.Length incorrect after Stack_Overflow exception"); end; begin for J in 0 .. Stack.The_Stack'Last loop I3 := Int (Stack.Pop); end loop; exception when Stack_Empty => Assert (Stack.Length = 0, "Stack.Length incorrect after Stack_Empty exception"); end; end Test_Length; -------------- -- Test_Top -- -------------- procedure Test_Top (T : in out Test) is pragma Unreferenced (T); I1, I2 : Int; I3 : Int; pragma Unreferenced (I3); begin I1.Set (3); I2.Set (-4); Stack.Push (I1); Assert (Stack.Top = Operand'Class (I1), "Wrong value returned by Top after 1 push"); Assert (Stack.Length = 1, "Top modified the length"); Stack.Push (I2); Assert (Stack.Top = Operand'Class (I2), "Wrong value returned by Top after 2 pushes"); Assert (Stack.Length = 2, "Top modified the length"); I3 := Int (Stack.Pop); I3 := Int (Stack.Pop); begin I3 := Int (Stack.Top); Assert (False, "Top should have raised Emtpy_Stack when the stack is empty"); exception when Stack.Stack_Empty => null; when E : others => Assert (False, "Wrong exception raised : " & Ada.Exceptions.Exception_Name (E)); end; end Test_Top; ---------------------- -- Test_Next_To_Top -- ---------------------- procedure Test_Next_To_Top (T : in out Test) is pragma Unreferenced (T); I1, I2 : Int; I3 : Int; pragma Unreferenced (I3); begin I1.Set (3); I2.Set (-4); Stack.Push (I1); Stack.Push (I2); Assert (Stack.Next_To_Top = Operand'Class (I1), "Wrong value returned by Next_To_Top after 2 pushes"); Assert (Stack.Length = 2, "Next_To_Top modified the length"); I3 := Int (Stack.Pop); begin I3 := Int (Stack.Next_To_Top); Assert (False, "Top should have raised Emtpy_Stack when the stack's length is 1"); exception when Stack.Stack_Empty => null; when E : others => Assert (False, "Wrong exception raised : " & Ada.Exceptions.Exception_Name (E)); end; end Test_Next_To_Top; end Stack.Test; aunit-21.0.0.fa386849/examples/test_caller/0000755000175000017500000000000013530730011017757 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_caller/Makefile0000644000175000017500000000014613530730011021420 0ustar nicolasnicolasall: gprbuild -p -Pharness/harness clean: gprclean -Pharness/harness gprclean -Ptested_lib/testlib aunit-21.0.0.fa386849/examples/test_caller/tested_lib/0000755000175000017500000000000013530730011022075 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_caller/tested_lib/src/0000755000175000017500000000000013530730011022664 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_caller/tested_lib/src/math.adb0000644000175000017500000000045413530730011024270 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Math is function "+" (I1, I2 : Int) return Int is begin return Int (Integer (I1) + Integer (I2)); end "+"; function "-" (I1, I2 : Int) return Int is begin return Int (Integer (I1) - Integer (I2)); end "-"; end Math; aunit-21.0.0.fa386849/examples/test_caller/tested_lib/src/math.ads0000644000175000017500000000026613530730011024312 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Math is type Int is new Integer; function "+" (I1, I2 : Int) return Int; function "-" (I1, I2 : Int) return Int; end Math; aunit-21.0.0.fa386849/examples/test_caller/tested_lib/testlib.gpr0000644000175000017500000000062513530730011024260 0ustar nicolasnicolasproject TestLib is for Source_Dirs use ("src"); for Languages use ("Ada"); for Object_Dir use "obj"; for Library_Dir use "lib"; for Library_Name use "testlib"; for Library_Kind use "static"; package Compiler is for Default_Switches ("ada") use ("-g", "-O1", "-gnat05", "-gnatwa.Xe", "-gnaty", "-gnata", "-gnatf"); end Compiler; end TestLib; aunit-21.0.0.fa386849/examples/test_caller/harness/0000755000175000017500000000000013530730011021422 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_caller/harness/src/0000755000175000017500000000000013530730011022211 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_caller/harness/src/math-test.adb0000644000175000017500000000113313530730011024565 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body Math.Test is procedure Test_Addition (T : in out Test) is pragma Unreferenced (T); I1 : constant Int := 5; I2 : constant Int := 3; begin Assert (I1 + I2 = 8, "Incorrect result after addition"); end Test_Addition; procedure Test_Subtraction (T : in out Test) is pragma Unreferenced (T); I1 : constant Int := 5; I2 : constant Int := 3; begin Assert (I1 - I2 = 2, "Incorrect result after subtraction"); end Test_Subtraction; end Math.Test; aunit-21.0.0.fa386849/examples/test_caller/harness/src/math-test.ads0000644000175000017500000000043213530730011024607 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit; with AUnit.Test_Fixtures; package Math.Test is type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Addition (T : in out Test); procedure Test_Subtraction (T : in out Test); end Math.Test; aunit-21.0.0.fa386849/examples/test_caller/harness/src/math_suite.adb0000644000175000017500000000103513530730011025022 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Math.Test; use Math.Test; with AUnit.Test_Caller; package body Math_Suite is package Caller is new AUnit.Test_Caller (Math.Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin Ret.Add_Test (Caller.Create ("Test addition", Test_Addition'Access)); Ret.Add_Test (Caller.Create ("Test subtraction", Test_Subtraction'Access)); return Ret; end Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/test_caller/harness/src/math_suite.ads0000644000175000017500000000025213530730011025043 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; package Math_Suite is function Suite return Access_Test_Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/test_caller/harness/src/test_math.adb0000644000175000017500000000043713530730011024655 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Reporter.Text; with AUnit.Run; with Math_Suite; use Math_Suite; procedure Test_Math is procedure Runner is new AUnit.Run.Test_Runner (Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Runner (Reporter); end Test_Math; aunit-21.0.0.fa386849/examples/test_caller/harness/harness.gpr0000644000175000017500000000111413530730011023574 0ustar nicolasnicolaswith "aunit"; with "../tested_lib/testlib"; project Harness is for Languages use ("Ada"); for Main use ("test_math.adb"); for Source_Dirs use ("src"); for Exec_Dir use ".."; for Object_Dir use "obj"; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; package Compiler is for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty", "-gnat05"); end Compiler; end Harness; aunit-21.0.0.fa386849/examples/test_fixture/0000755000175000017500000000000013530730011020203 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_fixture/Makefile0000644000175000017500000000016313530730011021643 0ustar nicolasnicolasall: gprbuild -p -Pharness clean: -gprclean -Pharness -gprclean -Ptested_lib/testlib rm -rf obj tested_lib/obj aunit-21.0.0.fa386849/examples/test_fixture/tested_lib/0000755000175000017500000000000013530730011022321 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_fixture/tested_lib/src/0000755000175000017500000000000013530730011023110 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_fixture/tested_lib/src/math.adb0000644000175000017500000000045413530730011024514 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Math is function "+" (I1, I2 : Int) return Int is begin return Int (Integer (I1) + Integer (I2)); end "+"; function "-" (I1, I2 : Int) return Int is begin return Int (Integer (I1) - Integer (I2)); end "-"; end Math; aunit-21.0.0.fa386849/examples/test_fixture/tested_lib/src/math.ads0000644000175000017500000000026613530730011024536 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Math is type Int is new Integer; function "+" (I1, I2 : Int) return Int; function "-" (I1, I2 : Int) return Int; end Math; aunit-21.0.0.fa386849/examples/test_fixture/tested_lib/testlib.gpr0000644000175000017500000000062513530730011024504 0ustar nicolasnicolasproject TestLib is for Source_Dirs use ("src"); for Languages use ("Ada"); for Object_Dir use "obj"; for Library_Dir use "lib"; for Library_Name use "testlib"; for Library_Kind use "static"; package Compiler is for Default_Switches ("ada") use ("-g", "-O1", "-gnat05", "-gnatwa.Xe", "-gnaty", "-gnata", "-gnatf"); end Compiler; end TestLib; aunit-21.0.0.fa386849/examples/test_fixture/harness.gpr0000644000175000017500000000111213530730011022353 0ustar nicolasnicolaswith "aunit"; with "tested_lib/testlib"; project Harness is for Languages use ("Ada"); for Main use ("test_math.adb"); for Source_Dirs use ("tests"); for Exec_Dir use "."; for Object_Dir use "obj"; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; package Compiler is for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty", "-gnat05"); end Compiler; end Harness; aunit-21.0.0.fa386849/examples/test_fixture/tests/0000755000175000017500000000000013530730011021345 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/test_fixture/tests/math-test.adb0000644000175000017500000000102113530730011023715 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body Math.Test is procedure Set_Up (T : in out Test) is begin T.I1 := 5; T.I2 := 3; end Set_Up; procedure Test_Addition (T : in out Test) is begin Assert (T.I1 + T.I2 = 8, "Incorrect result after addition"); end Test_Addition; procedure Test_Subtraction (T : in out Test) is begin Assert (T.I1 - T.I2 = 2, "Incorrect result after subtraction"); end Test_Subtraction; end Math.Test; aunit-21.0.0.fa386849/examples/test_fixture/tests/math-test.ads0000644000175000017500000000055313530730011023747 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit; with AUnit.Test_Fixtures; package Math.Test is type Test is new AUnit.Test_Fixtures.Test_Fixture with record I1 : Int; I2 : Int; end record; procedure Set_Up (T : in out Test); procedure Test_Addition (T : in out Test); procedure Test_Subtraction (T : in out Test); end Math.Test; aunit-21.0.0.fa386849/examples/test_fixture/tests/math_suite.adb0000644000175000017500000000102013530730011024150 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Math.Test; use Math.Test; with AUnit.Test_Caller; package body Math_Suite is package Caller is new AUnit.Test_Caller (Math.Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (Caller.Create ("Test addition", Test_Addition'Access)); Ret.Add_Test (Caller.Create ("Test subtraction", Test_Subtraction'Access)); return Ret; end Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/test_fixture/tests/math_suite.ads0000644000175000017500000000025213530730011024177 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; package Math_Suite is function Suite return Access_Test_Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/test_fixture/tests/test_math.adb0000644000175000017500000000043713530730011024011 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Reporter.Text; with AUnit.Run; with Math_Suite; use Math_Suite; procedure Test_Math is procedure Runner is new AUnit.Run.Test_Runner (Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Runner (Reporter); end Test_Math; aunit-21.0.0.fa386849/examples/liskov/0000755000175000017500000000000013530730011016765 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/liskov/Makefile0000644000175000017500000000016313530730011020425 0ustar nicolasnicolasall: gprbuild -p -Pharness clean: -gprclean -Pharness -gprclean -Ptested_lib/testlib rm -rf obj tested_lib/obj aunit-21.0.0.fa386849/examples/liskov/tested_lib/0000755000175000017500000000000013530730011021103 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/liskov/tested_lib/src/0000755000175000017500000000000013530730011021672 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/liskov/tested_lib/src/square.ads0000644000175000017500000000121613530730011023663 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Rectangle; package Square is type Square_Type is new Rectangle.Rectangle_Type with private; -- class invariant -- for all Obj : Eight (Obj) = Width (Obj) procedure Set_Width (Obj : in out Square_Type; W : Natural); -- pragma Postcondition -- (Height (Obj) = Width (Obj) -- this is the class invariant -- ); procedure Set_Height (Obj : in out Square_Type; H : Natural); -- pragma Postcondition -- (Height (Obj) = Width (Obj) -- this is the class invariant -- ); private type Square_Type is new Rectangle.Rectangle_Type with null record; end Square; aunit-21.0.0.fa386849/examples/liskov/tested_lib/src/rectangle.ads0000644000175000017500000000054313530730011024331 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Shape; package Rectangle is type Rectangle_Type is new Shape.Shape_Type with private; function Area (Obj : Rectangle_Type) return Natural; -- pragma Postcondition (Area'Result = Width (Obj) * Height (Obj)); private type Rectangle_Type is new Shape.Shape_Type with null record; end Rectangle; aunit-21.0.0.fa386849/examples/liskov/tested_lib/src/shape.ads0000644000175000017500000000256213530730011023470 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Shape is type Shape_Type is abstract tagged private; type Shape_Access is access all Shape_Type'Class; -- Additional functional API for expressing pre/postconditions -- & invariants: -- function New_Shape (W, H : Natural) return Shape; -- function Set_Width (S : Shape; W : Natural) return Shape; -- function Set_Height (S : Shape; H : Natural) return Shape; -- -- Class invariants: -- for_all W, H in Natural: -- Set_Width (New_Shape (W, H), X) = New_Shape (X, H)) -- Set_Height (New_Shape (W, H), X) = New_Shape (W, X)) function Width (Obj : Shape_Type) return Natural; function Height (Obj : Shape_Type) return Natural; procedure Set_Width (Obj : in out Shape_Type; W : Natural); -- pragma Postcondition -- (Width (Obj) = W -- expected result -- and Height (Obj) = Height (Obj'Old) -- independence -- ); procedure Set_Height (Obj : in out Shape_Type; H : Natural); -- pragma Postcondition -- (Height (Obj) = H -- expected result -- and Width (Obj) = Width (Obj'Old) -- independence -- ); function Area (Obj : Shape_Type) return Natural is abstract; private type Shape_Type is abstract tagged record Width : Natural; Height : Natural; end record; end Shape; aunit-21.0.0.fa386849/examples/liskov/tested_lib/src/shape.adb0000644000175000017500000000101013530730011023432 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Shape is procedure Set_Width (Obj : in out Shape_Type; W : Natural) is begin Obj.Width := W; end Set_Width; procedure Set_Height (Obj : in out Shape_Type; H : Natural) is begin Obj.Height := H; end Set_Height; function Width (Obj : in Shape_Type) return Natural is begin return Obj.Width; end Width; function Height (Obj : in Shape_Type) return Natural is begin return Obj.Height; end Height; end Shape; aunit-21.0.0.fa386849/examples/liskov/tested_lib/src/rectangle.adb0000644000175000017500000000030613530730011024305 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Rectangle is function Area (Obj : Rectangle_Type) return Natural is begin return Obj.Width * Obj.Height; end Area; end Rectangle; aunit-21.0.0.fa386849/examples/liskov/tested_lib/src/square.adb0000644000175000017500000000056613530730011023651 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Rectangle; use Rectangle; package body Square is procedure Set_Width (Obj : in out Square_Type; W : Natural) is begin Rectangle_Type (Obj).Set_Width (W); Rectangle_Type (Obj).Set_Height (W); end Set_Width; procedure Set_Height (Obj : in out Square_Type; H : Natural) renames Set_Width; end Square; aunit-21.0.0.fa386849/examples/liskov/tested_lib/testlib.gpr0000644000175000017500000000062513530730011023266 0ustar nicolasnicolasproject TestLib is for Source_Dirs use ("src"); for Languages use ("Ada"); for Object_Dir use "obj"; for Library_Dir use "lib"; for Library_Name use "testlib"; for Library_Kind use "static"; package Compiler is for Default_Switches ("ada") use ("-g", "-O1", "-gnat05", "-gnatwa.Xe", "-gnaty", "-gnata", "-gnatf"); end Compiler; end TestLib; aunit-21.0.0.fa386849/examples/liskov/harness.gpr0000644000175000017500000000111413530730011021137 0ustar nicolasnicolaswith "aunit"; with "tested_lib/testlib"; project Harness is for Languages use ("Ada"); for Main use ("test_liskov.adb"); for Source_Dirs use ("tests"); for Exec_Dir use "."; for Object_Dir use "obj"; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; package Compiler is for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty", "-gnat05"); end Compiler; end Harness; aunit-21.0.0.fa386849/examples/liskov/tests/0000755000175000017500000000000013530730011020127 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/liskov/tests/my_suite.ads0000644000175000017500000000024113530730011022453 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; package My_Suite is function Suite return AUnit.Test_Suites.Access_Test_Suite; end My_Suite; aunit-21.0.0.fa386849/examples/liskov/tests/square-tests-suite.ads0000644000175000017500000000026613530730011024413 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; package Square.Tests.Suite is function Suite return AUnit.Test_Suites.Access_Test_Suite; end Square.Tests.Suite; aunit-21.0.0.fa386849/examples/liskov/tests/rectangle-tests.ads0000644000175000017500000000037113530730011023725 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Shape.Tests; package Rectangle.Tests is type Test is new Shape.Tests.Test with null record; procedure Set_Up (T : in out Test); procedure Test_Get_Area (T : in out Test); end Rectangle.Tests; aunit-21.0.0.fa386849/examples/liskov/tests/rectangle-tests.adb0000644000175000017500000000132013530730011023677 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; with Shape; package body Rectangle.Tests is ----------------- -- Set_Up_Case -- ----------------- Local_Rectangle : aliased Rectangle_Type; procedure Set_Up (T : in out Test) is begin T.The_Shape := Local_Rectangle'Access; end Set_Up; ------------------- -- Test_Get_Area -- ------------------- procedure Test_Get_Area (T : in out Test) is begin Shape.Set_Width (T.The_Shape.all, 3); Shape.Set_Height (T.The_Shape.all, 5); Assert (Shape.Area (T.The_Shape.all) = 15, "Wrong area returned for object rectangle"); end Test_Get_Area; end Rectangle.Tests; aunit-21.0.0.fa386849/examples/liskov/tests/shape-tests.adb0000644000175000017500000000172313530730011023042 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body Shape.Tests is -------------------- -- Test_Set_Width -- -------------------- procedure Test_Set_Width (T : in out Test) is begin T.The_Shape.Set_Width (3); Assert (T.The_Shape.Width = 3, "Width did not return the correct value after a Set_Width"); T.The_Shape.Set_Width (7); Assert (T.The_Shape.Width = 7, "Width did not return the correct value after a 2nd Set_Width"); end Test_Set_Width; procedure Test_Set_Height (T : in out Test) is begin T.The_Shape.Set_Height (3); Assert (T.The_Shape.Height = 3, "Height did not return the correct value after a Set_Height"); T.The_Shape.Set_Height (7); Assert (T.The_Shape.Height = 7, "Height did not return the correct value after a 2nd Set_Height"); end Test_Set_Height; end Shape.Tests; aunit-21.0.0.fa386849/examples/liskov/tests/square-tests-suite_liskov.ads0000644000175000017500000000030413530730011025773 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; package Square.Tests.Suite_Liskov is function Suite return AUnit.Test_Suites.Access_Test_Suite; end Square.Tests.Suite_Liskov; aunit-21.0.0.fa386849/examples/liskov/tests/test_liskov.adb0000644000175000017500000000043713530730011023151 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Reporter.Text; with AUnit.Run; with My_Suite; use My_Suite; procedure Test_Liskov is procedure Runner is new AUnit.Run.Test_Runner (Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Runner (Reporter); end Test_Liskov; aunit-21.0.0.fa386849/examples/liskov/tests/square-tests-suite_liskov.adb0000644000175000017500000000275513530730011025766 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Ada.Unchecked_Conversion; with AUnit.Test_Caller; with Rectangle.Tests; package body Square.Tests.Suite_Liskov is package Runner is new AUnit.Test_Caller (Square.Tests.Test); package Rectangle_Runner is new AUnit.Test_Caller (Rectangle.Tests.Test); Result : aliased AUnit.Test_Suites.Test_Suite; Test_Width : aliased Runner.Test_Case; Test_Height : aliased Runner.Test_Case; Test_Area : aliased Runner.Test_Case; function Suite return AUnit.Test_Suites.Access_Test_Suite is function Convert is new Ada.Unchecked_Conversion (Rectangle_Runner.Test_Method, Runner.Test_Method); begin Runner.Create (Test_Width, "Square as Rectangle (liskov) : Test width", Convert (Rectangle_Runner.Test_Method' (Rectangle.Tests.Test_Set_Width'Access))); Runner.Create (Test_Height, "Square as Rectangle (liskov) : Test height", Convert (Rectangle_Runner.Test_Method' (Rectangle.Tests.Test_Set_Height'Access))); Runner.Create (Test_Area, "Square as Rectangle (liskov) : Test area", Convert (Rectangle_Runner.Test_Method' (Rectangle.Tests.Test_Get_Area'Access))); Result.Add_Test (Test_Width'Access); Result.Add_Test (Test_Height'Access); Result.Add_Test (Test_Area'Access); return Result'Access; end Suite; end Square.Tests.Suite_Liskov; aunit-21.0.0.fa386849/examples/liskov/tests/rectangle-tests-suite.adb0000644000175000017500000000203613530730011025033 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Caller; package body Rectangle.Tests.Suite is package Runner is new AUnit.Test_Caller (Rectangle.Tests.Test); Result : aliased AUnit.Test_Suites.Test_Suite; Test_Width : aliased Runner.Test_Case; Test_Height : aliased Runner.Test_Case; Test_Area : aliased Runner.Test_Case; ----------- -- Suite -- ----------- function Suite return AUnit.Test_Suites.Access_Test_Suite is begin Runner.Create (Test_Width, "Rectangle : Test width", Test_Set_Width'Access); Runner.Create (Test_Height, "Rectangle : Test height", Test_Set_Height'Access); Runner.Create (Test_Area, "Rectangle : Test area", Test_Get_Area'Access); Result.Add_Test (Test_Width'Access); Result.Add_Test (Test_Height'Access); Result.Add_Test (Test_Area'Access); return Result'Access; end Suite; end Rectangle.Tests.Suite; aunit-21.0.0.fa386849/examples/liskov/tests/square-tests.adb0000644000175000017500000000135413530730011023242 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body Square.Tests is ----------------- -- Set_Up_Case -- ----------------- Local_Square : aliased Square_Type; procedure Set_Up (T : in out Test) is begin T.The_Shape := Local_Square'Access; end Set_Up; ------------------- -- Test_Get_Area -- ------------------- procedure Test_Get_Area (T : in out Test) is begin T.The_Shape.Set_Width (3); Assert (T.The_Shape.Area = 9, "Wrong area returned for object square"); T.The_Shape.Set_Height (5); Assert (T.The_Shape.Area = 25, "Wrong area returned for object square"); end Test_Get_Area; end Square.Tests; aunit-21.0.0.fa386849/examples/liskov/tests/rectangle-tests-suite.ads0000644000175000017500000000027413530730011025056 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; package Rectangle.Tests.Suite is function Suite return AUnit.Test_Suites.Access_Test_Suite; end Rectangle.Tests.Suite; aunit-21.0.0.fa386849/examples/liskov/tests/shape-tests.ads0000644000175000017500000000060113530730011023055 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Fixtures; package Shape.Tests is type Test is abstract new AUnit.Test_Fixtures.Test_Fixture with record The_Shape : Shape_Access; end record; procedure Test_Set_Width (T : in out Test); procedure Test_Set_Height (T : in out Test); procedure Test_Get_Area (T : in out Test) is abstract; end Shape.Tests; aunit-21.0.0.fa386849/examples/liskov/tests/my_suite.adb0000644000175000017500000000101013530730011022425 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- -- with AUnit.Test_Caller; with Rectangle.Tests.Suite; with Square.Tests.Suite; with Square.Tests.Suite_Liskov; package body My_Suite is Result : aliased AUnit.Test_Suites.Test_Suite; function Suite return AUnit.Test_Suites.Access_Test_Suite is begin Result.Add_Test (Rectangle.Tests.Suite.Suite); Result.Add_Test (Square.Tests.Suite.Suite); Result.Add_Test (Square.Tests.Suite_Liskov.Suite); return Result'Access; end Suite; end My_Suite; aunit-21.0.0.fa386849/examples/liskov/tests/square-tests.ads0000644000175000017500000000040013530730011023252 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Rectangle.Tests; package Square.Tests is type Test is new Rectangle.Tests.Test with null record; procedure Set_Up (T : in out Test); procedure Test_Get_Area (T : in out Test); end Square.Tests; aunit-21.0.0.fa386849/examples/liskov/tests/square-tests-suite.adb0000644000175000017500000000173313530730011024372 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Caller; package body Square.Tests.Suite is package Runner is new AUnit.Test_Caller (Square.Tests.Test); Result : aliased AUnit.Test_Suites.Test_Suite; Test_Width : aliased Runner.Test_Case; Test_Height : aliased Runner.Test_Case; Test_Area : aliased Runner.Test_Case; function Suite return AUnit.Test_Suites.Access_Test_Suite is begin Runner.Create (Test_Width, "Square : Test width", Test_Set_Width'Access); Runner.Create (Test_Height, "Square : Test height", Test_Set_Height'Access); Runner.Create (Test_Area, "Square : Test area", Test_Get_Area'Access); Result.Add_Test (Test_Width'Access); Result.Add_Test (Test_Height'Access); Result.Add_Test (Test_Area'Access); return Result'Access; end Suite; end Square.Tests.Suite; aunit-21.0.0.fa386849/examples/simple_test/0000755000175000017500000000000013530730011020006 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/simple_test/Makefile0000644000175000017500000000016313530730011021446 0ustar nicolasnicolasall: gprbuild -p -Pharness clean: -gprclean -Pharness -gprclean -Ptested_lib/testlib rm -rf obj tested_lib/obj aunit-21.0.0.fa386849/examples/simple_test/tested_lib/0000755000175000017500000000000013530730011022124 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/simple_test/tested_lib/src/0000755000175000017500000000000013530730011022713 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/simple_test/tested_lib/src/math.adb0000644000175000017500000000045413530730011024317 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Math is function "+" (I1, I2 : Int) return Int is begin return Int (Integer (I1) + Integer (I2)); end "+"; function "-" (I1, I2 : Int) return Int is begin return Int (Integer (I1) - Integer (I2)); end "-"; end Math; aunit-21.0.0.fa386849/examples/simple_test/tested_lib/src/math.ads0000644000175000017500000000026613530730011024341 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Math is type Int is new Integer; function "+" (I1, I2 : Int) return Int; function "-" (I1, I2 : Int) return Int; end Math; aunit-21.0.0.fa386849/examples/simple_test/tested_lib/testlib.gpr0000644000175000017500000000062513530730011024307 0ustar nicolasnicolasproject TestLib is for Source_Dirs use ("src"); for Languages use ("Ada"); for Object_Dir use "obj"; for Library_Dir use "lib"; for Library_Name use "testlib"; for Library_Kind use "static"; package Compiler is for Default_Switches ("ada") use ("-g", "-O1", "-gnat05", "-gnatwa.Xe", "-gnaty", "-gnata", "-gnatf"); end Compiler; end TestLib; aunit-21.0.0.fa386849/examples/simple_test/harness.gpr0000644000175000017500000000111213530730011022156 0ustar nicolasnicolaswith "aunit"; with "tested_lib/testlib"; project Harness is for Languages use ("Ada"); for Main use ("test_math.adb"); for Source_Dirs use ("tests"); for Exec_Dir use "."; for Object_Dir use "obj"; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; package Compiler is for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty", "-gnat05"); end Compiler; end Harness; aunit-21.0.0.fa386849/examples/simple_test/tests/0000755000175000017500000000000013740342124021157 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/simple_test/tests/math-test.adb0000644000175000017500000000110213530730011023520 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body Math.Test is function Name (T : Test) return AUnit.Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Test Math package"); end Name; procedure Run_Test (T : in out Test) is pragma Unreferenced (T); I1 : constant Int := 5; I2 : constant Int := 3; begin Assert (I1 + I2 = 8, "Incorrect result after addition"); Assert (I1 - I2 = 2, "Incorrect result after subtraction"); end Run_Test; end Math.Test; aunit-21.0.0.fa386849/examples/simple_test/tests/math-test.ads0000644000175000017500000000044313530730011023550 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit; with AUnit.Simple_Test_Cases; package Math.Test 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 Math.Test; aunit-21.0.0.fa386849/examples/simple_test/tests/math_suite.adb0000644000175000017500000000043613740342124023774 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Math.Test; package body Math_Suite is function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (new Math.Test.Test); return Ret; end Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/simple_test/tests/math_suite.ads0000644000175000017500000000025213530730011024002 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; package Math_Suite is function Suite return Access_Test_Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/simple_test/tests/test_math.adb0000644000175000017500000000043713530730011023614 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Reporter.Text; with AUnit.Run; with Math_Suite; use Math_Suite; procedure Test_Math is procedure Runner is new AUnit.Run.Test_Runner (Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Runner (Reporter); end Test_Math; aunit-21.0.0.fa386849/examples/failures/0000755000175000017500000000000013530730011017270 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/failures/Makefile0000644000175000017500000000016313530730011020730 0ustar nicolasnicolasall: gprbuild -p -Pharness clean: -gprclean -Pharness -gprclean -Ptested_lib/testlib rm -rf obj tested_lib/obj aunit-21.0.0.fa386849/examples/failures/tested_lib/0000755000175000017500000000000013530730011021406 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/failures/tested_lib/src/0000755000175000017500000000000013530730011022175 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/failures/tested_lib/src/math.adb0000644000175000017500000000045413530730011023601 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package body Math is function "+" (I1, I2 : Int) return Int is begin return Int (Integer (I1) + Integer (I2)); end "+"; function "-" (I1, I2 : Int) return Int is begin return Int (Integer (I1) - Integer (I2)); end "-"; end Math; aunit-21.0.0.fa386849/examples/failures/tested_lib/src/math.ads0000644000175000017500000000026613530730011023623 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- package Math is type Int is new Integer; function "+" (I1, I2 : Int) return Int; function "-" (I1, I2 : Int) return Int; end Math; aunit-21.0.0.fa386849/examples/failures/tested_lib/testlib.gpr0000644000175000017500000000062513530730011023571 0ustar nicolasnicolasproject TestLib is for Source_Dirs use ("src"); for Languages use ("Ada"); for Object_Dir use "obj"; for Library_Dir use "lib"; for Library_Name use "testlib"; for Library_Kind use "static"; package Compiler is for Default_Switches ("ada") use ("-g", "-O1", "-gnat05", "-gnatwa.Xe", "-gnaty", "-gnato", "-gnatf"); end Compiler; end TestLib; aunit-21.0.0.fa386849/examples/failures/harness.gpr0000644000175000017500000000111213530730011021440 0ustar nicolasnicolaswith "aunit"; with "tested_lib/testlib"; project Harness is for Languages use ("Ada"); for Main use ("test_math.adb"); for Source_Dirs use ("tests"); for Exec_Dir use "."; for Object_Dir use "obj"; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; package Compiler is for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty", "-gnat05"); end Compiler; end Harness; aunit-21.0.0.fa386849/examples/failures/tests/0000755000175000017500000000000013530730011020432 5ustar nicolasnicolasaunit-21.0.0.fa386849/examples/failures/tests/math-test.adb0000644000175000017500000000214613530730011023013 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body Math.Test is procedure Test_Addition (T : in out Test) is pragma Unreferenced (T); I1 : constant Int := 5; I2 : constant Int := 3; begin Assert (I1 + I2 = 8, "Incorrect result after addition"); end Test_Addition; procedure Test_Subtraction (T : in out Test) is pragma Unreferenced (T); I1 : constant Int := 5; I2 : constant Int := 3; begin Assert (I1 - I2 = 2, "Incorrect result after subtraction"); end Test_Subtraction; procedure Test_Addition_Failure (T : in out Test) is pragma Unreferenced (T); I1 : constant Int := 5; I2 : constant Int := 3; begin Assert (I1 + I2 = 9, "Test should fail this assertion, as 5+3 /= 9"); end Test_Addition_Failure; procedure Test_Addition_Error (T : in out Test) is pragma Unreferenced (T); I1 : constant Int := Int'Last; I2 : constant Int := Int'Last; begin Assert (I1 + I2 = I1, "This raises a constraint error"); end Test_Addition_Error; end Math.Test; aunit-21.0.0.fa386849/examples/failures/tests/math-test.ads0000644000175000017500000000073313530730011023034 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit; with AUnit.Test_Fixtures; package Math.Test is type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Addition (T : in out Test); procedure Test_Subtraction (T : in out Test); procedure Test_Addition_Failure (T : in out Test); -- This test will do a failed assertion procedure Test_Addition_Error (T : in out Test); -- This test will raise an exception end Math.Test; aunit-21.0.0.fa386849/examples/failures/tests/math_suite.adb0000644000175000017500000000143013530730011023242 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with Math.Test; use Math.Test; with AUnit.Test_Caller; package body Math_Suite is package Caller is new AUnit.Test_Caller (Math.Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (Caller.Create ("Test addition", Test_Addition'Access)); Ret.Add_Test (Caller.Create ("Test subtraction", Test_Subtraction'Access)); Ret.Add_Test (Caller.Create ("Test addition (failure expected)", Test_Addition_Failure'Access)); Ret.Add_Test (Caller.Create ("Test addition (error expected)", Test_Addition_Error'Access)); return Ret; end Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/failures/tests/math_suite.ads0000644000175000017500000000025213530730011023264 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Test_Suites; use AUnit.Test_Suites; package Math_Suite is function Suite return Access_Test_Suite; end Math_Suite; aunit-21.0.0.fa386849/examples/failures/tests/test_math.adb0000644000175000017500000000043713530730011023076 0ustar nicolasnicolas-- -- Copyright (C) 2008, AdaCore -- with AUnit.Reporter.Text; with AUnit.Run; with Math_Suite; use Math_Suite; procedure Test_Math is procedure Runner is new AUnit.Run.Test_Runner (Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Runner (Reporter); end Test_Math; aunit-21.0.0.fa386849/include/0000755000175000017500000000000013530730011015263 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/0000755000175000017500000000000013530730011016403 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/containers/0000755000175000017500000000000013530730011020550 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/containers/ada_containers-aunit_lists.adb0000644000175000017500000011237413530730011026536 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A _ C O N T A I N E R S . A U N I T _ L I S T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2007, Free Software Foundation, Inc. -- -- Copyright (C) 2008-2015, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ pragma Ada_2005; with System; use type System.Address; with AUnit.Memory; use AUnit.Memory; with AUnit.Memory.Utils; use AUnit.Memory.Utils; package body Ada_Containers.AUnit_Lists is ----------------------- -- Local Subprograms -- ----------------------- function New_Node_Type is new AUnit.Memory.Utils.Gen_Alloc (Node_Type, Node_Access); function New_Node_Type (Element : Element_Type; Next : Node_Access; Prev : Node_Access) return Node_Access; procedure Insert_Internal (Container : in out List; Before : Node_Access; New_Node : Node_Access); function Vet (Position : Cursor) return Boolean; -------------- -- New_Node -- -------------- function New_Node_Type (Element : Element_Type; Next : Node_Access; Prev : Node_Access) return Node_Access is Res : constant Node_Access := New_Node_Type; begin Res.Element := Element; Res.Next := Next; Res.Prev := Prev; return Res; end New_Node_Type; --------- -- "=" -- --------- function "=" (Left, Right : List) return Boolean is L : Node_Access := Left.First; R : Node_Access := Right.First; begin if Left'Address = Right'Address then return True; end if; if Left.Length /= Right.Length then return False; end if; for J in 1 .. Left.Length loop if L.Element /= R.Element then return False; end if; L := L.Next; R := R.Next; end loop; return True; end "="; ------------ -- Append -- ------------ procedure Append (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1) is begin Insert (Container, No_Element, New_Item, Count); end Append; ----------- -- Clear -- ----------- procedure Clear (Container : in out List) is X : Node_Access; begin if Container.Length = 0 then pragma Assert (Container.First = null); pragma Assert (Container.Last = null); pragma Assert (Container.Busy = 0); pragma Assert (Container.Lock = 0); return; end if; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); if Container.Busy > 0 then raise Program_Error; end if; while Container.Length > 1 loop X := Container.First; pragma Assert (X.Next.Prev = Container.First); Container.First := X.Next; Container.First.Prev := null; Container.Length := Container.Length - 1; AUnit_Free (X.all'Address); end loop; X := Container.First; pragma Assert (X = Container.Last); Container.First := null; Container.Last := null; Container.Length := 0; AUnit_Free (X.all'Address); end Clear; -------------- -- Contains -- -------------- function Contains (Container : List; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= No_Element; end Contains; ------------ -- Delete -- ------------ procedure Delete (Container : in out List; Position : in out Cursor; Count : Count_Type := 1) is X : Node_Access; begin if Position.Node = null then raise Constraint_Error; end if; if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); if Position.Node = Container.First then Delete_First (Container, Count); Position := No_Element; -- Post-York behavior return; end if; if Count = 0 then Position := No_Element; -- Post-York behavior return; end if; if Container.Busy > 0 then raise Program_Error; end if; for Index in 1 .. Count loop X := Position.Node; Container.Length := Container.Length - 1; if X = Container.Last then Position := No_Element; Container.Last := X.Prev; Container.Last.Next := null; AUnit_Free (X.all'Address); return; end if; Position.Node := X.Next; X.Next.Prev := X.Prev; X.Prev.Next := X.Next; AUnit_Free (X.all'Address); end loop; Position := No_Element; -- Post-York behavior end Delete; ------------------ -- Delete_First -- ------------------ procedure Delete_First (Container : in out List; Count : Count_Type := 1) is X : Node_Access; begin if Count >= Container.Length then Clear (Container); return; end if; if Count = 0 then return; end if; if Container.Busy > 0 then raise Program_Error; end if; for I in 1 .. Count loop X := Container.First; pragma Assert (X.Next.Prev = Container.First); Container.First := X.Next; Container.First.Prev := null; Container.Length := Container.Length - 1; AUnit_Free (X.all'Address); end loop; end Delete_First; ----------------- -- Delete_Last -- ----------------- procedure Delete_Last (Container : in out List; Count : Count_Type := 1) is X : Node_Access; begin if Count >= Container.Length then Clear (Container); return; end if; if Count = 0 then return; end if; if Container.Busy > 0 then raise Program_Error; end if; for I in 1 .. Count loop X := Container.Last; pragma Assert (X.Prev.Next = Container.Last); Container.Last := X.Prev; Container.Last.Next := null; Container.Length := Container.Length - 1; AUnit_Free (X.all'Address); end loop; end Delete_Last; ------------- -- Element -- ------------- function Element (Position : Cursor) return Element_Type is begin if Position.Node = null then raise Constraint_Error; end if; pragma Assert (Vet (Position), "bad cursor in Element"); return Position.Node.Element; end Element; ---------- -- Find -- ---------- function Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor is Node : Node_Access := Position.Node; begin if Node = null then Node := Container.First; else if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Find"); end if; while Node /= null loop if Node.Element = Item then return Cursor'(Container'Unchecked_Access, Node); end if; Node := Node.Next; end loop; return No_Element; end Find; ----------- -- First -- ----------- function First (Container : List) return Cursor is begin if Container.First = null then return No_Element; end if; return Cursor'(Container'Unchecked_Access, Container.First); end First; ------------------- -- First_Element -- ------------------- function First_Element (Container : List) return Element_Type is begin if Container.First = null then raise Constraint_Error; end if; return Container.First.Element; end First_Element; --------------------- -- Generic_Sorting -- --------------------- package body Generic_Sorting is --------------- -- Is_Sorted -- --------------- function Is_Sorted (Container : List) return Boolean is Node : Node_Access := Container.First; begin for I in 2 .. Container.Length loop if Node.Next.Element < Node.Element then return False; end if; Node := Node.Next; end loop; return True; end Is_Sorted; ----------- -- Merge -- ----------- procedure Merge (Target : in out List; Source : in out List) is LI, RI : Cursor; begin if Target'Address = Source'Address then return; end if; if Target.Busy > 0 then raise Program_Error; end if; if Source.Busy > 0 then raise Program_Error; end if; LI := First (Target); RI := First (Source); while RI.Node /= null loop pragma Assert (RI.Node.Next = null or else not (RI.Node.Next.Element < RI.Node.Element)); if LI.Node = null then Splice (Target, No_Element, Source); return; end if; pragma Assert (LI.Node.Next = null or else not (LI.Node.Next.Element < LI.Node.Element)); if RI.Node.Element < LI.Node.Element then declare RJ : Cursor := RI; pragma Warnings (Off, RJ); begin RI.Node := RI.Node.Next; Splice (Target, LI, Source, RJ); end; else LI.Node := LI.Node.Next; end if; end loop; end Merge; ---------- -- Sort -- ---------- procedure Sort (Container : in out List) is procedure Partition (Pivot : Node_Access; Back : Node_Access); procedure Sort (Front, Back : Node_Access); --------------- -- Partition -- --------------- procedure Partition (Pivot : Node_Access; Back : Node_Access) is Node : Node_Access := Pivot.Next; begin while Node /= Back loop if Node.Element < Pivot.Element then declare Prev : constant Node_Access := Node.Prev; Next : constant Node_Access := Node.Next; begin Prev.Next := Next; if Next = null then Container.Last := Prev; else Next.Prev := Prev; end if; Node.Next := Pivot; Node.Prev := Pivot.Prev; Pivot.Prev := Node; if Node.Prev = null then Container.First := Node; else Node.Prev.Next := Node; end if; Node := Next; end; else Node := Node.Next; end if; end loop; end Partition; ---------- -- Sort -- ---------- procedure Sort (Front, Back : Node_Access) is Pivot : Node_Access; begin if Front = null then Pivot := Container.First; else Pivot := Front.Next; end if; if Pivot /= Back then Partition (Pivot, Back); Sort (Front, Pivot); Sort (Pivot, Back); end if; end Sort; -- Start of processing for Sort begin if Container.Length <= 1 then return; end if; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); if Container.Busy > 0 then raise Program_Error; end if; Sort (Front => null, Back => null); pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); end Sort; end Generic_Sorting; ----------------- -- Has_Element -- ----------------- function Has_Element (Position : Cursor) return Boolean is begin pragma Assert (Vet (Position), "bad cursor in Has_Element"); return Position.Node /= null; end Has_Element; ------------ -- Insert -- ------------ procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1) is New_Node : Node_Access; begin if Before.Container /= null then if Before.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Before), "bad cursor in Insert"); end if; if Count = 0 then Position := Before; return; end if; if Container.Length > Count_Type'Last - Count then raise Constraint_Error; end if; if Container.Busy > 0 then raise Program_Error; end if; New_Node := New_Node_Type (New_Item, null, null); Insert_Internal (Container, Before.Node, New_Node); Position := Cursor'(Container'Unchecked_Access, New_Node); for J in Count_Type'(2) .. Count loop New_Node := New_Node_Type (New_Item, null, null); Insert_Internal (Container, Before.Node, New_Node); end loop; end Insert; procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1) is Position : Cursor; pragma Unreferenced (Position); begin Insert (Container, Before, New_Item, Position, Count); end Insert; procedure Insert (Container : in out List; Before : Cursor; Position : out Cursor; Count : Count_Type := 1) is New_Node : Node_Access; begin if Before.Container /= null then if Before.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Before), "bad cursor in Insert"); end if; if Count = 0 then Position := Before; return; end if; if Container.Length > Count_Type'Last - Count then raise Constraint_Error; end if; if Container.Busy > 0 then raise Program_Error; end if; New_Node := New_Node_Type; Insert_Internal (Container, Before.Node, New_Node); Position := Cursor'(Container'Unchecked_Access, New_Node); for J in Count_Type'(2) .. Count loop New_Node := New_Node_Type; Insert_Internal (Container, Before.Node, New_Node); end loop; end Insert; --------------------- -- Insert_Internal -- --------------------- procedure Insert_Internal (Container : in out List; Before : Node_Access; New_Node : Node_Access) is begin if Container.Length = 0 then pragma Assert (Before = null); pragma Assert (Container.First = null); pragma Assert (Container.Last = null); Container.First := New_Node; Container.Last := New_Node; elsif Before = null then pragma Assert (Container.Last.Next = null); Container.Last.Next := New_Node; New_Node.Prev := Container.Last; Container.Last := New_Node; elsif Before = Container.First then pragma Assert (Container.First.Prev = null); Container.First.Prev := New_Node; New_Node.Next := Container.First; Container.First := New_Node; else pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); New_Node.Next := Before; New_Node.Prev := Before.Prev; Before.Prev.Next := New_Node; Before.Prev := New_Node; end if; Container.Length := Container.Length + 1; end Insert_Internal; -------------- -- Is_Empty -- -------------- function Is_Empty (Container : List) return Boolean is begin return Container.Length = 0; end Is_Empty; ------------- -- Iterate -- ------------- procedure Iterate (Container : List; Process : Iterator) is C : List renames Container'Unrestricted_Access.all; B : Natural renames C.Busy; Node : Node_Access := Container.First; begin B := B + 1; begin while Node /= null loop Process (Cursor'(Container'Unchecked_Access, Node)); Node := Node.Next; end loop; end; B := B - 1; end Iterate; ---------- -- Last -- ---------- function Last (Container : List) return Cursor is begin if Container.Last = null then return No_Element; end if; return Cursor'(Container'Unchecked_Access, Container.Last); end Last; ------------------ -- Last_Element -- ------------------ function Last_Element (Container : List) return Element_Type is begin if Container.Last = null then raise Constraint_Error; end if; return Container.Last.Element; end Last_Element; ------------ -- Length -- ------------ function Length (Container : List) return Count_Type is begin return Container.Length; end Length; ---------- -- Move -- ---------- procedure Move (Target : in out List; Source : in out List) is begin if Target'Address = Source'Address then return; end if; if Source.Busy > 0 then raise Program_Error; end if; Clear (Target); Target.First := Source.First; Source.First := null; Target.Last := Source.Last; Source.Last := null; Target.Length := Source.Length; Source.Length := 0; end Move; ---------- -- Next -- ---------- procedure Next (Position : in out Cursor) is begin Position := Next (Position); end Next; function Next (Position : Cursor) return Cursor is begin if Position.Node = null then return No_Element; end if; pragma Assert (Vet (Position), "bad cursor in Next"); declare Next_Node : constant Node_Access := Position.Node.Next; begin if Next_Node = null then return No_Element; end if; return Cursor'(Position.Container, Next_Node); end; end Next; ------------- -- Prepend -- ------------- procedure Prepend (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1) is begin Insert (Container, First (Container), New_Item, Count); end Prepend; -------------- -- Previous -- -------------- procedure Previous (Position : in out Cursor) is begin Position := Previous (Position); end Previous; function Previous (Position : Cursor) return Cursor is begin if Position.Node = null then return No_Element; end if; pragma Assert (Vet (Position), "bad cursor in Previous"); declare Prev_Node : constant Node_Access := Position.Node.Prev; begin if Prev_Node = null then return No_Element; end if; return Cursor'(Position.Container, Prev_Node); end; end Previous; --------------------- -- Replace_Element -- --------------------- procedure Replace_Element (Container : in out List; Position : Cursor; New_Item : Element_Type) is begin if Position.Container = null then raise Constraint_Error; end if; if Position.Container /= Container'Unchecked_Access then raise Program_Error; end if; if Container.Lock > 0 then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); Position.Node.Element := New_Item; end Replace_Element; ---------------------- -- Reverse_Elements -- ---------------------- procedure Reverse_Elements (Container : in out List) is I : Node_Access := Container.First; J : Node_Access := Container.Last; procedure Swap (L, R : Node_Access); ---------- -- Swap -- ---------- procedure Swap (L, R : Node_Access) is LN : constant Node_Access := L.Next; LP : constant Node_Access := L.Prev; RN : constant Node_Access := R.Next; RP : constant Node_Access := R.Prev; begin if LP /= null then LP.Next := R; end if; if RN /= null then RN.Prev := L; end if; L.Next := RN; R.Prev := LP; if LN = R then pragma Assert (RP = L); L.Prev := R; R.Next := L; else L.Prev := RP; RP.Next := L; R.Next := LN; LN.Prev := R; end if; end Swap; -- Start of processing for Reverse_Elements begin if Container.Length <= 1 then return; end if; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); if Container.Busy > 0 then raise Program_Error; end if; Container.First := J; Container.Last := I; loop Swap (L => I, R => J); J := J.Next; exit when I = J; I := I.Prev; exit when I = J; Swap (L => J, R => I); I := I.Next; exit when I = J; J := J.Prev; exit when I = J; end loop; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); end Reverse_Elements; ------------------ -- Reverse_Find -- ------------------ function Reverse_Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor is Node : Node_Access := Position.Node; begin if Node = null then Node := Container.Last; else if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Reverse_Find"); end if; while Node /= null loop if Node.Element = Item then return Cursor'(Container'Unchecked_Access, Node); end if; Node := Node.Prev; end loop; return No_Element; end Reverse_Find; ------------ -- Splice -- ------------ procedure Splice (Target : in out List; Before : Cursor; Source : in out List) is begin if Before.Container /= null then if Before.Container /= Target'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Before), "bad cursor in Splice"); end if; if Target'Address = Source'Address or else Source.Length = 0 then return; end if; pragma Assert (Source.First.Prev = null); pragma Assert (Source.Last.Next = null); if Target.Length > Count_Type'Last - Source.Length then raise Constraint_Error; end if; if Target.Busy > 0 then raise Program_Error; end if; if Source.Busy > 0 then raise Program_Error; end if; if Target.Length = 0 then pragma Assert (Target.First = null); pragma Assert (Target.Last = null); pragma Assert (Before = No_Element); Target.First := Source.First; Target.Last := Source.Last; elsif Before.Node = null then pragma Assert (Target.Last.Next = null); Target.Last.Next := Source.First; Source.First.Prev := Target.Last; Target.Last := Source.Last; elsif Before.Node = Target.First then pragma Assert (Target.First.Prev = null); Source.Last.Next := Target.First; Target.First.Prev := Source.Last; Target.First := Source.First; else pragma Assert (Target.Length >= 2); Before.Node.Prev.Next := Source.First; Source.First.Prev := Before.Node.Prev; Before.Node.Prev := Source.Last; Source.Last.Next := Before.Node; end if; Source.First := null; Source.Last := null; Target.Length := Target.Length + Source.Length; Source.Length := 0; end Splice; procedure Splice (Container : in out List; Before : Cursor; Position : Cursor) is begin if Before.Container /= null then if Before.Container /= Container'Unchecked_Access then raise Program_Error; end if; pragma Assert (Vet (Before), "bad Before cursor in Splice"); end if; if Position.Node = null then raise Constraint_Error; end if; if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad Position cursor in Splice"); if Position.Node = Before.Node or else Position.Node.Next = Before.Node then return; end if; pragma Assert (Container.Length >= 2); if Container.Busy > 0 then raise Program_Error; end if; if Before.Node = null then pragma Assert (Position.Node /= Container.Last); if Position.Node = Container.First then Container.First := Position.Node.Next; Container.First.Prev := null; else Position.Node.Prev.Next := Position.Node.Next; Position.Node.Next.Prev := Position.Node.Prev; end if; Container.Last.Next := Position.Node; Position.Node.Prev := Container.Last; Container.Last := Position.Node; Container.Last.Next := null; return; end if; if Before.Node = Container.First then pragma Assert (Position.Node /= Container.First); if Position.Node = Container.Last then Container.Last := Position.Node.Prev; Container.Last.Next := null; else Position.Node.Prev.Next := Position.Node.Next; Position.Node.Next.Prev := Position.Node.Prev; end if; Container.First.Prev := Position.Node; Position.Node.Next := Container.First; Container.First := Position.Node; Container.First.Prev := null; return; end if; if Position.Node = Container.First then Container.First := Position.Node.Next; Container.First.Prev := null; elsif Position.Node = Container.Last then Container.Last := Position.Node.Prev; Container.Last.Next := null; else Position.Node.Prev.Next := Position.Node.Next; Position.Node.Next.Prev := Position.Node.Prev; end if; Before.Node.Prev.Next := Position.Node; Position.Node.Prev := Before.Node.Prev; Before.Node.Prev := Position.Node; Position.Node.Next := Before.Node; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); end Splice; procedure Splice (Target : in out List; Before : Cursor; Source : in out List; Position : in out Cursor) is begin if Target'Address = Source'Address then Splice (Target, Before, Position); return; end if; if Before.Container /= null then if Before.Container /= Target'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Before), "bad Before cursor in Splice"); end if; if Position.Node = null then raise Constraint_Error; end if; if Position.Container /= Source'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad Position cursor in Splice"); if Target.Length = Count_Type'Last then raise Constraint_Error; end if; if Target.Busy > 0 then raise Program_Error; end if; if Source.Busy > 0 then raise Program_Error; end if; if Position.Node = Source.First then Source.First := Position.Node.Next; if Position.Node = Source.Last then pragma Assert (Source.First = null); pragma Assert (Source.Length = 1); Source.Last := null; else Source.First.Prev := null; end if; elsif Position.Node = Source.Last then pragma Assert (Source.Length >= 2); Source.Last := Position.Node.Prev; Source.Last.Next := null; else pragma Assert (Source.Length >= 3); Position.Node.Prev.Next := Position.Node.Next; Position.Node.Next.Prev := Position.Node.Prev; end if; if Target.Length = 0 then pragma Assert (Target.First = null); pragma Assert (Target.Last = null); pragma Assert (Before = No_Element); Target.First := Position.Node; Target.Last := Position.Node; Target.First.Prev := null; Target.Last.Next := null; elsif Before.Node = null then pragma Assert (Target.Last.Next = null); Target.Last.Next := Position.Node; Position.Node.Prev := Target.Last; Target.Last := Position.Node; Target.Last.Next := null; elsif Before.Node = Target.First then pragma Assert (Target.First.Prev = null); Target.First.Prev := Position.Node; Position.Node.Next := Target.First; Target.First := Position.Node; Target.First.Prev := null; else pragma Assert (Target.Length >= 2); Before.Node.Prev.Next := Position.Node; Position.Node.Prev := Before.Node.Prev; Before.Node.Prev := Position.Node; Position.Node.Next := Before.Node; end if; Target.Length := Target.Length + 1; Source.Length := Source.Length - 1; Position.Container := Target'Unchecked_Access; end Splice; ---------- -- Swap -- ---------- procedure Swap (Container : in out List; I, J : Cursor) is begin if I.Node = null then raise Constraint_Error; end if; if J.Node = null then raise Constraint_Error; end if; if I.Container /= Container'Unchecked_Access then raise Program_Error; end if; if J.Container /= Container'Unchecked_Access then raise Program_Error; end if; if I.Node = J.Node then return; end if; if Container.Lock > 0 then raise Program_Error; end if; pragma Assert (Vet (I), "bad I cursor in Swap"); pragma Assert (Vet (J), "bad J cursor in Swap"); declare EI : Element_Type renames I.Node.Element; EJ : Element_Type renames J.Node.Element; EI_Copy : constant Element_Type := EI; begin EI := EJ; EJ := EI_Copy; end; end Swap; ---------------- -- Swap_Links -- ---------------- procedure Swap_Links (Container : in out List; I, J : Cursor) is begin if I.Node = null then raise Constraint_Error; end if; if J.Node = null then raise Constraint_Error; end if; if I.Container /= Container'Unrestricted_Access then raise Program_Error; end if; if J.Container /= Container'Unrestricted_Access then raise Program_Error; end if; if I.Node = J.Node then return; end if; if Container.Busy > 0 then raise Program_Error; end if; pragma Assert (Vet (I), "bad I cursor in Swap_Links"); pragma Assert (Vet (J), "bad J cursor in Swap_Links"); declare I_Next : constant Cursor := Next (I); begin if I_Next = J then Splice (Container, Before => I, Position => J); else declare J_Next : constant Cursor := Next (J); begin if J_Next = I then Splice (Container, Before => J, Position => I); else pragma Assert (Container.Length >= 3); Splice (Container, Before => I_Next, Position => J); Splice (Container, Before => J_Next, Position => I); end if; end; end if; end; end Swap_Links; --------- -- Vet -- --------- function Vet (Position : Cursor) return Boolean is begin if Position.Node = null then return Position.Container = null; end if; if Position.Container = null then return False; end if; if Position.Node.Next = Position.Node then return False; end if; if Position.Node.Prev = Position.Node then return False; end if; declare L : List renames Position.Container.all; begin if L.Length = 0 then return False; end if; if L.First = null then return False; end if; if L.Last = null then return False; end if; if L.First.Prev /= null then return False; end if; if L.Last.Next /= null then return False; end if; if Position.Node.Prev = null and then Position.Node /= L.First then return False; end if; if Position.Node.Next = null and then Position.Node /= L.Last then return False; end if; if L.Length = 1 then return L.First = L.Last; end if; if L.First = L.Last then return False; end if; if L.First.Next = null then return False; end if; if L.Last.Prev = null then return False; end if; if L.First.Next.Prev /= L.First then return False; end if; if L.Last.Prev.Next /= L.Last then return False; end if; if L.Length = 2 then if L.First.Next /= L.Last then return False; end if; if L.Last.Prev /= L.First then return False; end if; return True; end if; if L.First.Next = L.Last then return False; end if; if L.Last.Prev = L.First then return False; end if; if Position.Node = L.First then return True; end if; if Position.Node = L.Last then return True; end if; if Position.Node.Next = null then return False; end if; if Position.Node.Prev = null then return False; end if; if Position.Node.Next.Prev /= Position.Node then return False; end if; if Position.Node.Prev.Next /= Position.Node then return False; end if; if L.Length = 3 then if L.First.Next /= Position.Node then return False; end if; if L.Last.Prev /= Position.Node then return False; end if; end if; return True; end; end Vet; end Ada_Containers.AUnit_Lists; aunit-21.0.0.fa386849/include/aunit/containers/ada_containers.ads0000644000175000017500000000233713530730011024220 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S -- -- -- -- S p e c -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ package Ada_Containers is pragma Pure; type Hash_Type is mod 2**32; type Count_Type is range 0 .. 2**31 - 1; end Ada_Containers; aunit-21.0.0.fa386849/include/aunit/containers/ada_containers-aunit_lists.ads0000644000175000017500000001730213530730011026552 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A _ C O N T A I N E R S . A U N I T _ L I S T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2008, Free Software Foundation, Inc. -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ -- This unit is an adaptation of the Ada2005 runtime's -- Ada.Containers.Doubly_Linked_Lists with modifications to make this package -- compatible with the ZFP profiles and also compatible with AUnit's memory -- management. -- Some Ada2005 constructs have also been removed so that user tests can be -- compiled in Ada95. generic type Element_Type is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada_Containers.AUnit_Lists is type List is tagged limited private; type Cursor is private; -- Empty_List : constant List; No_Element : constant Cursor; function "=" (Left, Right : List) return Boolean; function Length (Container : List) return Count_Type; function Is_Empty (Container : List) return Boolean; procedure Clear (Container : in out List); function Element (Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out List; Position : Cursor; New_Item : Element_Type); -- procedure Query_Element -- (Position : Cursor; -- Process : not null access procedure (Element : Element_Type)); -- procedure Update_Element -- (Container : in out List; -- Position : Cursor; -- Process : not null access procedure (Element : in out Element_Type)); procedure Move (Target : in out List; Source : in out List); procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1); procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1); procedure Insert (Container : in out List; Before : Cursor; Position : out Cursor; Count : Count_Type := 1); procedure Prepend (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1); procedure Append (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1); procedure Delete (Container : in out List; Position : in out Cursor; Count : Count_Type := 1); procedure Delete_First (Container : in out List; Count : Count_Type := 1); procedure Delete_Last (Container : in out List; Count : Count_Type := 1); procedure Reverse_Elements (Container : in out List); procedure Swap (Container : in out List; I, J : Cursor); procedure Swap_Links (Container : in out List; I, J : Cursor); procedure Splice (Target : in out List; Before : Cursor; Source : in out List); procedure Splice (Target : in out List; Before : Cursor; Source : in out List; Position : in out Cursor); procedure Splice (Container : in out List; Before : Cursor; Position : Cursor); function First (Container : List) return Cursor; function First_Element (Container : List) return Element_Type; function Last (Container : List) return Cursor; function Last_Element (Container : List) return Element_Type; function Next (Position : Cursor) return Cursor; procedure Next (Position : in out Cursor); function Previous (Position : Cursor) return Cursor; procedure Previous (Position : in out Cursor); function Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Reverse_Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Contains (Container : List; Item : Element_Type) return Boolean; function Has_Element (Position : Cursor) return Boolean; type Iterator is access procedure (Position : Cursor); procedure Iterate (Container : List; Process : Iterator); -- procedure Reverse_Iterate -- (Container : List; -- Process : not null access procedure (Position : Cursor)); generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting is function Is_Sorted (Container : List) return Boolean; procedure Sort (Container : in out List); procedure Merge (Target, Source : in out List); end Generic_Sorting; private pragma Inline (Next); pragma Inline (Previous); type Node_Type; type Node_Access is access Node_Type; pragma No_Strict_Aliasing (Node_Access); type Node_Type is limited record Element : Element_Type; Next : Node_Access; Prev : Node_Access; end record; type List is tagged limited record First : Node_Access := null; Last : Node_Access := null; Length : Count_Type := 0; Busy : Natural := 0; Lock : Natural := 0; end record; type List_Access is access constant List; type Cursor is record Container : List_Access; Node : Node_Access; end record; -- Empty_List : constant List := (Controlled with null, null, 0, 0, 0); No_Element : constant Cursor := (null, null); end Ada_Containers.AUnit_Lists; aunit-21.0.0.fa386849/include/aunit/reporters/0000755000175000017500000000000013740342126020441 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/reporters/aunit-reporter-text.adb0000644000175000017500000002176313740342126025064 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R . T E X T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.IO; use AUnit.IO; with AUnit.Time_Measure; use AUnit.Time_Measure; -- Very simple reporter to console package body AUnit.Reporter.Text is procedure Indent (File : File_Type; N : Natural); -- Print N indentations to output procedure Dump_Result_List (File : File_Type; L : Result_Lists.List; Prefix : String); -- Dump a result list procedure Put_Measure is new Gen_Put_Measure; -- Output elapsed time procedure Report_Test (File : File_Type; Test : Test_Result; Prefix : String); -- Report a single assertion failure or unexpected exception generic with procedure Get (R : Result; L : in out Result_Lists.List); Label : String; Color : String; procedure Report_Tests (Engine : Text_Reporter; R : Result'Class; File : File_Type); -- Report a series of tests ANSI_Def : constant String := ASCII.ESC & "[0m"; ANSI_Green : constant String := ASCII.ESC & "[32m"; ANSI_Purple : constant String := ASCII.ESC & "[35m"; ANSI_Red : constant String := ASCII.ESC & "[31m"; ------------------------- -- Set_Use_ANSI_Colors -- ------------------------- procedure Set_Use_ANSI_Colors (Engine : in out Text_Reporter; Value : Boolean) is begin Engine.Use_ANSI := Value; end Set_Use_ANSI_Colors; ------------ -- Indent -- ------------ procedure Indent (File : File_Type; N : Natural) is begin for J in 1 .. N loop Put (File, " "); end loop; end Indent; ---------------------- -- Dump_Result_List -- ---------------------- procedure Dump_Result_List (File : File_Type; L : Result_Lists.List; Prefix : String) is use Result_Lists; C : Cursor := First (L); begin if Has_Element (C) then New_Line (File); end if; -- Note: can't use Iterate because it violates restriction -- No_Implicit_Dynamic_Code while Has_Element (C) loop Report_Test (File, Element (C), Prefix); Next (C); end loop; end Dump_Result_List; --------- -- Get -- --------- procedure Report_Tests (Engine : Text_Reporter; R : Result'Class; File : File_Type) is S : Result_Lists.List; begin Get (Result (R), S); if Engine.Use_ANSI then Put (File, Color); end if; Dump_Result_List (File, S, Label); if Engine.Use_ANSI then Put (File, ANSI_Def); end if; end Report_Tests; --------------------- -- Report_OK_Tests -- --------------------- procedure Report_OK_Tests (Engine : Text_Reporter; R : Result'Class) is procedure Internal is new Report_Tests (Successes, "OK", ANSI_Green); begin Internal (Engine, R, Engine.File.all); end Report_OK_Tests; procedure Report_Fail_Tests (Engine : Text_Reporter; R : Result'Class) is procedure Internal is new Report_Tests (Failures, "FAIL", ANSI_Purple); begin Internal (Engine, R, Engine.File.all); end Report_Fail_Tests; procedure Report_Error_Tests (Engine : Text_Reporter; R : Result'Class) is procedure Internal is new Report_Tests (Errors, "ERROR", ANSI_Red); begin Internal (Engine, R, Engine.File.all); end Report_Error_Tests; ------------ -- Report -- ------------ procedure Report (Engine : Text_Reporter; R : Result'Class; Options : AUnit_Options := Default_Options) is File : File_Type renames Engine.File.all; S_Count : constant Integer := Integer (Success_Count (R)); F_Count : constant Integer := Integer (Failure_Count (R)); E_Count : constant Integer := Integer (Error_Count (R)); T : AUnit_Duration; begin if Options.Report_Successes then Report_OK_Tests (Text_Reporter'Class (Engine), R); end if; Report_Fail_Tests (Text_Reporter'Class (Engine), R); Report_Error_Tests (Text_Reporter'Class (Engine), R); New_Line (File); Put (File, "Total Tests Run: "); Put (File, Integer (Test_Count (R)), 0); New_Line (File); Put (File, "Successful Tests: "); Put (File, S_Count, 0); New_Line (File); Put (File, "Failed Assertions: "); Put (File, F_Count, 0); New_Line (File); Put (File, "Unexpected Errors: "); Put (File, E_Count, 0); New_Line (File); if Elapsed (R) /= Time_Measure.Null_Time then T := Get_Measure (Elapsed (R)); Put (File, "Cumulative Time: "); Put_Measure (File, T); Put_Line (File, " seconds"); end if; end Report; ----------------- -- Report_Test -- ----------------- procedure Report_Test (File : File_Type; Test : Test_Result; Prefix : String) is T : AUnit_Duration; begin Put (File, Prefix); Put (File, " "); Put (File, Test.Test_Name.all); if Test.Routine_Name /= null then Put (File, " : "); Put (File, Test.Routine_Name.all); end if; if Test.Elapsed /= Time_Measure.Null_Time then Put (File, " (in "); T := Get_Measure (Test.Elapsed); Put_Measure (File, T); Put (File, ")"); end if; New_Line (File); if Test.Failure /= null then Indent (File, 1); Put_Line (File, Test.Failure.Message.all); Indent (File, 1); Put (File, "at "); Put (File, Test.Failure.Source_Name.all); Put (File, ":"); Put (File, Integer (Test.Failure.Line), 0); New_Line (File); elsif Test.Error /= null then Indent (File, 1); Put_Line (File, Test.Error.Exception_Name.all); if Test.Error.Exception_Message /= null then Indent (File, 1); Put (File, "Exception Message: "); Put_Line (File, Test.Error.Exception_Message.all); end if; if Test.Error.Traceback /= null then Indent (File, 1); Put_Line (File, "Traceback:"); declare From, To : Natural := Test.Error.Traceback'First; begin while From <= Test.Error.Traceback'Last loop To := From; while To <= Test.Error.Traceback'Last and then Test.Error.Traceback (To) /= ASCII.LF loop To := To + 1; end loop; Indent (File, 2); Put_Line (File, Test.Error.Traceback (From .. To - 1)); From := To + 1; end loop; end; end if; New_Line (File); end if; end Report_Test; end AUnit.Reporter.Text; aunit-21.0.0.fa386849/include/aunit/reporters/aunit-reporter-xml.ads0000644000175000017500000000516213740342126024714 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R . X M L -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2013, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Very simple reporter to console package AUnit.Reporter.XML is type XML_Reporter is new Reporter with null record; procedure Report (Engine : XML_Reporter; R : Result'Class; Options : AUnit_Options := Default_Options); end AUnit.Reporter.XML; aunit-21.0.0.fa386849/include/aunit/reporters/aunit-reporter-xml.adb0000644000175000017500000001747513740342126024705 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R . X M L -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada_Containers; use Ada_Containers; with AUnit.IO; use AUnit.IO; with AUnit.Time_Measure; use AUnit.Time_Measure; -- Very simple reporter to console package body AUnit.Reporter.XML is procedure Dump_Result_List (File : File_Type; L : Result_Lists.List); -- List failed assertions procedure Put_Measure is new Gen_Put_Measure; -- Output elapsed time procedure Report_Test (File : File_Type; Test : Test_Result); -- Report a single assertion failure or unexpected exception ---------------------- -- Dump_Result_List -- ---------------------- procedure Dump_Result_List (File : File_Type; L : Result_Lists.List) is use Result_Lists; C : Cursor := First (L); begin -- Note: can't use Iterate because it violates restriction -- No_Implicit_Dynamic_Code while Has_Element (C) loop Report_Test (File, Element (C)); Next (C); end loop; end Dump_Result_List; ------------ -- Report -- ------------ procedure Report (Engine : XML_Reporter; R : Result'Class; Options : AUnit_Options := Default_Options) is T : AUnit_Duration; File : File_Type renames Engine.File.all; begin Put_Line (File, ""); Put (File, ""); else Put_Line (File, ">"); end if; Put_Line (File, " "); Put (File, " "); Put (File, Integer (Test_Count (R)), 0); Put_Line (File, ""); Put (File, " "); Put (File, Integer (Failure_Count (R) + Error_Count (R)), 0); Put_Line (File, ""); Put (File, " "); Put (File, Integer (Failure_Count (R)), 0); Put_Line (File, ""); Put (File, " "); Put (File, Integer (Error_Count (R)), 0); Put_Line (File, ""); Put_Line (File, " "); declare S : Result_Lists.List; begin Put_Line (File, " "); if Options.Report_Successes then Successes (R, S); Dump_Result_List (File, S); end if; Put_Line (File, " "); end; Put_Line (File, " "); declare F : Result_Lists.List; begin Failures (R, F); Dump_Result_List (File, F); end; declare E : Result_Lists.List; begin Errors (R, E); Dump_Result_List (File, E); end; Put_Line (File, " "); Put_Line (File, ""); end Report; ------------------ -- Report_Error -- ------------------ procedure Report_Test (File : File_Type; Test : Test_Result) is Is_Assert : Boolean; T : AUnit_Duration; begin Put (File, " "); else Put_Line (File, ">"); end if; Put (File, " "); Put (File, Test.Test_Name.all); if Test.Routine_Name /= null then Put (File, " : "); Put (File, Test.Routine_Name.all); end if; Put_Line (File, ""); if Test.Failure /= null or else Test.Error /= null then if Test.Failure /= null then Is_Assert := True; else Is_Assert := False; end if; Put (File, " "); if Is_Assert then Put (File, "Assertion"); else Put (File, "Error"); end if; Put_Line (File, ""); Put (File, " "); if Is_Assert then Put (File, Test.Failure.Message.all); else Put (File, Test.Error.Exception_Name.all); end if; Put_Line (File, ""); if Is_Assert then Put_Line (File, " "); Put (File, " "); Put (File, Test.Failure.Source_Name.all); Put_Line (File, ""); Put (File, " "); Put (File, Integer (Test.Failure.Line), 0); Put_Line (File, ""); Put_Line (File, " "); else Put_Line (File, " "); Put (File, " "); Put (File, Test.Error.Exception_Name.all); Put_Line (File, ""); if Test.Error.Exception_Message /= null then Put (File, " "); Put (File, Test.Error.Exception_Message.all); Put_Line (File, ""); end if; if Test.Error.Traceback /= null then Put (File, " "); Put (File, Test.Error.Traceback.all); Put_Line (File, ""); end if; Put_Line (File, " "); end if; end if; Put_Line (File, " "); end Report_Test; end AUnit.Reporter.XML; aunit-21.0.0.fa386849/include/aunit/reporters/aunit-reporter-gnattest.ads0000644000175000017500000000525313740342126025746 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R . G N A T T E S T -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2012-2013, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Reporter intended to be used by test drivers generated by gnattest. package AUnit.Reporter.GNATtest is type GNATtest_Reporter is new Reporter with null record; procedure Report (Engine : GNATtest_Reporter; R : Result'Class; Options : AUnit_Options := Default_Options); end AUnit.Reporter.GNATtest; aunit-21.0.0.fa386849/include/aunit/reporters/aunit-reporter-text.ads0000644000175000017500000000711013740342126025073 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R . T E X T -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2013, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Very simple reporter to console package AUnit.Reporter.Text is type Text_Reporter is new Reporter with private; procedure Set_Use_ANSI_Colors (Engine : in out Text_Reporter; Value : Boolean); -- Setting this value will enable colors output on an ANSI compatible -- terminal. -- By default, no color is used. procedure Report (Engine : Text_Reporter; R : Result'Class; Options : AUnit_Options := Default_Options); procedure Report_OK_Tests (Engine : Text_Reporter; R : Result'Class); procedure Report_Fail_Tests (Engine : Text_Reporter; R : Result'Class); procedure Report_Error_Tests (Engine : Text_Reporter; R : Result'Class); -- These subprograms implement the various parts of the Report. You -- can therefore chose in which order to report the various categories, -- and whether or not to report them. -- After calling any of these, the list of results has been modified in -- R, so you should get the counts first. private type Text_Reporter is new Reporter with record Use_ANSI : Boolean := False; end record; end AUnit.Reporter.Text; aunit-21.0.0.fa386849/include/aunit/reporters/aunit-reporter-gnattest.adb0000644000175000017500000002141013740342126025716 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R . G N A T T E S T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2012-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.IO; use AUnit.IO; with AUnit.Time_Measure; use AUnit.Time_Measure; -- Reporter intended to be used by test drivers generated by gnattest. package body AUnit.Reporter.GNATtest is procedure Dump_Result_List (File : File_Type; L : Result_Lists.List); -- List failed assertions procedure Report_Test (File : File_Type; Test : Test_Result); -- Report a single assertion failure or unexpected exception procedure Put_Measure is new Gen_Put_Measure_In_Seconds; -- Output elapsed time procedure Indent (File : File_Type; N : Natural); -- Print N indentations to output ------------------------ -- Dump_Result_List -- ------------------------ procedure Dump_Result_List (File : File_Type; L : Result_Lists.List) is use Result_Lists; C : Cursor := First (L); begin -- Note: can't use Iterate because it violates restriction -- No_Implicit_Dynamic_Code while Has_Element (C) loop Report_Test (File, Element (C)); Next (C); end loop; end Dump_Result_List; ------------ -- Indent -- ------------ procedure Indent (File : File_Type; N : Natural) is begin for J in 1 .. N loop Put (File, " "); end loop; end Indent; ------------ -- Report -- ------------ procedure Report (Engine : GNATtest_Reporter; R : Result'Class; Options : AUnit_Options := Default_Options) is File : File_Type renames Engine.File.all; Failures_Count : Integer; Crashes_Count : Integer; Passed_Count : Integer; Tests_Count : Integer; begin Tests_Count := Integer (Test_Count (R)); Crashes_Count := Integer (Error_Count (R)); Passed_Count := Integer (Success_Count (R)); Failures_Count := Tests_Count - (Passed_Count + Crashes_Count); if Options.Report_Successes then declare S : Result_Lists.List; begin Successes (R, S); Dump_Result_List (File, S); end; end if; declare F : Result_Lists.List; begin Failures (R, F); Dump_Result_List (File, F); end; declare E : Result_Lists.List; begin Errors (R, E); Dump_Result_List (File, E); end; Put (File, Tests_Count, 0); Put (File, " tests run: "); Put (File, Passed_Count, 0); Put (File, " passed; "); Put (File, Failures_Count, 0); Put (File, " failed; "); Put (File, Crashes_Count, 0); Put_Line (File, " crashed."); end Report; ------------------ -- Report_Test -- ------------------ procedure Report_Test (File : File_Type; Test : Test_Result) is Is_Assert : Boolean; Is_Condition : Boolean := False; T : AUnit_Duration; N : Integer; begin Put (File, Test.Test_Name.all); if Test.Failure /= null or else Test.Error /= null then if Test.Failure /= null then Is_Assert := True; else Is_Assert := False; end if; if Is_Assert then Put (File, " error: corresponding test FAILED: "); else Put (File, " error: corresponding test CRASHED: "); end if; if Is_Assert then if Test.Failure.Message'Length > 9 then N := Test.Failure.Message'First; if Test.Failure.Message.all (N .. N + 8) = "req_sloc(" or else Test.Failure.Message.all (N .. N + 8) = "ens_sloc(" then for I in N + 9 .. Test.Failure.Message'Last - 2 loop if Test.Failure.Message.all (I + 1 .. I + 2) = "):" then Put (File, Test.Failure.Message.all (I + 3 .. Test.Failure.Message'Last)); Put (File, " ("); Put (File, Test.Failure.Message.all (N + 9 .. I)); Put_Line (File, ")"); Is_Condition := True; exit; end if; end loop; end if; end if; if not Is_Condition then Put (File, Test.Failure.Message.all); Put (File, " ("); Put (File, Test.Failure.Source_Name.all); Put (File, ":"); Put (File, Integer (Test.Failure.Line), 0); Put (File, ")"); end if; if Test.Elapsed /= Time_Measure.Null_Time then Put (File, " ("); T := Get_Measure (Test.Elapsed); Put_Measure (File, T); Put (File, ")"); end if; New_Line (File); else Put (File, Test.Error.Exception_Name.all); if Test.Error.Exception_Message /= null then Put (File, " : "); Put (File, Test.Error.Exception_Message.all); end if; if Test.Elapsed /= Time_Measure.Null_Time then Put (File, " ("); T := Get_Measure (Test.Elapsed); Put_Measure (File, T); Put (File, ")"); end if; New_Line (File); if Test.Error.Traceback /= null then Put_Line (File, " Traceback:"); declare From, To : Natural := Test.Error.Traceback'First; begin while From <= Test.Error.Traceback'Last loop To := From; while To <= Test.Error.Traceback'Last and then Test.Error.Traceback (To) /= ASCII.LF loop To := To + 1; end loop; Indent (File, 2); Put_Line (File, Test.Error.Traceback (From .. To - 1)); From := To + 1; end loop; end; end if; end if; else Put (File, " info: corresponding test PASSED"); if Test.Elapsed /= Time_Measure.Null_Time then Put (File, " ("); T := Get_Measure (Test.Elapsed); Put_Measure (File, T); Put (File, ")"); end if; New_Line (File); end if; end Report_Test; end AUnit.Reporter.GNATtest; aunit-21.0.0.fa386849/include/aunit/framework/0000755000175000017500000000000013740342126020411 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/staticmemory/0000755000175000017500000000000013530730011023120 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/staticmemory/aunit-memory.adb0000644000175000017500000000730713530730011026225 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A U N I T . M E M O R Y -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2003 Free Software Foundation, Inc. -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Dummy implementation. with System.Storage_Elements; with Unchecked_Conversion; package body AUnit.Memory is package SSE renames System.Storage_Elements; Default_Size : constant := 100 * 1_024; type Mark_Id is new SSE.Integer_Address; type Memory is array (Mark_Id range <>) of SSE.Storage_Element; for Memory'Alignment use Standard'Maximum_Alignment; Mem : Memory (1 .. Default_Size); Top : Mark_Id := Mem'First; function To_Mark_Id is new Unchecked_Conversion (size_t, Mark_Id); ----------- -- Alloc -- ----------- function AUnit_Alloc (Size : size_t) return System.Address is Max_Align : constant Mark_Id := Mark_Id (Standard'Maximum_Alignment); Max_Size : Mark_Id := ((To_Mark_Id (Size) + Max_Align - 1) / Max_Align) * Max_Align; Location : constant Mark_Id := Top; begin if Max_Size = 0 then Max_Size := Max_Align; end if; if Size = size_t'Last then raise Storage_Error; end if; Top := Top + Max_Size; if Top > Default_Size then raise Storage_Error; end if; return Mem (Location)'Address; end AUnit_Alloc; ---------- -- Free -- ---------- procedure AUnit_Free (Obj : System.Address) is pragma Unreferenced (Obj); begin null; end AUnit_Free; end AUnit.Memory; aunit-21.0.0.fa386849/include/aunit/framework/staticmemory/aunit-memory-utils.adb0000644000175000017500000000562413530730011027363 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . M E M O R Y . U T I L S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; package body AUnit.Memory.Utils is --------------- -- Gen_Alloc -- --------------- function Gen_Alloc return Name is function To_Name is new Ada.Unchecked_Conversion (System.Address, Name); Ret : constant System.Address := AUnit_Alloc (Object'Object_Size / 8); -- Declare an actual object at Ret Address so that the default -- initialisation is performed. Obj : Object; for Obj'Address use Ret; pragma Warnings (Off, Obj); begin return To_Name (Ret); end Gen_Alloc; end AUnit.Memory.Utils; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_cases-registration.adb0000644000175000017500000000604513530730011027040 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S . R E G I S T R A T I O N -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2017, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Test routine registration separate (AUnit.Test_Cases) package body Registration is ---------------------- -- Register_Routine -- ---------------------- procedure Register_Routine (Test : in out Test_Case'Class; Routine : Test_Routine; Name : String) is Formatted_Name : constant Message_String := Format (Name); Val : Routine_Spec; begin Val := (Routine, Formatted_Name); Add_Routine (Test, Val); end Register_Routine; ------------------- -- Routine_Count -- ------------------- function Routine_Count (Test : Test_Case'Class) return Count_Type is begin return Routine_Lists.Length (Test.Routines); end Routine_Count; end Registration; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_caller.adb0000644000175000017500000001045613530730011024475 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A L L E R -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with AUnit.Assertions; with AUnit.Memory.Utils; package body AUnit.Test_Caller is function New_Fixture is new AUnit.Memory.Utils.Gen_Alloc (Test_Fixture, Fixture_Access); The_Fixture_Object : constant Fixture_Access := New_Fixture; ------------ -- Create -- ------------ procedure Create (TC : out Test_Case'Class; Name : String; Test : Test_Method) is begin TC.Name := Format (Name); TC.Method := Test; TC.Fixture := The_Fixture_Object; end Create; ------------ -- Create -- ------------ function Create (Name : String; Test : Test_Method) return Test_Case_Access is type Access_Type is access all Test_Case; function Alloc is new AUnit.Memory.Utils.Gen_Alloc (Test_Case, Access_Type); function Convert is new Ada.Unchecked_Conversion (Access_Type, Test_Case_Access); Ret : constant Test_Case_Access := Convert (Alloc); begin Create (Ret.all, Name, Test); return Ret; end Create; ---------- -- Name -- ---------- function Name (Test : Test_Case) return Message_String is begin return Test.Name; end Name; -------------- -- Run_Test -- -------------- procedure Run_Test (Test : in out Test_Case) is begin -- Before running the fixture's method, we need to make sure that -- the test Ids correspond so that a failure reported via Fixture is -- correctly understood as being part of Test. AUnit.Assertions.Copy_Id (Test, Test.Fixture.all); Test.Method (Test_Fixture (Test.Fixture.all)); end Run_Test; ------------ -- Set_Up -- ------------ procedure Set_Up (Test : in out Test_Case) is begin Set_Up (Test.Fixture.all); end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (Test : in out Test_Case) is begin Tear_Down (Test.Fixture.all); end Tear_Down; end AUnit.Test_Caller; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_caller.ads0000644000175000017500000001204313530730011024510 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A L L E R -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- -- A Test caller provides access to a test case type based on a test fixture. -- Test callers are useful when you want to run individual test or add it to -- a suite. -- Test callers invoke only one Test (i.e. test method) on one Fixture of a -- AUnit.Test_Fixtures.Test_Fixture. -- -- Here is an example: -- -- -- package Math_Test is -- Type Test is new AUnit.Test_Fixtures.Test_Fixture with record -- M_Value1 : Integer; -- M_Value2 : Integer; -- end record; -- -- procedure Set_Up (T : in out Test); -- -- procedure Test_Addition (T : in out Test); -- procedure Test_Subtraction (T : in out Test); -- -- end Math_Test; -- -- function Suite return AUnit.Test_Suites.Test_Suite_Access is -- package Caller is new AUnit.Test_Caller (Math_Test.Test); -- The_Suite : AUnit.Test_Suites.Test_Suite_Access := -- new AUnit.Test_Suites.Test_Suite; -- begin -- The_Suite.Add_Test -- (Caller.Create ("Test Addition on integers", -- Math_Test.Test_Addition'Access)); -- The_Suite.Add_Test -- (Caller.Create ("Test Subtraction on integers", -- Math_Test.Test_Subtraction'Access)); -- return The_Suite; -- end Suite; -- -- with AUnit.Simple_Test_Cases; with AUnit.Test_Fixtures; generic type Test_Fixture is new AUnit.Test_Fixtures.Test_Fixture with private; package AUnit.Test_Caller is type Test_Case is new AUnit.Simple_Test_Cases.Test_Case with private; type Test_Case_Access is access all Test_Case'Class; type Test_Method is access procedure (Test : in out Test_Fixture); function Create (Name : String; Test : Test_Method) return Test_Case_Access; -- Return a test case from a test fixture method, reporting the result -- of the test using the Name parameter. procedure Create (TC : out Test_Case'Class; Name : String; Test : Test_Method); -- Initialize a test case from a test fixture method, reporting the result -- of the test using the Name parameter. function Name (Test : Test_Case) return Message_String; -- Test case name procedure Run_Test (Test : in out Test_Case); -- Perform the test. procedure Set_Up (Test : in out Test_Case); -- Set up performed before each test case procedure Tear_Down (Test : in out Test_Case); -- Tear down performed after each test case private type Fixture_Access is access all Test_Fixture; pragma No_Strict_Aliasing (Fixture_Access); type Test_Case is new AUnit.Simple_Test_Cases.Test_Case with record Fixture : Fixture_Access; Name : Message_String; Method : Test_Method; end record; end AUnit.Test_Caller; aunit-21.0.0.fa386849/include/aunit/framework/aunit-run.ads0000644000175000017500000000716713530730011023026 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R U N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2006-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.Options; with AUnit.Reporter; with AUnit.Test_Results; with AUnit.Test_Suites; -- Framework using text reporter package AUnit.Run is generic with function Suite return AUnit.Test_Suites.Access_Test_Suite; procedure Test_Runner (Reporter : AUnit.Reporter.Reporter'Class; Options : AUnit.Options.AUnit_Options := AUnit.Options.Default_Options); generic with function Suite return AUnit.Test_Suites.Access_Test_Suite; procedure Test_Runner_With_Results (Reporter : AUnit.Reporter.Reporter'Class; Results : in out AUnit.Test_Results.Result'Class; Options : AUnit.Options.AUnit_Options := AUnit.Options.Default_Options); -- In this version, you can pass your own Result class. In particular, this -- can be used to extend the Result type so that for instance you can -- output information every time a test passed or fails. -- Results is not cleared before running the tests, this is your -- responsibility, so that you can for instance cumulate results as needed. generic with function Suite return AUnit.Test_Suites.Access_Test_Suite; function Test_Runner_With_Status (Reporter : AUnit.Reporter.Reporter'Class; Options : AUnit.Options.AUnit_Options := AUnit.Options.Default_Options) return Status; end AUnit.Run; aunit-21.0.0.fa386849/include/aunit/framework/aunit-tests.ads0000644000175000017500000000512313530730011023352 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ -- Base Test Case or Test Suite -- -- This base type allows composition of both test cases and sub-suites into a -- test suite (Composite pattern) package AUnit.Tests is type Test is abstract tagged limited private; type Test_Access is access all Test'Class; private type Test is abstract tagged limited null record; end AUnit.Tests; aunit-21.0.0.fa386849/include/aunit/framework/aunit-reporter.ads0000644000175000017500000000602313740342126024063 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.IO; with AUnit.Options; use AUnit.Options; with AUnit.Test_Results; use AUnit.Test_Results; package AUnit.Reporter is type Reporter is abstract tagged private; procedure Set_File (Engine : in out Reporter; Value : AUnit.IO.File_Access); procedure Report (Engine : Reporter; R : Result'Class; Options : AUnit_Options := Default_Options) is abstract; -- This procedure is called by AUnit.Run to report the result after running -- the whole testsuite (or the selected subset of tests). private type Reporter is abstract tagged record File : AUnit.IO.File_Access := AUnit.IO.Standard_Output; end record; end AUnit.Reporter; aunit-21.0.0.fa386849/include/aunit/framework/nativememory/0000755000175000017500000000000013530730011023117 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/nativememory/aunit-memory.adb0000644000175000017500000000571213530730011026222 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A U N I T . M E M O R Y -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2003 Free Software Foundation, Inc. -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Memory allocation implementation using the gnat runtime methods. package body AUnit.Memory is ----------- -- Alloc -- ----------- function AUnit_Alloc (Size : size_t) return System.Address is function RT_Malloc (Size : size_t) return System.Address; pragma Import (C, RT_Malloc, "__gnat_malloc"); begin return RT_Malloc (Size); end AUnit_Alloc; ---------- -- Free -- ---------- procedure AUnit_Free (Obj : System.Address) is procedure RT_Free (Obj : System.Address); pragma Import (C, RT_Free, "__gnat_free"); begin RT_Free (Obj); end AUnit_Free; end AUnit.Memory; aunit-21.0.0.fa386849/include/aunit/framework/nativememory/aunit-memory-utils.adb0000644000175000017500000000502313530730011027353 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . M E M O R Y . U T I L S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ package body AUnit.Memory.Utils is --------------- -- Gen_Alloc -- --------------- function Gen_Alloc return Name is begin return new Object; end Gen_Alloc; end AUnit.Memory.Utils; aunit-21.0.0.fa386849/include/aunit/framework/aunit-simple_test_cases.adb0000644000175000017500000001044213530730011025675 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . S I M P L E _ T E S T _ C A S E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.Assertions; use AUnit.Assertions; with AUnit.Options; use AUnit.Options; with AUnit.Test_Filters; use AUnit.Test_Filters; package body AUnit.Simple_Test_Cases is procedure Run_Routine (Test : access Test_Case'Class; Options : AUnit_Options; R : in out Result'Class; Outcome : out Status); -- Run one test routine ----------------- -- Run_Routine -- ----------------- procedure Run_Routine (Test : access Test_Case'Class; Options : AUnit_Options; R : in out Result'Class; Outcome : out Status) is separate; ------------------ -- Routine_Name -- ------------------ function Routine_Name (Test : Test_Case) return Message_String is pragma Unreferenced (Test); begin return null; end Routine_Name; ------------ -- Set_Up -- ------------ procedure Set_Up (Test : in out Test_Case) is pragma Unreferenced (Test); begin null; end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (Test : in out Test_Case) is pragma Unreferenced (Test); begin null; end Tear_Down; --------- -- Run -- --------- procedure Run (Test : access Test_Case; Options : AUnit_Options; R : in out Result'Class; Outcome : out Status) is Old : constant Test_Access := AUnit.Assertions.Current_Test; begin Outcome := Success; if Options.Filter = null or else Is_Active (Options.Filter.all, Test.all) then AUnit.Assertions.Set_Current_Test (Test_Access (Test)); Init_Test (Test.all); Start_Test (R, 1); -- Run test routine Set_Up (Test_Case'Class (Test.all)); Run_Routine (Test, Options, R, Outcome); Tear_Down (Test_Case'Class (Test.all)); AUnit.Assertions.Set_Current_Test (Old); end if; end Run; end AUnit.Simple_Test_Cases; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_filters.ads0000644000175000017500000000762113530730011024724 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ F I L T E R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2009-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ -- An instance of a test filter. -- This can be created from command line arguments, for instance, so that -- users can decide to run specific tests only, as opposed to the whole -- test suite. with AUnit.Tests; package AUnit.Test_Filters is type Test_Filter is abstract tagged limited private; type Test_Filter_Access is access all Test_Filter'Class; function Is_Active (Filter : Test_Filter; T : AUnit.Tests.Test'Class) return Boolean is abstract; -- Whether we should run the given test. If this function returns False, -- the test is not run. type Name_Filter is new Test_Filter with private; -- A filter based on the name of the test and/or routine. procedure Set_Name (Filter : in out Name_Filter; Name : String); -- Set the name of the test(s) to run. -- The name can take several forms: -- * Either the fully qualified name of the test (including routine). -- For instance, if you have an instance of -- AUnit.Test_Cases.Test_Case, the name could be: -- Name (Test) & " : " & Routine_Name (Test) -- * Or a partial name, that matches the start of the test_name. With -- the example above, you could chose to omit the routine_name to run -- all routines for instance -- If the name is the empty string, all tests will be run function Is_Active (Filter : Name_Filter; T : AUnit.Tests.Test'Class) return Boolean; -- See inherited documentation private type Test_Filter is abstract tagged limited null record; type Name_Filter is new Test_Filter with record Name : Message_String; end record; end AUnit.Test_Filters; aunit-21.0.0.fa386849/include/aunit/framework/aunit-run.adb0000644000175000017500000001153513530730011022777 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R U N -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2006-2013, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.Time_Measure; with AUnit.Test_Suites; use AUnit.Test_Suites; package body AUnit.Run is procedure Run (Suite : Access_Test_Suite; Results : in out Test_Results.Result'Class; Options : AUnit.Options.AUnit_Options; Reporter : AUnit.Reporter.Reporter'Class; Outcome : out Status); -- Run a specific testsuite and return its status --------- -- Run -- --------- procedure Run (Suite : Access_Test_Suite; Results : in out Test_Results.Result'Class; Options : AUnit.Options.AUnit_Options; Reporter : AUnit.Reporter.Reporter'Class; Outcome : out Status) is Time : Time_Measure.Time; begin if Options.Global_Timer then Time_Measure.Start_Measure (Time); end if; pragma Warnings (Off); AUnit.Test_Suites.Run (Suite, Options, Results, Outcome); pragma Warnings (On); if Options.Global_Timer then Time_Measure.Stop_Measure (Time); Test_Results.Set_Elapsed (Results, Time); end if; AUnit.Reporter.Report (Reporter, Results, Options); end Run; ----------------- -- Test_Runner -- ----------------- procedure Test_Runner (Reporter : AUnit.Reporter.Reporter'Class; Options : AUnit.Options.AUnit_Options := AUnit.Options.Default_Options) is Results : Test_Results.Result; Outcome : Status; pragma Unreferenced (Outcome); begin Test_Results.Clear (Results); Run (Suite, Results, Options, Reporter, Outcome); end Test_Runner; ----------------------------- -- Test_Runner_With_Status -- ----------------------------- function Test_Runner_With_Status (Reporter : AUnit.Reporter.Reporter'Class; Options : AUnit.Options.AUnit_Options := AUnit.Options.Default_Options) return Status is Results : Test_Results.Result; Outcome : Status; begin Test_Results.Clear (Results); Run (Suite, Results, Options, Reporter, Outcome); return Outcome; end Test_Runner_With_Status; ------------------------------ -- Test_Runner_With_Results -- ------------------------------ procedure Test_Runner_With_Results (Reporter : AUnit.Reporter.Reporter'Class; Results : in out AUnit.Test_Results.Result'Class; Options : AUnit.Options.AUnit_Options := AUnit.Options.Default_Options) is Outcome : Status; pragma Unreferenced (Outcome); begin Run (Suite, Results, Options, Reporter, Outcome); end Test_Runner_With_Results; end AUnit.Run; aunit-21.0.0.fa386849/include/aunit/framework/aunit-assertions.adb0000644000175000017500000001566413530730011024374 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . A S S E R T I O N S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ package body AUnit.Assertions is Failures : Failure_Lists.List; -- ??? Calls to Failures should be protected, so that we can use -- multitasking Current_Id : Test_Id := 1; procedure Init_Test (T : in out Test) is begin if T.Id = Null_Id then T.Id := Current_Id; Current_Id := Current_Id + 1; end if; end Init_Test; The_Current_Test : Test_Access := null; ------------ -- Assert -- ------------ procedure Assert (Condition : Boolean; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) is begin if not Assert (Condition, Message, Source, Line) then raise Assertion_Error; end if; end Assert; ------------ -- Assert -- ------------ function Assert (Condition : Boolean; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) return Boolean is begin if not Condition then Failure_Lists.Append (Failures, (Failure => (Format (Message), Format (Source), Line), Id => The_Current_Test.Id)); end if; return Condition; end Assert; ---------------------- -- Assert_Exception -- ---------------------- procedure Assert_Exception (Proc : Throwing_Exception_Proc; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) is separate; ------------ -- Assert -- ------------ procedure Assert (Actual : String; Expected : String; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) is begin if Actual /= Expected then Assert (False, Message & " - got '" & Actual & "', expecting '" & Expected & "'", Source, Line); end if; end Assert; -------------------- -- Clear_Failures -- -------------------- procedure Clear_Failures (T : Test) is C, N : Failure_Lists.Cursor; begin C := Failure_Lists.First (Failures); while Failure_Lists.Has_Element (C) loop N := Failure_Lists.Next (C); if Failure_Lists.Element (C).Id = T.Id then Failure_Lists.Delete (Failures, C); end if; C := N; end loop; end Clear_Failures; ------------------ -- Has_Failures -- ------------------ function Has_Failures (T : Test) return Boolean is begin return Has_Failure (First_Failure (T)); end Has_Failures; ------------------- -- First_Failure -- ------------------- function First_Failure (T : Test) return Failure_Iter is C : Failure_Lists.Cursor; begin C := Failure_Lists.First (Failures); while Failure_Lists.Has_Element (C) loop if Failure_Lists.Element (C).Id = T.Id then return Failure_Iter (C); end if; Failure_Lists.Next (C); end loop; return Failure_Iter (Failure_Lists.No_Element); end First_Failure; ----------------- -- Has_Failure -- ----------------- function Has_Failure (I : Failure_Iter) return Boolean is begin return Failure_Lists.Has_Element (Failure_Lists.Cursor (I)); end Has_Failure; function Get_Failure (I : Failure_Iter) return AUnit.Test_Results.Test_Failure is begin return Failure_Lists.Element (Failure_Lists.Cursor (I)).Failure; end Get_Failure; ---------- -- Next -- ---------- procedure Next (I : in out Failure_Iter) is Id : Test_Id; begin if not Has_Failure (I) then return; end if; Id := Failure_Lists.Element (Failure_Lists.Cursor (I)).Id; Failure_Lists.Next (Failure_Lists.Cursor (I)); while Failure_Lists.Has_Element (Failure_Lists.Cursor (I)) loop exit when Failure_Lists.Element (Failure_Lists.Cursor (I)).Id = Id; Failure_Lists.Next (Failure_Lists.Cursor (I)); end loop; end Next; ------------------ -- Current_Test -- ------------------ function Current_Test return Test_Access is begin return The_Current_Test; end Current_Test; ---------------------- -- Set_Current_Test -- ---------------------- procedure Set_Current_Test (T : Test_Access) is begin The_Current_Test := T; end Set_Current_Test; ------------- -- Copy_Id -- ------------- procedure Copy_Id (From : Test'Class; To : in out Test'Class) is begin To.Id := From.Id; end Copy_Id; end AUnit.Assertions; aunit-21.0.0.fa386849/include/aunit/framework/nofileio/0000755000175000017500000000000013740342126022215 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/nofileio/aunit-io.ads0000644000175000017500000000560013740342126024434 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ package AUnit.IO is type File_Type is new Integer; type File_Access is access constant File_Type; function Standard_Output return File_Access; procedure Put (File : File_Type; Item : Integer; Width : Integer := 0; Base : Integer := 0); procedure Put (File : File_Type; Item : String); procedure Put_Line (File : File_Type; Item : String); procedure New_Line (File : File_Type; Spacing : Positive := 1); end AUnit.IO; aunit-21.0.0.fa386849/include/aunit/framework/nofileio/aunit-io.adb0000644000175000017500000000635513740342126024423 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . I O -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with GNAT.IO; use GNAT.IO; package body AUnit.IO is Standard_Out : aliased constant File_Type := 1; function Standard_Output return File_Access is (Standard_Out'Access); procedure Put (File : File_Type; Item : Integer; Width : Integer := 0; Base : Integer := 0) is pragma Unreferenced (File, Width, Base); begin Put (Item); end Put; procedure Put (File : File_Type; Item : String) is pragma Unreferenced (File); begin Put (Item); end Put; procedure Put_Line (File : File_Type; Item : String) is pragma Unreferenced (File); begin Put_Line (Item); end Put_Line; procedure New_Line (File : File_Type; Spacing : Positive := 1) is pragma Unreferenced (File); begin New_Line (Spacing); end New_Line; end AUnit.IO; aunit-21.0.0.fa386849/include/aunit/framework/certexception/0000755000175000017500000000000013530730011023254 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/certexception/aunit-simple_test_cases-run_routine.adb0000644000175000017500000001035713530730011033125 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S . R U N _ R O U T I N E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2006-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions; use Ada.Exceptions; with AUnit.Time_Measure; separate (AUnit.Simple_Test_Cases) -- Version for cert run-time libraries procedure Run_Routine (Test : access Test_Case'Class; Options : AUnit.Options.AUnit_Options; R : in out Result'Class; Outcome : out Status) is Unexpected_Exception : Boolean := False; Time : Time_Measure.Time := Time_Measure.Null_Time; use Time_Measure; begin -- Reset failure list to capture failed assertions for one routine Clear_Failures (Test.all); begin if Options.Test_Case_Timer then Start_Measure (Time); end if; Run_Test (Test.all); if Options.Test_Case_Timer then Stop_Measure (Time); end if; exception when Assertion_Error => if Options.Test_Case_Timer then Stop_Measure (Time); end if; when E : others => if Options.Test_Case_Timer then Stop_Measure (Time); end if; Unexpected_Exception := True; Add_Error (R, Name (Test.all), Routine_Name (Test.all), Error => (Exception_Name => Format (Exception_Name (E)), Exception_Message => null, Traceback => null), Elapsed => Time); end; if not Unexpected_Exception and then not Has_Failures (Test.all) then Outcome := Success; Add_Success (R, Name (Test.all), Routine_Name (Test.all), Time); else Outcome := Failure; declare C : Failure_Iter := First_Failure (Test.all); begin while Has_Failure (C) loop Add_Failure (R, Name (Test.all), Routine_Name (Test.all), Get_Failure (C), Time); Next (C); end loop; end; end if; end Run_Routine; aunit-21.0.0.fa386849/include/aunit/framework/certexception/aunit-assertions-assert_exception.adb0000644000175000017500000000542213530730011032614 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . A S S E R T I O N S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Version for cert run-time libraries that support exception handling separate (AUnit.Assertions) procedure Assert_Exception (Proc : Throwing_Exception_Proc; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) is begin Proc.all; -- No exception raised: register the failure message Assert (False, Message, Source, Line); exception when others => null; end Assert_Exception; aunit-21.0.0.fa386849/include/aunit/framework/certexception/aunit-test_cases-call_set_up_case.adb0000644000175000017500000000566313530730011032474 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions; use Ada.Exceptions; with AUnit.Memory.Utils; use AUnit.Memory.Utils; separate (AUnit.Test_Cases) function Call_Set_Up_Case (Test : in out Test_Case'Class) return Test_Error_Access is function Alloc_Error is new Gen_Alloc (Test_Error, Test_Error_Access); begin Set_Up_Case (Test); return null; exception when E : others => return Error : constant Test_Error_Access := Alloc_Error do Error.Exception_Name := Format (Exception_Name (E)); Error.Exception_Message := null; Error.Traceback := null; end return; end Call_Set_Up_Case; aunit-21.0.0.fa386849/include/aunit/framework/fileio/0000755000175000017500000000000013740342126021660 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/fileio/aunit-io.ads0000644000175000017500000000632013740342126024077 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Text_IO; with Ada.Integer_Text_IO; package AUnit.IO is subtype File_Type is Ada.Text_IO.File_Type; subtype File_Access is Ada.Text_IO.File_Access; function Standard_Output return File_Access renames Ada.Text_IO.Standard_Output; procedure Put (File : File_Type; Item : Integer; Width : Ada.Text_IO.Field := Ada.Integer_Text_IO.Default_Width; Base : Ada.Text_IO.Number_Base := Ada.Integer_Text_IO.Default_Base) renames Ada.Integer_Text_IO.Put; procedure Put (File : File_Type; Item : String) renames Ada.Text_IO.Put; procedure Put_Line (File : File_Type; Item : String) renames Ada.Text_IO.Put_Line; procedure New_Line (File : File_Type; Spacing : Ada.Text_IO.Positive_Count := 1) renames Ada.Text_IO.New_Line; end AUnit.IO; aunit-21.0.0.fa386849/include/aunit/framework/aunit.ads0000644000175000017500000000532213530730011022213 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2006-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Test Suite Framework package AUnit is type Message_String is access String; subtype Test_String is Message_String; type Status is (Success, Failure); -- String manipulation functions. function Format (S : String) return Message_String; function Message_Alloc (Length : Natural) return Message_String; procedure Message_Free (Msg : in out Message_String); end AUnit; aunit-21.0.0.fa386849/include/aunit/framework/aunit-memory-utils.ads0000644000175000017500000000514113530730011024656 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . M E M O R Y . U T I L S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Provides Gen_Alloc, easing the allocation of objects within AUnit. package AUnit.Memory.Utils is generic type Object is limited private; type Name is access Object; pragma No_Strict_Aliasing (Name); function Gen_Alloc return Name; end AUnit.Memory.Utils; aunit-21.0.0.fa386849/include/aunit/framework/aunit-options.ads0000644000175000017500000000556013530730011023710 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . O P T I O N S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2009-2013, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.Test_Filters; package AUnit.Options is type AUnit_Options is record Global_Timer : Boolean := False; Test_Case_Timer : Boolean := False; Report_Successes : Boolean := True; Filter : AUnit.Test_Filters.Test_Filter_Access := null; end record; -- Options used to determine how a test should be run. Default_Options : constant AUnit_Options := (Global_Timer => False, Test_Case_Timer => False, Report_Successes => True, Filter => null); end AUnit.Options; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_cases.ads0000644000175000017500000001220013530730011024337 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada_Containers; use Ada_Containers; with Ada_Containers.AUnit_Lists; with AUnit.Options; with AUnit.Simple_Test_Cases; with AUnit.Test_Results; use AUnit.Test_Results; -- Test case: a collection of test routines package AUnit.Test_Cases is type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with private; type Test_Case_Access is access all Test_Case'Class; type Test_Routine is access procedure (Test : in out Test_Case'Class); type Routine_Spec is record Routine : Test_Routine; Routine_Name : Message_String; end record; procedure Add_Routine (T : in out Test_Case'Class; Val : Routine_Spec); procedure Register_Tests (Test : in out Test_Case) is abstract; -- Register test methods with test suite procedure Set_Up_Case (Test : in out Test_Case); -- Set up performed before each test case (set of test routines) procedure Tear_Down_Case (Test : in out Test_Case); -- Tear down performed after each test case package Registration is procedure Register_Routine (Test : in out Test_Case'Class; Routine : Test_Routine; Name : String); -- Add test routine to test case function Routine_Count (Test : Test_Case'Class) return Count_Type; -- Count of registered routines in test case end Registration; generic type Specific_Test_Case is abstract new Test_Case with private; package Specific_Test_Case_Registration is -- Specific Test Case registration type Specific_Test_Routine is access procedure (Test : in out Specific_Test_Case'Class); procedure Register_Wrapper (Test : in out Specific_Test_Case'Class; Routine : Specific_Test_Routine; Name : String); -- Add test routine for a specific test case end Specific_Test_Case_Registration; procedure Run (Test : access Test_Case; Options : AUnit.Options.AUnit_Options; R : in out Result'Class; Outcome : out Status); -- Run test case. Do not override. procedure Run_Test (Test : in out Test_Case); -- Perform the current test procedure. Do not override. function Routine_Name (Test : Test_Case) return Message_String; -- Routine name. Returns the routine under test. Do not override. private type Routine_Access is access all Routine_Spec; -- Test routine description package Routine_Lists is new Ada_Containers.AUnit_Lists (Routine_Spec); -- Container for test routines package Failure_Lists is new Ada_Containers.AUnit_Lists (Message_String); -- Container for failed assertion messages per routine type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with record Routines : aliased Routine_Lists.List; Routine : Routine_Spec; end record; end AUnit.Test_Cases; aunit-21.0.0.fa386849/include/aunit/framework/aunit-memory.ads0000644000175000017500000000560713530730011023527 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . M E M O R Y -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Provides the memory handling mechanism used by AUnit. This allows in -- particular AUnit to use dynamic allocation even on limited run-times that -- do not provide memory management. -- See also AUnit.Memory.Utils that provides an easy to use allocator for -- complex objects. with System; package AUnit.Memory is type size_t is mod 2 ** Standard'Address_Size; function AUnit_Alloc (Size : size_t) return System.Address; procedure AUnit_Free (Obj : System.Address); private pragma Inline (AUnit_Alloc); pragma Inline (AUnit_Free); end AUnit.Memory; aunit-21.0.0.fa386849/include/aunit/framework/aunit-assertions.ads0000644000175000017500000001513413530730011024405 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . A S S E R T I O N S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- -- This package provides the Assert methods used by the user to verify test -- results. -- Those methods are used to report errors within AUnit tests when a result -- does not match an expected value. -- with GNAT.Source_Info; with AUnit.Tests; with AUnit.Test_Results; with Ada_Containers.AUnit_Lists; package AUnit.Assertions is type Throwing_Exception_Proc is access procedure; procedure Assert (Condition : Boolean; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line); -- Test "Condition" and record "Message" if false. -- If the condition is false, an exception is then raised and the running -- test is aborted. function Assert (Condition : Boolean; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) return Boolean; -- Functional version to allow the calling routine to decide whether to -- continue or abandon the execution. ----------------------- -- Simple assertions -- ----------------------- -- The following subprograms provide specialized version of Assert -- to compare simple types. In case of failure, the error message will -- contain both the expected and actual values. procedure Assert (Actual : String; Expected : String; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line); -- Specialized versions of Assert, they call the general version that -- takes a Condition as a parameter procedure Assert_Exception (Proc : Throwing_Exception_Proc; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line); -- Test that Proc throws an exception and record "Message" if not. ------------------------------------------------------------ -- The following declarations are for internal use only -- ------------------------------------------------------------ Assertion_Error : exception; -- For run-time libraries that support exception handling, raised when an -- assertion fails in order to abandon execution of a test routine. type Test is abstract new AUnit.Tests.Test with private; -- Test is used as root type for all Test cases, but also for Test fixtures -- This allows easy access to all Assert procedures from user tests. type Test_Access is access all Test'Class; procedure Init_Test (T : in out Test); -- Init a new test procedure Clear_Failures (T : Test); -- Clear all failures related to T function Has_Failures (T : Test) return Boolean; -- The number of failures reported by test type Failure_Iter is private; -- Iterator used to retrieve failures. function First_Failure (T : Test) return Failure_Iter; function Has_Failure (I : Failure_Iter) return Boolean; function Get_Failure (I : Failure_Iter) return AUnit.Test_Results.Test_Failure; procedure Next (I : in out Failure_Iter); -- Failures list handling -- The following is used for the non-dispatching Assert methods. -- This uses global variables, and thus is incompatible with multitasking. function Current_Test return Test_Access; procedure Set_Current_Test (T : Test_Access); procedure Copy_Id (From : Test'Class; To : in out Test'Class); -- Copy From's Id to To so that failures reported via To are identified as -- belonging to From. private use AUnit.Test_Results; -- We can't set the results directly within the test as the result list is -- limited and we don't want Test to be limited. -- Instead, we initialize tests with a unique id that we use when putting -- a new error in this global list. type Test_Id is new Natural; Null_Id : constant Test_Id := 0; type Failure_Elt is record Failure : Test_Failure; Id : Test_Id := Null_Id; end record; package Failure_Lists is new Ada_Containers.AUnit_Lists (Failure_Elt); -- Container for failed assertion messages per routine type Failure_Iter is new Failure_Lists.Cursor; type Test is abstract new AUnit.Tests.Test with record Id : Test_Id := Null_Id; end record; end AUnit.Assertions; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_suites.adb0000644000175000017500000001050113530730011024536 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ S U I T E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with AUnit.Memory.Utils; package body AUnit.Test_Suites is -------------- -- Add_Test -- -------------- procedure Add_Test (S : access Test_Suite'Class; T : access Test_Suite'Class) is begin Append (S.Tests, (Kind => TS_Elt, TS => Access_Test_Suite'(T.all'Unchecked_Access))); end Add_Test; -------------- -- Add_Test -- -------------- procedure Add_Test (S : access Test_Suite'Class; T : access Test_Case'Class) is begin Append (S.Tests, (Kind => TC_Elt, TC => Test_Case_Access'(T.all'Unchecked_Access))); end Add_Test; --------- -- Run -- --------- procedure Run (Suite : access Test_Suite; Options : AUnit_Options; R : in out Result'Class; Outcome : out Status) is C : Cursor := First (Suite.Tests); Result : Status := Success; begin Outcome := Success; while Has_Element (C) loop case Element (C).Kind is when TC_Elt => Run (Element (C).TC, Options, R, Result); when TS_Elt => Run (Element (C).TS, Options, R, Result); end case; if Result = Failure then Outcome := Failure; end if; Next (C); end loop; end Run; --------------- -- New_Suite -- --------------- function New_Suite return Access_Test_Suite is type Access_Type is access all Test_Suite; pragma No_Strict_Aliasing (Access_Type); function Alloc is new AUnit.Memory.Utils.Gen_Alloc (Test_Suite, Access_Type); function Convert is new Ada.Unchecked_Conversion (Access_Type, Access_Test_Suite); Ret : constant Access_Type := Alloc; Obj : Test_Suite; for Obj'Address use Ret.all'Address; pragma Warnings (Off, Obj); begin return Convert (Ret); end New_Suite; end AUnit.Test_Suites; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_suites.ads0000644000175000017500000000761213530730011024570 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ S U I T E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- A collection of test cases. with Ada_Containers; with Ada_Containers.AUnit_Lists; with AUnit.Options; use AUnit.Options; with AUnit.Simple_Test_Cases; use AUnit.Simple_Test_Cases; with AUnit.Tests; with AUnit.Test_Results; use AUnit.Test_Results; package AUnit.Test_Suites is type Test_Suite is new AUnit.Tests.Test with private; type Access_Test_Suite is access all Test_Suite'Class; procedure Add_Test (S : access Test_Suite'Class; T : access Test_Suite'Class); procedure Add_Test (S : access Test_Suite'Class; T : access Test_Case'Class); -- Add a test case or suite to this suite procedure Run (Suite : access Test_Suite; Options : AUnit_Options; R : in out Result'Class; Outcome : out Status); -- Run all tests collected into this suite function New_Suite return Access_Test_Suite; -- Create a new test suite private type Test_Suite_Elt_Kind is (TC_Elt, TS_Elt); type Test_Suite_Element (Kind : Test_Suite_Elt_Kind := TC_Elt) is record case Kind is when TC_Elt => TC : Test_Case_Access; when TS_Elt => TS : Access_Test_Suite; end case; end record; use Ada_Containers; package Test_Lists is new Ada_Containers.AUnit_Lists (Test_Suite_Element); use Test_Lists; -- Containers for test cases and sub-suites type Test_Suite is new AUnit.Tests.Test with record Tests : aliased Test_Lists.List; end record; end AUnit.Test_Suites; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_fixtures.ads0000644000175000017500000000735213530730011025126 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ F I X T U R E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- -- A Test_Fixture is used to provide a common environment for a set of test -- cases. -- -- To define a test case from a test fixture, see AUnit.Test_Caller. -- -- Each test runs in its own fixture so there can be no side effects among -- test runs. -- -- Here is an example: -- -- -- package Math_Test is -- Type Test is new AUnit.Test_Fixtures.Test_Fixture with record -- M_Value1 : Integer; -- M_Value2 : Integer; -- end record; -- -- procedure Set_Up (T : in out Test); -- -- procedure Test_Addition (T : in out Test); -- -- end Math_Test; -- -- package body Math_Test is -- -- procedure Set_Up (T : in out Test) is -- begin -- T.M_Value1 := 2; -- T.M_Value2 := 3; -- end Set_Up; -- -- procedure Test_Addition (T : in out Test) is -- begin -- Assert (T.M_Value1 + T.M_Value2 = 5, -- "Incorrect addition for integers"); -- end Test_Addition; -- -- end Math_Test; -- -- with AUnit.Assertions; package AUnit.Test_Fixtures is type Test_Fixture is new AUnit.Assertions.Test with private; procedure Set_Up (Test : in out Test_Fixture); -- Set up performed before each test case procedure Tear_Down (Test : in out Test_Fixture); -- Tear down performed after each test case private type Test_Fixture is new AUnit.Assertions.Test with null record; end AUnit.Test_Fixtures; aunit-21.0.0.fa386849/include/aunit/framework/nocalendar/0000755000175000017500000000000013740342126022517 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/nocalendar/aunit-time_measure.adb0000644000175000017500000000707713740342126026777 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T I M E _ M E A S U R E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2006-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ package body AUnit.Time_Measure is ------------------- -- Start_Measure -- ------------------- procedure Start_Measure (T : in out Time) is pragma Unreferenced (T); begin null; end Start_Measure; ------------------ -- Stop_Measure -- ------------------ procedure Stop_Measure (T : in out Time) is pragma Unreferenced (T); begin null; end Stop_Measure; ----------------- -- Get_Measure -- ----------------- function Get_Measure (T : Time) return AUnit_Duration is pragma Unreferenced (T); begin return 0; end Get_Measure; --------------------- -- Gen_Put_Measure -- --------------------- procedure Gen_Put_Measure (File : AUnit.IO.File_Type; Measure : AUnit_Duration) is pragma Unreferenced (File, Measure); begin null; end Gen_Put_Measure; -------------------------------- -- Gen_Put_Measure_In_Seconds -- -------------------------------- procedure Gen_Put_Measure_In_Seconds (File : AUnit.IO.File_Type; Measure : AUnit_Duration) is pragma Unreferenced (File, Measure); begin null; end Gen_Put_Measure_In_Seconds; end AUnit.Time_Measure; aunit-21.0.0.fa386849/include/aunit/framework/nocalendar/aunit-time_measure.ads0000644000175000017500000000632613740342126027014 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T I M E _ M E A S U R E -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2006-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Dummy package when Ada.Calendar is not supported with AUnit.IO; package AUnit.Time_Measure is type Time is null record; type AUnit_Duration is private; Null_Time : Time; procedure Start_Measure (T : in out Time); -- Start a new measure procedure Stop_Measure (T : in out Time); -- Stop the measure function Get_Measure (T : Time) return AUnit_Duration; -- Get the measure generic procedure Gen_Put_Measure (File : AUnit.IO.File_Type; Measure : AUnit_Duration); -- Put the image of the measure generic procedure Gen_Put_Measure_In_Seconds (File : AUnit.IO.File_Type; Measure : AUnit_Duration); -- Unlike Gen_Put_Measure, puts the measure in seconds only, also puts -- 9 digits after decimal point. private type AUnit_Duration is new Integer; end AUnit.Time_Measure; aunit-21.0.0.fa386849/include/aunit/framework/aunit.adb0000644000175000017500000001120313530730011022165 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2018, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with System.Storage_Elements; use System.Storage_Elements; with AUnit.Memory; use AUnit.Memory; with System; package body AUnit is -- The allocation strategy below is based on a low-level trick that mimics -- what GNAT would generate for a regular allocator. Therefore it needs to -- be protected from changes of Default_Scalar_Storage_Order setting. pragma Warnings (Off, "scalar storage order"); type Bounds is record First : Natural; Last : Natural; end record with Bit_Order => System.Default_Bit_Order, Scalar_Storage_Order => System.Default_Bit_Order; type Bounds_Access is access all Bounds; type Fat_Pointer is record Address : System.Address; Bound_Address : Bounds_Access; end record with Bit_Order => System.Default_Bit_Order, Scalar_Storage_Order => System.Default_Bit_Order; pragma Warnings (On, "scalar storage order"); ------------------- -- Message_Alloc -- ------------------- function Message_Alloc (Length : Natural) return Message_String is function To_Message is new Ada.Unchecked_Conversion (Fat_Pointer, Message_String); function To_Bounds_Access is new Ada.Unchecked_Conversion (System.Address, Bounds_Access); function To_Address is new Ada.Unchecked_Conversion (Bounds_Access, System.Address); Ret : Fat_Pointer; begin Ret.Bound_Address := To_Bounds_Access (AUnit.Memory.AUnit_Alloc (size_t (Length + (Bounds'Object_Size / 8)))); Ret.Bound_Address.First := 1; Ret.Bound_Address.Last := Length; Ret.Address := To_Address (Ret.Bound_Address) + (Bounds'Size / 8); return To_Message (Ret); end Message_Alloc; ------------------ -- Message_Free -- ------------------ procedure Message_Free (Msg : in out Message_String) is begin if Msg /= null then AUnit.Memory.AUnit_Free (Msg.all'Address); Msg := null; end if; end Message_Free; ------------ -- Format -- ------------ function Format (S : String) return Message_String is Ptr : constant Message_String := Message_Alloc (S'Length); begin for J in S'Range loop Ptr (J - S'First + 1) := S (J); end loop; return Ptr; end Format; end AUnit; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_cases.adb0000644000175000017500000001365713530730011024337 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with AUnit.Options; use AUnit.Options; with AUnit.Test_Filters; use AUnit.Test_Filters; with AUnit.Time_Measure; package body AUnit.Test_Cases is package body Registration is separate; ----------------- -- Add_Routine -- ----------------- procedure Add_Routine (T : in out Test_Case'Class; Val : Routine_Spec) is begin Routine_Lists.Append (T.Routines, Val); end Add_Routine; -------------- -- Run_Test -- -------------- procedure Run_Test (Test : in out Test_Case) is begin Test.Routine.Routine (Test); end Run_Test; ---------------------- -- Call_Set_Up_Case -- ---------------------- function Call_Set_Up_Case (Test : in out Test_Case'Class) return Test_Error_Access is separate; --------- -- Run -- --------- procedure Run (Test : access Test_Case; Options : AUnit.Options.AUnit_Options; R : in out Result'Class; Outcome : out Status) is use Routine_Lists; Result : Status; C : Cursor; Set_Up_Case_Called : Boolean := False; Error : Test_Error_Access := null; begin Outcome := Success; Routine_Lists.Clear (Test.Routines); Register_Tests (Test_Case'Class (Test.all)); C := First (Test.Routines); while Has_Element (C) loop Test.Routine := Element (C); if Options.Filter = null or else Is_Active (Options.Filter.all, Test.all) then if not Set_Up_Case_Called then Set_Up_Case_Called := True; Error := Call_Set_Up_Case (Test_Case'Class (Test.all)); end if; if Error = null then AUnit.Simple_Test_Cases.Run (AUnit.Simple_Test_Cases.Test_Case (Test.all)'Access, Options, R, Result); if Result = Failure then Outcome := Failure; end if; else Outcome := Failure; Add_Error (R, Name (Test_Case'Class (Test.all)), Routine_Name (Test.all), Error.all, Time_Measure.Null_Time); end if; end if; Next (C); end loop; if Set_Up_Case_Called then Tear_Down_Case (Test_Case'Class (Test.all)); end if; end Run; ------------------ -- Routine_Name -- ------------------ function Routine_Name (Test : Test_Case) return Message_String is begin return Test.Routine.Routine_Name; end Routine_Name; ------------------ -- Set_Up_Case -- ------------------ procedure Set_Up_Case (Test : in out Test_Case) is -- Default pragma Unreferenced (Test); begin null; end Set_Up_Case; -------------------- -- Tear_Down_Case -- -------------------- procedure Tear_Down_Case (Test : in out Test_Case) is pragma Unreferenced (Test); begin null; end Tear_Down_Case; package body Specific_Test_Case_Registration is ---------------------- -- Register_Wrapper -- ---------------------- procedure Register_Wrapper (Test : in out Specific_Test_Case'Class; Routine : Specific_Test_Routine; Name : String) is function Conv is new Ada.Unchecked_Conversion (Specific_Test_Routine, Test_Routine); begin Registration.Register_Routine (Test_Case'Class (Test), Conv (Routine), Name); end Register_Wrapper; end Specific_Test_Case_Registration; end AUnit.Test_Cases; aunit-21.0.0.fa386849/include/aunit/framework/fullexception/0000755000175000017500000000000013530730011023261 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/fullexception/aunit-simple_test_cases-run_routine.adb0000644000175000017500000001056613530730011033134 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S . R U N _ R O U T I N E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2006-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions; use Ada.Exceptions; with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic; with AUnit.Time_Measure; separate (AUnit.Simple_Test_Cases) -- Version for run-time libraries that support exception handling procedure Run_Routine (Test : access Test_Case'Class; Options : AUnit.Options.AUnit_Options; R : in out Result'Class; Outcome : out Status) is Unexpected_Exception : Boolean := False; Time : Time_Measure.Time := Time_Measure.Null_Time; use Time_Measure; begin -- Reset failure list to capture failed assertions for one routine Clear_Failures (Test.all); begin if Options.Test_Case_Timer then Start_Measure (Time); end if; Run_Test (Test.all); if Options.Test_Case_Timer then Stop_Measure (Time); end if; exception when Assertion_Error => if Options.Test_Case_Timer then Stop_Measure (Time); end if; when E : others => if Options.Test_Case_Timer then Stop_Measure (Time); end if; Unexpected_Exception := True; Add_Error (R, Name (Test.all), Routine_Name (Test.all), Error => (Exception_Name => Format (Exception_Name (E)), Exception_Message => Format (Exception_Message (E)), Traceback => Format (Symbolic_Traceback (E))), Elapsed => Time); end; if not Unexpected_Exception and then not Has_Failures (Test.all) then Outcome := Success; Add_Success (R, Name (Test.all), Routine_Name (Test.all), Time); else Outcome := Failure; declare C : Failure_Iter := First_Failure (Test.all); begin while Has_Failure (C) loop Add_Failure (R, Name (Test.all), Routine_Name (Test.all), Get_Failure (C), Time); Next (C); end loop; end; end if; end Run_Routine; aunit-21.0.0.fa386849/include/aunit/framework/fullexception/aunit-assertions-assert_exception.adb0000644000175000017500000000545613530730011032630 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . A S S E R T I O N S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Version for run-time libraries that support exception handling separate (AUnit.Assertions) procedure Assert_Exception (Proc : Throwing_Exception_Proc; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) is begin begin Proc.all; exception when others => return; end; -- No exception raised: register the failure message Assert (False, Message, Source, Line); end Assert_Exception; aunit-21.0.0.fa386849/include/aunit/framework/fullexception/aunit-test_cases-call_set_up_case.adb0000644000175000017500000000604313530730011032472 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions; use Ada.Exceptions; with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic; with AUnit.Memory.Utils; use AUnit.Memory.Utils; separate (AUnit.Test_Cases) function Call_Set_Up_Case (Test : in out Test_Case'Class) return Test_Error_Access is function Alloc_Error is new Gen_Alloc (Test_Error, Test_Error_Access); begin Set_Up_Case (Test); return null; exception when E : others => return Error : constant Test_Error_Access := Alloc_Error do Error.Exception_Name := Format (Exception_Name (E)); Error.Exception_Message := Format (Exception_Message (E)); Error.Traceback := Format (Symbolic_Traceback (E)); end return; end Call_Set_Up_Case; aunit-21.0.0.fa386849/include/aunit/framework/aunit-simple_test_cases.ads0000644000175000017500000000743713530730011025730 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . S I M P L E _ T E S T _ C A S E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- This type is used to implement a simple test case: define a derived type -- that overrides the Run_Test and Name methods. -- -- You don't usually need to use that type, but Test_Fixture/Test_Caller -- or Test_Case instead. with AUnit.Assertions; with AUnit.Options; with AUnit.Test_Results; use AUnit.Test_Results; package AUnit.Simple_Test_Cases is type Test_Case is abstract new AUnit.Assertions.Test with private; type Test_Case_Access is access all Test_Case'Class; function Name (Test : Test_Case) return Message_String is abstract; -- Test case name function Routine_Name (Test : Test_Case) return Message_String; -- Routine name. By default return a null Message_String procedure Run_Test (Test : in out Test_Case) is abstract; -- Perform the test. procedure Set_Up (Test : in out Test_Case); -- Set up performed before each test procedure Tear_Down (Test : in out Test_Case); -- Tear down performed after each test ---------------------------------------------- -- Below are internal routines. Do not use -- ---------------------------------------------- procedure Run (Test : access Test_Case; Options : AUnit.Options.AUnit_Options; R : in out Result'Class; Outcome : out Status); -- Run test case. Do not override private type Test_Case is abstract new AUnit.Assertions.Test with null record; end AUnit.Simple_Test_Cases; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_fixtures.adb0000644000175000017500000000535013530730011025101 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ F I X T U R E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ package body AUnit.Test_Fixtures is ------------ -- Set_Up -- ------------ procedure Set_Up (Test : in out Test_Fixture) is pragma Unreferenced (Test); begin null; end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (Test : in out Test_Fixture) is pragma Unreferenced (Test); begin null; end Tear_Down; end AUnit.Test_Fixtures; aunit-21.0.0.fa386849/include/aunit/framework/zfpexception/0000755000175000017500000000000013530730011023116 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/zfpexception/aunit-simple_test_cases-run_routine.adb0000644000175000017500000001262313530730011032765 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S . R U N _ R O U T I N E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2006-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.Last_Chance_Handler; use AUnit.Last_Chance_Handler; with AUnit.Time_Measure; separate (AUnit.Simple_Test_Cases) -- Version for run-time libraries that support exception handling via gcc -- builtin setjmp/longjmp mechanism. procedure Run_Routine (Test : access Test_Case'Class; Options : AUnit.Options.AUnit_Options; R : in out Result'Class; Outcome : out Status) is Unexpected_Exception : Boolean := False; Time : Time_Measure.Time := Time_Measure.Null_Time; Res : Integer; use Time_Measure; function String_Compare (Str1, Str2 : String) return Boolean; -- Compares two strings. procedure Internal_Run_Test; -- Wrapper for running the test case -------------------- -- String_Compare -- -------------------- function String_Compare (Str1, Str2 : String) return Boolean is begin if Str1'Length /= Str2'Length then return False; end if; for J in Str1'Range loop if Str1 (J) /= Str2 (J - Str1'First + Str2'First) then return False; end if; end loop; return True; end String_Compare; ----------------------- -- Internal_Run_Test -- ----------------------- procedure Internal_Run_Test is begin if Options.Test_Case_Timer then Start_Measure (Time); end if; AUnit.Simple_Test_Cases.Run_Test (Test.all); if Options.Test_Case_Timer then Stop_Measure (Time); end if; end Internal_Run_Test; function Internal_Setjmp is new AUnit.Last_Chance_Handler.Gen_Setjmp (Internal_Run_Test); begin -- Reset failure list to capture failed assertions for one routine Clear_Failures (Test.all); begin Res := Internal_Setjmp; if Res /= 0 then if Options.Test_Case_Timer then Stop_Measure (Time); end if; declare Src : constant Message_String := AUnit.Last_Chance_Handler.Get_Exception_Message; begin if not String_Compare (Src.all, "aunit-assertions.adb:61") then Unexpected_Exception := True; Add_Error (R, Name (Test.all), Routine_Name (Test.all), Error => (Exception_Name => Get_Exception_Name, Exception_Message => Src, Traceback => null), Elapsed => Time); end if; end; end if; end; if not Unexpected_Exception and then not Has_Failures (Test.all) then Outcome := Success; Add_Success (R, Name (Test.all), Routine_Name (Test.all), Time); else Outcome := Failure; declare C : Failure_Iter := First_Failure (Test.all); begin while Has_Failure (C) loop Add_Failure (R, Name (Test.all), Routine_Name (Test.all), Get_Failure (C), Time); Next (C); end loop; end; end if; end Run_Routine; aunit-21.0.0.fa386849/include/aunit/framework/zfpexception/aunit-last_chance_handler.adb0000644000175000017500000001772513530730011030661 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- L A S T _ C H A N C E _ H A N D L E R -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2016, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with System; with System.Storage_Elements; use System.Storage_Elements; with Interfaces.C; with Ada.Unchecked_Conversion; package body AUnit.Last_Chance_Handler is Exception_Name : Message_String := null; Exception_Message : Message_String := null; type Jmp_Buff is array (1 .. 5) of System.Address; type Jmp_Buff_Address is access all Jmp_Buff; -- type expected by setjmp call function Builtin_Setjmp (Buff : Jmp_Buff_Address) return Integer; pragma Import (Intrinsic, Builtin_Setjmp, "__builtin_setjmp"); procedure Builtin_Longjmp (Buff : Jmp_Buff_Address; Flag : Integer); pragma Import (Intrinsic, Builtin_Longjmp, "__builtin_longjmp"); pragma No_Return (Builtin_Longjmp); -- handle at most 5 handlers at the same time Jmp_Buffer : array (1 .. 5) of aliased Jmp_Buff; Jmp_Buff_Idx : Integer := Jmp_Buffer'First; --------------------------- -- C Strings management -- --------------------------- type chars_ptr is access all Character; pragma No_Strict_Aliasing (chars_ptr); function To_chars_ptr is new Ada.Unchecked_Conversion (System.Address, chars_ptr); function To_Address is new Ada.Unchecked_Conversion (chars_ptr, System.Address); function To_Ada (Item : chars_ptr; Line : Integer := 0) return Message_String; ---------------- -- Gen_Setjmp -- ---------------- function Gen_Setjmp return Integer is Ret : Integer; begin Ret := Builtin_Setjmp (Jmp_Buffer (Jmp_Buff_Idx)'Access); if Ret = 0 then Jmp_Buff_Idx := Jmp_Buff_Idx + 1; Proc; Jmp_Buff_Idx := Jmp_Buff_Idx - 1; end if; return Ret; end Gen_Setjmp; ------------------------ -- Get_Exception_Name -- ------------------------ function Get_Exception_Name return Message_String is begin if Exception_Message = null then return AUnit.Message_Alloc (0); else return Exception_Name; end if; end Get_Exception_Name; --------------------------- -- Get_Exception_Message -- --------------------------- function Get_Exception_Message return Message_String is begin if Exception_Message = null then return AUnit.Message_Alloc (0); else return Exception_Message; end if; end Get_Exception_Message; ------------ -- To_Ada -- ------------ function To_Ada (Item : chars_ptr; Line : Integer := 0) return Message_String is use Interfaces.C; Result : Message_String; Length : size_t := 0; Line_Img : String (1 .. Integer'Width); First : Natural := Line_Img'Last + 1; function "+" (Left : chars_ptr; Right : size_t) return chars_ptr; -- Return the address Right character right of address Left. function Peek (From : chars_ptr) return char; -- Return the character at address From function To_Ada (Item : char) return Character; -- Translate char to an Ada Character --------- -- "+" -- --------- function "+" (Left : chars_ptr; Right : size_t) return chars_ptr is begin return To_chars_ptr (To_Address (Left) + Storage_Offset (Right)); end "+"; ---------- -- Peek -- ---------- function Peek (From : chars_ptr) return char is begin return char (From.all); end Peek; ------------ -- To_Ada -- ------------ function To_Ada (Item : char) return Character is begin return Character'Val (char'Pos (Item)); end To_Ada; begin if Item = null then return null; end if; -- Compute the Length of "Item" loop if Peek (Item + Length) = nul then exit; end if; Length := Length + 1; end loop; -- Compute the image of Line if Line /= 0 then declare Int : Integer; Val : Natural; begin Int := Line; loop Val := Int mod 10; Int := (Int - Val) / 10; First := First - 1; Line_Img (First) := Character'Val (Val + Character'Pos ('0')); exit when Int = 0; end loop; end; end if; if Line /= 0 then Result := AUnit.Message_Alloc (Natural (Length) + Line_Img'Last - First + 2); else Result := AUnit.Message_Alloc (Natural (Length)); end if; for J in 1 .. Integer (Length) loop Result (J) := To_Ada (Peek (Item + size_t (J - 1))); end loop; if Line /= 0 then Result (Integer (Length + 1)) := ':'; for J in First .. Line_Img'Last loop Result (Integer (Length + 2) + J - First) := Line_Img (J); end loop; end if; return Result; end To_Ada; ------------------------- -- Last_Chance_Handler -- ------------------------- procedure Last_Chance_Handler (Msg : System.Address; Line : Integer) is procedure OS_Exit; pragma Import (C, OS_Exit, "abort"); pragma No_Return (OS_Exit); begin -- Save the exception message before performing the longjmp Exception_Name := Format ("Unexpected exception in zfp profile"); if Line = 0 then Exception_Message := To_Ada (To_chars_ptr (Msg)); else Exception_Message := To_Ada (To_chars_ptr (Msg), Line); end if; Jmp_Buff_Idx := Jmp_Buff_Idx - 1; if Jmp_Buff_Idx >= Jmp_Buffer'First then -- No return procedure. Builtin_Longjmp (Jmp_Buffer (Jmp_Buff_Idx)'Access, 1); else OS_Exit; end if; end Last_Chance_Handler; end AUnit.Last_Chance_Handler; aunit-21.0.0.fa386849/include/aunit/framework/zfpexception/aunit-assertions-assert_exception.adb0000644000175000017500000000573513530730011032465 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . A S S E R T I O N S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Version for run-time libraries that support exception handling via -- gcc builtin setjmp/longjmp with AUnit.Last_Chance_Handler; separate (AUnit.Assertions) procedure Assert_Exception (Proc : Throwing_Exception_Proc; Message : String; Source : String := GNAT.Source_Info.File; Line : Natural := GNAT.Source_Info.Line) is procedure Exec; procedure Exec is begin Proc.all; end Exec; function My_Setjmp is new AUnit.Last_Chance_Handler.Gen_Setjmp (Exec); begin if My_Setjmp = 0 then -- Result is 0 when no exception has been raised. Assert (False, Message, Source, Line); end if; end Assert_Exception; aunit-21.0.0.fa386849/include/aunit/framework/zfpexception/aunit-test_cases-call_set_up_case.adb0000644000175000017500000000612513530730011032330 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.Last_Chance_Handler; use AUnit.Last_Chance_Handler; with AUnit.Memory.Utils; use AUnit.Memory.Utils; separate (AUnit.Test_Cases) function Call_Set_Up_Case (Test : in out Test_Case'Class) return Test_Error_Access is function Alloc_Error is new Gen_Alloc (Test_Error, Test_Error_Access); procedure Internal_Set_Up_Case is begin Set_Up_Case (Test); end Internal_Set_Up_Case; function Internal_Setjmp is new Gen_Setjmp (Internal_Set_Up_Case); Error : Test_Error_Access := null; begin if Internal_Setjmp /= 0 then Error := Alloc_Error; Error.Exception_Name := Get_Exception_Name; Error.Exception_Message := Get_Exception_Message; Error.Traceback := null; end if; return Error; end Call_Set_Up_Case; aunit-21.0.0.fa386849/include/aunit/framework/zfpexception/aunit-last_chance_handler.ads0000644000175000017500000000605113530730011030670 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- L A S T _ C H A N C E _ H A N D L E R -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- This last chance handler implementation performs a longjmp using gcc -- builtin to allow exception simulation on platforms where the run-time does -- not allow exception propagation. with System; package AUnit.Last_Chance_Handler is function Get_Exception_Name return Message_String; function Get_Exception_Message return Message_String; -- Return the last exception message generic with procedure Proc; function Gen_Setjmp return Integer; -- Setjmp: init the handler, and call Proc. procedure Last_Chance_Handler (Msg : System.Address; Line : Integer); pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler"); pragma No_Return (Last_Chance_Handler); end AUnit.Last_Chance_Handler; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_results.adb0000644000175000017500000002327113740342126024744 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ R E S U L T S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with AUnit.Memory.Utils; -- Record test results. package body AUnit.Test_Results is ----------------------- -- Local Subprograms -- ----------------------- function Alloc_Failure is new AUnit.Memory.Utils.Gen_Alloc (Test_Failure, Test_Failure_Access); function Alloc_Error is new AUnit.Memory.Utils.Gen_Alloc (Test_Error, Test_Error_Access); E_Count : Count_Type; F_Count : Count_Type; S_Count : Count_Type; procedure Iterate_Error (Position : Result_Lists.Cursor); procedure Iterate_Failure (Position : Result_Lists.Cursor); procedure Iterate_Success (Position : Result_Lists.Cursor); function Is_Error (Position : Result_Lists.Cursor) return Boolean; function Is_Failure (Position : Result_Lists.Cursor) return Boolean; function Is_Success (Position : Result_Lists.Cursor) return Boolean; generic with function Test (Position : Result_Lists.Cursor) return Boolean; procedure Gen_Extract (R : Result; E : in out Result_Lists.List); ------------------- -- Iterate_Error -- ------------------- procedure Iterate_Error (Position : Result_Lists.Cursor) is begin if Result_Lists.Element (Position).Error /= null then E_Count := E_Count + 1; end if; end Iterate_Error; --------------------- -- Iterate_Failure -- --------------------- procedure Iterate_Failure (Position : Result_Lists.Cursor) is begin if Result_Lists.Element (Position).Failure /= null then F_Count := F_Count + 1; end if; end Iterate_Failure; --------------------- -- Iterate_Success -- --------------------- procedure Iterate_Success (Position : Result_Lists.Cursor) is begin if Result_Lists.Element (Position).Error = null and then Result_Lists.Element (Position).Failure = null then S_Count := S_Count + 1; end if; end Iterate_Success; ----------------- -- Gen_Extract -- ----------------- procedure Gen_Extract (R : Result; E : in out Result_Lists.List) is C : Result_Lists.Cursor; use Result_Lists; begin C := First (R.Result_List); while Has_Element (C) loop if Test (C) then E.Append (Element (C)); end if; Next (C); end loop; end Gen_Extract; -------------- -- Is_Error -- -------------- function Is_Error (Position : Result_Lists.Cursor) return Boolean is begin return Result_Lists.Element (Position).Error /= null; end Is_Error; ---------------- -- Is_Failure -- ---------------- function Is_Failure (Position : Result_Lists.Cursor) return Boolean is begin return Result_Lists.Element (Position).Failure /= null; end Is_Failure; ---------------- -- Is_Success -- ---------------- function Is_Success (Position : Result_Lists.Cursor) return Boolean is begin return not Is_Error (Position) and then not Is_Failure (Position); end Is_Success; --------------- -- Add_Error -- --------------- procedure Add_Error (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Error : Test_Error; Elapsed : Time) is Val : constant Test_Result := (Test_Name, Routine_Name, Failure => null, Error => Alloc_Error, Elapsed => Elapsed); use Result_Lists; begin Val.Error.all := Error; Append (R.Result_List, Val); end Add_Error; ----------------- -- Add_Failure -- ----------------- procedure Add_Failure (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Failure : Test_Failure; Elapsed : Time) is Val : constant Test_Result := (Test_Name, Routine_Name, Failure => Alloc_Failure, Error => null, Elapsed => Elapsed); use Result_Lists; begin Val.Failure.all := Failure; Append (R.Result_List, Val); end Add_Failure; ----------------- -- Add_Success -- ----------------- procedure Add_Success (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Elapsed : Time) is Val : constant Test_Result := (Test_Name, Routine_Name, null, null, Elapsed); use Result_Lists; begin Append (R.Result_List, Val); end Add_Success; ----------------- -- Set_Elapsed -- ----------------- procedure Set_Elapsed (R : in out Result; T : Time_Measure.Time) is begin R.Elapsed_Time := T; end Set_Elapsed; ----------------- -- Error_Count -- ----------------- function Error_Count (R : Result) return Count_Type is use Result_Lists; begin E_Count := 0; Iterate (R.Result_List, Iterate_Error'Access); return E_Count; end Error_Count; ------------ -- Errors -- ------------ procedure Errors (R : Result; E : in out Result_Lists.List) is procedure Extract is new Gen_Extract (Is_Error); begin Extract (R, E); end Errors; ------------------- -- Failure_Count -- ------------------- function Failure_Count (R : Result) return Count_Type is use Result_Lists; begin F_Count := 0; Iterate (R.Result_List, Iterate_Failure'Access); return F_Count; end Failure_Count; -------------- -- Failures -- -------------- procedure Failures (R : Result; F : in out Result_Lists.List) is procedure Extract is new Gen_Extract (Is_Failure); begin Extract (R, F); end Failures; ------------- -- Elapsed -- ------------- function Elapsed (R : Result) return Time_Measure.Time is begin return R.Elapsed_Time; end Elapsed; ---------------- -- Start_Test -- ---------------- procedure Start_Test (R : in out Result; Subtest_Count : Count_Type) is begin R.Tests_Run := R.Tests_Run + Subtest_Count; end Start_Test; ------------------- -- Success_Count -- ------------------- function Success_Count (R : Result) return Count_Type is begin S_Count := 0; Result_Lists.Iterate (R.Result_List, Iterate_Success'Access); return S_Count; end Success_Count; --------------- -- Successes -- --------------- procedure Successes (R : Result; S : in out Result_Lists.List) is procedure Extract is new Gen_Extract (Is_Success); begin Extract (R, S); end Successes; ---------------- -- Successful -- ---------------- function Successful (R : Result) return Boolean is begin return Success_Count (R) = Test_Count (R); end Successful; ---------------- -- Test_Count -- ---------------- function Test_Count (R : Result) return Ada_Containers.Count_Type is begin return R.Tests_Run; end Test_Count; ----------- -- Clear -- ----------- procedure Clear (R : in out Result) is begin R.Tests_Run := 0; R.Elapsed_Time := Time_Measure.Null_Time; Result_Lists.Clear (R.Result_List); end Clear; end AUnit.Test_Results; aunit-21.0.0.fa386849/include/aunit/framework/calendar/0000755000175000017500000000000013740342126022162 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/calendar/aunit-time_measure.adb0000644000175000017500000001347613740342126026442 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T I M E _ M E A S U R E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2006-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; package body AUnit.Time_Measure is ------------------- -- Start_Measure -- ------------------- procedure Start_Measure (T : in out Time) is begin T.Start := Ada.Calendar.Clock; end Start_Measure; ------------------ -- Stop_Measure -- ------------------ procedure Stop_Measure (T : in out Time) is begin T.Stop := Ada.Calendar.Clock; end Stop_Measure; ----------------- -- Get_Measure -- ----------------- function Get_Measure (T : Time) return AUnit_Duration is use type Ada.Calendar.Time; begin return AUnit_Duration (T.Stop - T.Start); end Get_Measure; --------------------- -- Gen_Put_Measure -- --------------------- procedure Gen_Put_Measure (File : AUnit.IO.File_Type; Measure : AUnit_Duration) is H, M, S : Integer := 0; T : Duration := Duration (Measure); Force : Boolean; procedure Put (N : Integer; Length : Integer); -- Put N using at least Length digits. procedure Put (N : Integer; Length : Integer) is begin for Dig in reverse 1 .. Length - 1 loop if N < 10**Dig then Put (File, "0"); else exit; end if; end loop; Put (File, Trim (N'Img, Left)); end Put; begin -- Calculate the number of hours, minutes and seconds while T >= 3600.0 loop H := H + 1; T := T - 3600.0; end loop; while T >= 60.0 loop M := M + 1; T := T - 60.0; end loop; while T >= 1.0 loop S := S + 1; T := T - 1.0; end loop; -- Now display the result Force := False; if H > 0 then Put (File, Trim (H'Img, Left)); Put (File, "h"); Force := True; end if; if M > 0 or else Force then if not Force then Put (File, Trim (M'Img, Left)); else -- In case some output is already done, then we force a 2 digits -- output so that the output is normalized. Put (M, 2); end if; Put (File, "min. "); Force := True; end if; if not Force then Put (File, Trim (S'Img, Left)); else Put (S, 2); end if; Put (File, "."); Put (Integer (T * 1_000_000.0), 6); Put (File, " sec."); end Gen_Put_Measure; -------------------------------- -- Gen_Put_Measure_In_Seconds -- -------------------------------- procedure Gen_Put_Measure_In_Seconds (File : AUnit.IO.File_Type; Measure : AUnit_Duration) is S : Integer := 0; T : Duration := Duration (Measure); procedure Put (N : Integer; Length : Integer); -- Put N using at least Length digits. procedure Put (N : Integer; Length : Integer) is begin for Dig in reverse 1 .. Length - 1 loop if N < 10**Dig then Put (File, "0"); else exit; end if; end loop; Put (File, Trim (N'Img, Left)); end Put; begin while T >= 1.0 loop S := S + 1; T := T - 1.0; end loop; Put (File, Trim (S'Img, Left)); Put (File, "."); Put (Integer (T * 1_000_000.0), 9); Put (File, "s"); end Gen_Put_Measure_In_Seconds; end AUnit.Time_Measure; aunit-21.0.0.fa386849/include/aunit/framework/calendar/aunit-time_measure.ads0000644000175000017500000000670313740342126026456 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T I M E _ M E A S U R E -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2006-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada.Calendar; with AUnit.IO; package AUnit.Time_Measure is type Time is record Start : Ada.Calendar.Time; Stop : Ada.Calendar.Time; end record; type AUnit_Duration is private; Null_Time : constant Time := (Start => Ada.Calendar.Time_Of (1901, 1, 1), Stop => Ada.Calendar.Time_Of (1901, 1, 1)); procedure Start_Measure (T : in out Time); -- Start a new measure procedure Stop_Measure (T : in out Time); -- Stop the measure function Get_Measure (T : Time) return AUnit_Duration; -- Get the measure generic with procedure Put (F : AUnit.IO.File_Type; S : String) is <>; procedure Gen_Put_Measure (File : AUnit.IO.File_Type; Measure : AUnit_Duration); -- Put the image of the measure generic with procedure Put (F : AUnit.IO.File_Type; S : String) is <>; procedure Gen_Put_Measure_In_Seconds (File : AUnit.IO.File_Type; Measure : AUnit_Duration); -- Unlike Gen_Put_Measure, puts the measure in seconds only, also puts -- 9 digits after decimal point. private type AUnit_Duration is new Duration; end AUnit.Time_Measure; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_results.ads0000644000175000017500000001324313740342126024763 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ R E S U L T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada_Containers.AUnit_Lists; with AUnit.Time_Measure; use AUnit.Time_Measure; -- Test reporting -- package AUnit.Test_Results is type Result is tagged limited private; -- Record result. A result object is associated with the execution of a -- top-level test suite type Test_Failure is record Message : Message_String; Source_Name : Message_String; Line : Natural; end record; type Test_Failure_Access is access all Test_Failure; pragma No_Strict_Aliasing (Test_Failure_Access); -- Description of a test routine failure type Test_Error is record Exception_Name : Message_String; Exception_Message : Message_String; Traceback : Message_String; end record; type Test_Error_Access is access all Test_Error; pragma No_Strict_Aliasing (Test_Error_Access); -- Description of unexpected exceptions type Test_Result is record Test_Name : Message_String; Routine_Name : Message_String; Failure : Test_Failure_Access; Error : Test_Error_Access; Elapsed : Time := Null_Time; end record; -- Decription of a test routine result use Ada_Containers; package Result_Lists is new Ada_Containers.AUnit_Lists (Test_Result); -- Containers for all test results procedure Add_Error (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Error : Test_Error; Elapsed : Time); -- Record an unexpected exception procedure Add_Failure (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Failure : Test_Failure; Elapsed : Time); -- Record a test routine failure procedure Add_Success (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Elapsed : Time); -- Record a test routine success procedure Set_Elapsed (R : in out Result; T : Time); -- Set Elapsed time for reporter function Error_Count (R : Result) return Count_Type; -- Number of routines with unexpected exceptions procedure Errors (R : Result; E : in out Result_Lists.List); -- List of routines with unexpected exceptions function Failure_Count (R : Result) return Count_Type; -- Number of failed routines procedure Failures (R : Result; F : in out Result_Lists.List); -- List of failed routines function Elapsed (R : Result) return Time; -- Elapsed time for test execution procedure Start_Test (R : in out Result; Subtest_Count : Count_Type); -- Set count for a test run function Success_Count (R : Result) return Count_Type; -- Number of successful routines procedure Successes (R : Result; S : in out Result_Lists.List); -- List of successful routines function Successful (R : Result) return Boolean; -- All routines successful? function Test_Count (R : Result) return Ada_Containers.Count_Type; -- Number of routines run procedure Clear (R : in out Result); -- Clear the results private pragma Inline (Errors, Failures, Successes); type Result is tagged limited record Tests_Run : Count_Type := 0; Result_List : Result_Lists.List; Elapsed_Time : Time := Null_Time; end record; end AUnit.Test_Results; aunit-21.0.0.fa386849/include/aunit/framework/nodealloc/0000755000175000017500000000000013530730011022340 5ustar nicolasnicolasaunit-21.0.0.fa386849/include/aunit/framework/nodealloc/aunit-memory.adb0000644000175000017500000000564613530730011025451 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A U N I T . M E M O R Y -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2003 Free Software Foundation, Inc. -- -- Copyright (C) 2008-2018, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- Memory allocation implementation using the gnat runtime methods with -- no support for deallocation. package body AUnit.Memory is ----------- -- Alloc -- ----------- function AUnit_Alloc (Size : size_t) return System.Address is function RT_Malloc (Size : size_t) return System.Address; pragma Import (C, RT_Malloc, "__gnat_malloc"); begin return RT_Malloc (Size); end AUnit_Alloc; ---------- -- Free -- ---------- procedure AUnit_Free (Obj : System.Address) is pragma Unreferenced (Obj); begin null; end AUnit_Free; end AUnit.Memory; aunit-21.0.0.fa386849/include/aunit/framework/nodealloc/aunit-memory-utils.adb0000644000175000017500000000502313530730011026574 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . M E M O R Y . U T I L S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2008-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ package body AUnit.Memory.Utils is --------------- -- Gen_Alloc -- --------------- function Gen_Alloc return Name is begin return new Object; end Gen_Alloc; end AUnit.Memory.Utils; aunit-21.0.0.fa386849/include/aunit/framework/aunit-reporter.adb0000644000175000017500000000501413740342126024041 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . R E P O R T E R -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ package body AUnit.Reporter is procedure Set_File (Engine : in out Reporter; Value : AUnit.IO.File_Access) is begin Engine.File := Value; end Set_File; end AUnit.Reporter; aunit-21.0.0.fa386849/include/aunit/framework/aunit-test_filters.adb0000644000175000017500000000774413740342126024722 0ustar nicolasnicolas------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ F I L T E R S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2009-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ with AUnit.Simple_Test_Cases; use AUnit.Simple_Test_Cases; package body AUnit.Test_Filters is function Starts_With (Str : String; Prefix : String) return Boolean; -- Whether Str starts with Prefix ----------------- -- Starts_With -- ----------------- function Starts_With (Str : String; Prefix : String) return Boolean is begin if Str'Length < Prefix'Length then return False; end if; return Str (Str'First .. Str'First + Prefix'Length - 1) = Prefix; end Starts_With; -------------- -- Set_Name -- -------------- procedure Set_Name (Filter : in out Name_Filter; Name : String) is begin Message_Free (Filter.Name); Filter.Name := Format (Name); end Set_Name; --------------- -- Is_Active -- --------------- function Is_Active (Filter : Name_Filter; T : AUnit.Tests.Test'Class) return Boolean is begin if Filter.Name = null or else Filter.Name.all = "" then return True; end if; if T not in AUnit.Simple_Test_Cases.Test_Case'Class or else Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)) = null then -- There is no name, so it doesn't match the filter return False; end if; if Routine_Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)) = null then return Starts_With (Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)).all, Filter.Name.all); else return Starts_With (Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)).all & " : " & Routine_Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)).all, Filter.Name.all); end if; end Is_Active; end AUnit.Test_Filters; aunit-21.0.0.fa386849/test/0000755000175000017500000000000013530730011014617 5ustar nicolasnicolasaunit-21.0.0.fa386849/test/Makefile0000644000175000017500000000200613530730011016255 0ustar nicolasnicolasGPRBUILD = gprbuild GPRCLEAN = gprclean .PHONY: all test force all: test RTS = TARGET = PROJECT_PATH_ARG = ifeq ($(RTS),) RTS = full RTS_CONF = else RTS_CONF = --RTS=$(RTS) endif ifeq ($(TARGET),) TARGET = native TARGET_CONF = else TARGET_CONF = --target=$(TARGET) endif CONF_ARGS = $(TARGET_CONF) $(RTS_CONF) ifeq ($(OS),Windows_NT) ifeq ($(TARGET),native) exeext=.exe endif endif ifeq ($(findstring vxworks,$(TARGET)),vxworks) exeext=.out endif RUN= ifeq ($(TARGET),powerpc-elf) RUN=./support/run-ppc-elf endif build: $(PROJECT_PATH_ARG) $(GPRBUILD) -p -Paunit_tests $(CONF_ARGS) $(LARGS) run: build -$(RUN) ./exe/$(TARGET)-$(RTS)/aunit_harness$(exeext) test: build -$(RUN) ./exe/aunit_harness$(exeext) > test.out.full 2>&1 egrep "^Total|^Success|^Fail|^Unexp" test.out.full > test.out diff -b test.out expected.out @echo @echo "[OK] AUNIT TEST IS SUCCESSFUL" clean: $(RM) -rf obj exe support/obj support/lib *.cgpr test.out RMDIR = rmdir MKDIR = mkdir -p RM = rm CP = cp -p aunit-21.0.0.fa386849/test/src/0000755000175000017500000000000013530730011015406 5ustar nicolasnicolasaunit-21.0.0.fa386849/test/src/aunit-test_suites-tests.ads0000644000175000017500000000151113530730011022726 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Fixtures; with AUnit.Test_Results; with AUnit.Test_Suites; package AUnit.Test_Suites.Tests is type Fixture is new AUnit.Test_Fixtures.Test_Fixture with record Suite : AUnit.Test_Suites.Access_Test_Suite; Res : AUnit.Test_Results.Result; end record; procedure Set_Up (Test : in out Fixture); procedure Tear_Down (Test : in out Fixture); procedure Test_Add_Test_Case (T : in out Fixture); procedure Test_Run_Empty (T : in out Fixture); procedure Test_Run_With_Success (T : in out Fixture); procedure Test_Run_With_Failure (T : in out Fixture); procedure Test_Run_With_Exception (T : in out Fixture); procedure Test_Run_With_All (T : in out Fixture); procedure Test_Run_With_Setup (T : in out Fixture); end AUnit.Test_Suites.Tests; aunit-21.0.0.fa386849/test/src/aunit-test_suites-tests_fixtures.adb0000644000175000017500000000561013530730011024642 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with Ada.Exceptions; with AUnit.Assertions; use AUnit.Assertions; package body AUnit.Test_Suites.Tests_Fixtures is ---------- -- Name -- ---------- function Name (Test : Simple_Test_Case) return Message_String is pragma Unreferenced (Test); begin return AUnit.Format ("Simple test case"); end Name; -------------- -- Run_Test -- -------------- procedure Run_Test (Test : in out Simple_Test_Case) is pragma Unreferenced (Test); begin null; end Run_Test; function Name (Test : TC_With_Failure) return Message_String is pragma Unreferenced (Test); begin return AUnit.Format ("Test case with failure"); end Name; -------------- -- Run_Test -- -------------- procedure Run_Test (Test : in out TC_With_Failure) is pragma Unreferenced (Test); begin Assert (False, "A failed assertion"); end Run_Test; ---------- -- Name -- ---------- function Name (Test : TC_With_Two_Failures) return Message_String is pragma Unreferenced (Test); begin return AUnit.Format ("Test case with 2 failures"); end Name; -------------- -- Run_Test -- -------------- procedure Run_Test (Test : in out TC_With_Two_Failures) is pragma Unreferenced (Test); begin if not Assert (False, "A first failure") then Assert (False, "A second failure"); Assert (False, "Third failure, should not appear"); end if; end Run_Test; ---------- -- Name -- ---------- function Name (Test : TC_With_Exception) return Message_String is pragma Unreferenced (Test); begin return AUnit.Format ("Test case with exception"); end Name; -------------- -- Run_Test -- -------------- procedure Run_Test (Test : in out TC_With_Exception) is pragma Unreferenced (Test); begin Ada.Exceptions.Raise_Exception (My_Exception'Identity, "A message"); end Run_Test; ---------- -- Name -- ---------- function Name (Test : TC_With_Setup) return Message_String is pragma Unreferenced (Test); begin return AUnit.Format ("Test case with set_up/tear_down defined)"); end Name; ------------ -- Set_Up -- ------------ procedure Set_Up (Test : in out TC_With_Setup) is begin if Test.Setup then Test.Error := True; end if; Test.Setup := True; end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (Test : in out TC_With_Setup) is begin if not Test.Setup then Test.Error := True; end if; Test.Setup := False; end Tear_Down; -------------- -- Run_Test -- -------------- procedure Run_Test (Test : in out TC_With_Setup) is begin Assert (Test.Setup, "Set up not done correctly"); end Run_Test; end AUnit.Test_Suites.Tests_Fixtures; aunit-21.0.0.fa386849/test/src/aunit-test_suites-tests.adb0000644000175000017500000002344413530730011022716 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Options; use AUnit.Options; with AUnit.Assertions; use AUnit.Assertions; with AUnit.Test_Results; use AUnit.Test_Results; with AUnit.Time_Measure; use AUnit.Time_Measure; with AUnit.Test_Suites.Tests_Fixtures; use AUnit.Test_Suites.Tests_Fixtures; package body AUnit.Test_Suites.Tests is ------------ -- Set_Up -- ------------ procedure Set_Up (Test : in out Fixture) is begin AUnit.Test_Results.Clear (Test.Res); Test.Suite := AUnit.Test_Suites.New_Suite; end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (Test : in out Fixture) is -- -- ??? incompatible with zfp. Should we remove it ? -- procedure Free is new Ada.Unchecked_Deallocation -- (Access_Test_Suite, Test_Suite); pragma Unreferenced (Test); begin null; -- Free (Test.Suite); end Tear_Down; ------------------------ -- Test_Add_Test_Case -- ------------------------ procedure Test_Add_Test_Case (T : in out Fixture) is begin Assert (Test_Lists.Is_Empty (T.Suite.Tests), "Suite is not empty when initialized"); AUnit.Test_Suites.Add_Test (T.Suite, A_Simple_Test_Case'Access); Assert (Test_Lists.Length (T.Suite.Tests) = 1, "Suite length after inserting a test case is not 1"); end Test_Add_Test_Case; -------------------- -- Test_Run_Empty -- -------------------- procedure Test_Run_Empty (T : in out Fixture) is Outcome : AUnit.Status; Option : constant AUnit.Options.AUnit_Options := Default_Options; begin Run (T.Suite, Option, T.Res, Outcome); Assert (Successful (T.Res), "Suite did not report success correctly"); Assert (Test_Count (T.Res) = 0, "Wrong number of tests recorded"); Assert (Outcome = Success, "Result flag incorrect"); end Test_Run_Empty; --------------------------- -- Test_Run_With_Success -- --------------------------- procedure Test_Run_With_Success (T : in out Fixture) is Outcome : AUnit.Status; Option : constant AUnit_Options := Default_Options; begin AUnit.Test_Suites.Add_Test (T.Suite, A_Simple_Test_Case'Access); Run (T.Suite, Option, T.Res, Outcome); Assert (Successful (T.Res), "Suite did not report success correctly"); Assert (Success_Count (T.Res) = 1, "Number of reported successes is wrong"); Assert (Failure_Count (T.Res) = 0, "Number of reported failures is wrong"); Assert (Error_Count (T.Res) = 0, "Number of reported errors is wrong"); Assert (Test_Count (T.Res) = 1, "Wrong number of tests recorded"); Assert (Outcome = Success, "Result flag incorrect"); end Test_Run_With_Success; --------------------------- -- Test_Run_With_Failure -- --------------------------- procedure Test_Run_With_Failure (T : in out Fixture) is Outcome : AUnit.Status; Option : constant AUnit_Options := Default_Options; begin AUnit.Test_Suites.Add_Test (T.Suite, A_TC_With_Failure'Access); Run (T.Suite, Option, T.Res, Outcome); Assert (not Successful (T.Res), "Suite did not report success correctly"); Assert (Success_Count (T.Res) = 0, "Number of reported successes is wrong"); Assert (Failure_Count (T.Res) = 1, "Number of reported failures is wrong"); Assert (Error_Count (T.Res) = 0, "Number of reported errors is wrong"); Assert (Test_Count (T.Res) = 1, "Wrong number of tests recorded"); Assert (Outcome = Failure, "Result flag incorrect"); end Test_Run_With_Failure; ----------------------------- -- Test_Run_With_Exception -- ----------------------------- procedure Test_Run_With_Exception (T : in out Fixture) is Outcome : AUnit.Status; Option : constant AUnit_Options := Default_Options; begin AUnit.Test_Suites.Add_Test (T.Suite, A_TC_With_Exception'Access); Run (T.Suite, Option, T.Res, Outcome); Assert (not Successful (T.Res), "Suite did not report success correctly"); Assert (Success_Count (T.Res) = 0, "Number of reported successes is wrong"); Assert (Failure_Count (T.Res) = 0, "Number of reported failures is wrong"); Assert (Error_Count (T.Res) = 1, "Number of reported errors is wrong"); Assert (Test_Count (T.Res) = 1, "Wrong number of tests recorded"); Assert (Outcome = Failure, "Result flag incorrect"); end Test_Run_With_Exception; ----------------------------- -- Test_Run_With_Exception -- ----------------------------- procedure Test_Run_With_All (T : in out Fixture) is Outcome : AUnit.Status; Option : constant AUnit_Options := Default_Options; begin AUnit.Test_Suites.Add_Test (T.Suite, A_Simple_Test_Case'Access); AUnit.Test_Suites.Add_Test (T.Suite, A_TC_With_Two_Failures'Access); AUnit.Test_Suites.Add_Test (T.Suite, A_TC_With_Exception'Access); Run (T.Suite, Option, T.Res, Outcome); Assert (not Successful (T.Res), "Suite did not report success correctly"); Assert (Success_Count (T.Res) = 1, "Number of reported successes is wrong"); Assert (Failure_Count (T.Res) = 2, "Number of reported failures is wrong"); Assert (Error_Count (T.Res) = 1, "Number of reported errors is wrong"); Assert (Test_Count (T.Res) = 3, "Wrong number of tests recorded"); Assert (Outcome = Failure, "Result flag incorrect"); declare List : Result_Lists.List; Elem : Test_Result; begin Successes (T.Res, List); Assert (Result_Lists.Length (List) = 1, "Unexpected number of successful results"); Elem := Result_Lists.First_Element (List); Assert (Elem.Test_Name.all = "Simple test case", "Incorrect test name in result: '" & Elem.Test_Name.all & "'"); -- Do not use Elem.Routine_Name.all as test result string, as this -- would be elaborated even in the normal case where null is -- expected. Assert (Elem.Routine_Name = null, "Incorrect routine name for result: expected null"); Assert (Elem.Failure = null, "Unexpected failure value for a successful run"); Assert (Elem.Error = null, "Unexpected error value for a successful run"); Assert (Elem.Elapsed = Null_Time, "Unexpected elapsed value with run option set to No_Time"); Result_Lists.Clear (List); Failures (T.Res, List); Assert (Result_Lists.Length (List) = 2, "Unexpected number of failure results"); Elem := Result_Lists.First_Element (List); Assert (Elem.Test_Name.all = "Test case with 2 failures", "Incorrect test name for result: '" & Elem.Test_Name.all & "'"); Assert (Elem.Routine_Name = null, "Incorrect routine name for result: expected null"); Assert (Elem.Failure /= null, "Unexpected failure value for a failed run"); Assert (Elem.Error = null, "Unexpected error value for a failed run"); Assert (Elem.Elapsed = Null_Time, "Unexpected elapsed value with run option set to No_Time"); Assert (Elem.Failure.Message.all = "A first failure", "Incorrect message reported in Failure"); Assert (Elem.Failure.Source_Name.all, "aunit-test_suites-tests_fixtures.adb", "Incorrect filename reported in Failure"); Result_Lists.Clear (List); Errors (T.Res, List); Assert (Result_Lists.Length (List) = 1, "Unexpected number of error results"); Elem := Result_Lists.First_Element (List); Assert (Elem.Test_Name.all = "Test case with exception", "Incorrect test name for result: '" & Elem.Test_Name.all & "'"); Assert (Elem.Routine_Name = null, "Incorrect routine name for result: expected null"); Assert (Elem.Failure = null, "Unexpected failure value for a run with exception raised"); Assert (Elem.Error /= null, "Unexpected error value for a run with exception raised"); Assert (Elem.Elapsed = Null_Time, "Unexpected elapsed value with run option set to No_Time"); Assert (Elem.Error.Exception_Name.all = "AUNIT.TEST_SUITES.TESTS_FIXTURES.MY_EXCEPTION" or else Elem.Error.Exception_Name.all = "Unexpected exception in zfp profile", "Exeption name is incorrect in error: '" & Elem.Error.Exception_Name.all & "'"); -- Incompatible with certexceptions -- Assert (Elem.Error.Exception_Message.all = "A message", -- "Exception message not correctly set: " & -- Elem.Error.Exception_Message.all); end; end Test_Run_With_All; ------------------------- -- Test_Run_With_Setup -- ------------------------- procedure Test_Run_With_Setup (T : in out Fixture) is Outcome : AUnit.Status; Option : constant AUnit_Options := Default_Options; begin AUnit.Test_Suites.Add_Test (T.Suite, A_TC_With_Setup'Access); Run (T.Suite, Option, T.Res, Outcome); Assert (Successful (T.Res), "Suite did not run successfully: setup not called"); Assert (A_TC_With_Setup.Setup = False, "Tear down not called"); Assert (A_TC_With_Setup.Error = False, "Tear down did not receive the expected value"); end Test_Run_With_Setup; end AUnit.Test_Suites.Tests; aunit-21.0.0.fa386849/test/src/aunit_suite.ads0000644000175000017500000000021713530730011020430 0ustar nicolasnicolaswith AUnit; use AUnit; with AUnit.Test_Suites; package AUnit_Suite is function Suite return Test_Suites.Access_Test_Suite; end AUnit_Suite; aunit-21.0.0.fa386849/test/src/aunit-test_fixtures-tests.adb0000644000175000017500000000724213530730011023251 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with Ada_Containers; use Ada_Containers; with AUnit.Assertions; use AUnit.Assertions; with AUnit.Options; with AUnit.Test_Results; with AUnit.Test_Fixtures.Tests_Fixtures; use AUnit.Test_Fixtures.Tests_Fixtures; package body AUnit.Test_Fixtures.Tests is use AUnit.Test_Fixtures.Tests_Fixtures.Caller; ----------------- -- Test_Set_Up -- ----------------- procedure Test_Set_Up (T : in out Fixture) is R : AUnit.Test_Results.Result; Outcome : AUnit.Status; Old : constant Natural := Get_Nb_Set_Up_Called; pragma Unreferenced (T); begin Run (TC_Success, AUnit.Options.Default_Options, R, Outcome); Run (TC_Failure, AUnit.Options.Default_Options, R, Outcome); Assert (Get_Nb_Set_Up_Called = Old + 2, "Incorrect number of calls to set_up"); end Test_Set_Up; ---------------------------- -- Test_Tear_Down_Success -- ---------------------------- procedure Test_Tear_Down_Success (T : in out Fixture) is R : AUnit.Test_Results.Result; Outcome : AUnit.Status; Old : constant Natural := Get_Nb_Tear_Down_Called; pragma Unreferenced (T); begin Run (TC_Success, AUnit.Options.Default_Options, R, Outcome); Assert (Get_Nb_Tear_Down_Called = Old + 1, "Incorrect number of calls to tear_down"); Assert (Outcome = Success, "Outcome value is incorrect"); Assert (AUnit.Test_Results.Test_Count (R) = 1, "Incorrect number of tests reported"); Assert (AUnit.Test_Results.Failure_Count (R) = 0, "Incorrect number of failures reported"); Assert (AUnit.Test_Results.Error_Count (R) = 0, "Incorrect number of errors reported"); end Test_Tear_Down_Success; ---------------------------- -- Test_Tear_Down_Failure -- ---------------------------- procedure Test_Tear_Down_Failure (T : in out Fixture) is R : AUnit.Test_Results.Result; Outcome : AUnit.Status; Old : constant Natural := Get_Nb_Tear_Down_Called; pragma Unreferenced (T); begin Run (TC_Failure, AUnit.Options.Default_Options, R, Outcome); Assert (Get_Nb_Tear_Down_Called = Old + 1, "Incorrect number of calls to tear_down"); Assert (Outcome = Failure, "Outcome value is incorrect"); Assert (AUnit.Test_Results.Test_Count (R) = 1, "Incorrect number of tests reported"); Assert (AUnit.Test_Results.Failure_Count (R) = 1, "Incorrect number of failures reported"); Assert (AUnit.Test_Results.Error_Count (R) = 0, "Incorrect number of errors reported"); end Test_Tear_Down_Failure; -------------------------- -- Test_Tear_Down_Error -- -------------------------- procedure Test_Tear_Down_Error (T : in out Fixture) is R : AUnit.Test_Results.Result; Outcome : AUnit.Status; Old : constant Natural := Get_Nb_Tear_Down_Called; pragma Unreferenced (T); begin Run (TC_Error, AUnit.Options.Default_Options, R, Outcome); Assert (Get_Nb_Tear_Down_Called = Old + 1, "Incorrect number of calls to tear_down"); Assert (Outcome = Failure, "Outcome value is incorrect"); Assert (AUnit.Test_Results.Test_Count (R) = 1, "Incorrect number of tests reported"); Assert (AUnit.Test_Results.Failure_Count (R) = 0, "Incorrect number of failures reported"); Assert (AUnit.Test_Results.Error_Count (R) = 1, "Incorrect number of errors reported"); end Test_Tear_Down_Error; end AUnit.Test_Fixtures.Tests; aunit-21.0.0.fa386849/test/src/aunit-test_cases-tests_fixtures.adb0000644000175000017500000000570413530730011024430 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body AUnit.Test_Cases.Tests_Fixtures is procedure Double_Failure_Wrapper (T : in out The_Test_Case'Class); use AUnit.Test_Cases.Registration; ------------ -- Set_Up -- ------------ procedure Set_Up (T : in out The_Test_Case) is begin T.Is_Set_Up := True; end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (T : in out The_Test_Case) is begin T.Is_Torn_Down := True; end Tear_Down; ------------- -- Succeed -- ------------- procedure Succeed (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); begin null; end Succeed; ---------- -- Fail -- ---------- procedure Fail (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); begin Assert (False, "Failure test failed"); end Fail; ---------------------------- -- Double_Failure_Wrapper -- ---------------------------- procedure Double_Failure_Wrapper (T : in out The_Test_Case'Class) is begin Double_Failure (T); end Double_Failure_Wrapper; -------------------- -- Double_Failure -- -------------------- procedure Double_Failure (T : in out The_Test_Case) is Dummy : Boolean; pragma Unreferenced (T, Dummy); begin -- Fail two assertions. Will be checked in Test_Test_Case.Test_Run Dummy := Assert (False, "first failure"); Assert (False, "second failure"); end Double_Failure; ------------ -- Except -- ------------ procedure Except (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); begin raise Constraint_Error; end Except; -------------------- -- Register_Tests -- -------------------- procedure Register_Tests (T : in out The_Test_Case) is package Register_Specific is new AUnit.Test_Cases.Specific_Test_Case_Registration (The_Test_Case); use Register_Specific; begin Register_Routine (T, Succeed'Access, "Success Test"); Register_Routine (T, Fail'Access, "Failure Test"); Register_Wrapper (T, Double_Failure_Wrapper'Access, "Multiple assertion failures"); Register_Routine (T, Except'Access, "Exception Test"); end Register_Tests; ---------- -- Name -- ---------- function Name (T : The_Test_Case) return Test_String is pragma Unreferenced (T); begin return Format ("Dummy Test Case"); end Name; --------------- -- Is_Set_Up -- --------------- function Is_Set_Up (T : The_Test_Case) return Boolean is begin return T.Is_Set_Up; end Is_Set_Up; ------------------ -- Is_Torn_Down -- ------------------ function Is_Torn_Down (T : The_Test_Case) return Boolean is begin return T.Is_Torn_Down; end Is_Torn_Down; end AUnit.Test_Cases.Tests_Fixtures; aunit-21.0.0.fa386849/test/src/aunit-test_fixtures-tests_fixtures.ads0000644000175000017500000000202413530730011025214 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Caller; package AUnit.Test_Fixtures.Tests_Fixtures is type Fix is new AUnit.Test_Fixtures.Test_Fixture with record Set_Up_Called : Natural := 0; Tear_Down_Called : Natural := 0; end record; procedure Set_Up (T : in out Fix); procedure Tear_Down (T : in out Fix); procedure Test_Success (T : in out Fix); procedure Test_Failure (T : in out Fix); procedure Test_Error (T : in out Fix); package Caller is new AUnit.Test_Caller (Fix); TC_Success : constant Caller.Test_Case_Access := Caller.Create ("Test Success", Test_Success'Access); TC_Failure : constant Caller.Test_Case_Access := Caller.Create ("Test Failure", Test_Failure'Access); TC_Error : constant Caller.Test_Case_Access := Caller.Create ("Test Error", Test_Error'Access); function Get_Nb_Set_Up_Called return Natural; function Get_Nb_Tear_Down_Called return Natural; end AUnit.Test_Fixtures.Tests_Fixtures; aunit-21.0.0.fa386849/test/src/aunit-test_suites-tests_fixtures.ads0000644000175000017500000000353113530730011024663 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Simple_Test_Cases; package AUnit.Test_Suites.Tests_Fixtures is -- A very simple minded test case type Simple_Test_Case is new AUnit.Simple_Test_Cases.Test_Case with null record; function Name (Test : Simple_Test_Case) return Message_String; procedure Run_Test (Test : in out Simple_Test_Case); A_Simple_Test_Case : aliased Simple_Test_Case; -- A test case raising a failure type TC_With_Failure is new AUnit.Simple_Test_Cases.Test_Case with null record; function Name (Test : TC_With_Failure) return Message_String; procedure Run_Test (Test : in out TC_With_Failure); A_TC_With_Failure : aliased TC_With_Failure; -- A test case raising two failures type TC_With_Two_Failures is new AUnit.Simple_Test_Cases.Test_Case with null record; function Name (Test : TC_With_Two_Failures) return Message_String; procedure Run_Test (Test : in out TC_With_Two_Failures); A_TC_With_Two_Failures : aliased TC_With_Two_Failures; -- A test case raising an exception type TC_With_Exception is new AUnit.Simple_Test_Cases.Test_Case with null record; function Name (Test : TC_With_Exception) return Message_String; procedure Run_Test (Test : in out TC_With_Exception); A_TC_With_Exception : aliased TC_With_Exception; -- A test case using set_up and tear_down type TC_With_Setup is new AUnit.Simple_Test_Cases.Test_Case with record Setup : Boolean := False; Error : Boolean := False; end record; function Name (Test : TC_With_Setup) return Message_String; procedure Set_Up (Test : in out TC_With_Setup); procedure Tear_Down (Test : in out TC_With_Setup); procedure Run_Test (Test : in out TC_With_Setup); A_TC_With_Setup : aliased TC_With_Setup; My_Exception : exception; end AUnit.Test_Suites.Tests_Fixtures; aunit-21.0.0.fa386849/test/src/aunit_harness.adb0000644000175000017500000000204413530730011020721 0ustar nicolasnicolas-- -- Copyright (C) 2009-2013, AdaCore -- with AUnit.Options; with AUnit.Reporter.Text; with AUnit.Run; with AUnit.Test_Filters; use AUnit.Test_Filters; with AUnit_Suite; use AUnit_Suite; procedure AUnit_Harness is procedure Harness is new AUnit.Run.Test_Runner (Suite); -- The full test harness Reporter : AUnit.Reporter.Text.Text_Reporter; Filter : aliased AUnit.Test_Filters.Name_Filter; Options : AUnit.Options.AUnit_Options := (Global_Timer => False, Test_Case_Timer => True, Report_Successes => True, Filter => null); begin AUnit.Reporter.Text.Set_Use_ANSI_Colors (Reporter, True); Harness (Reporter, Options); -- Test the filter -- This filter should be initialized from the command line arguments. In -- this example, we don't do it to support limited runtimes with no support -- for Ada.Command_Line Options.Filter := Filter'Unchecked_Access; Set_Name (Filter, "(test_case) Test routines registration"); Harness (Reporter, Options); end AUnit_Harness; aunit-21.0.0.fa386849/test/src/aunit-test_cases-tests-suite.adb0000644000175000017500000000203213530730011023615 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Caller; package body AUnit.Test_Cases.Tests.Suite is package Caller is new AUnit.Test_Caller (AUnit.Test_Cases.Tests.Fixture); function Test_Suite return AUnit.Test_Suites.Access_Test_Suite is S : constant AUnit.Test_Suites.Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_case) Test routines registration", Test_Register_Tests'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_case) Test set_up phase", Test_Set_Up'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_case) Test tear_down phase", Test_Torn_Down'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_case) Test run phase", Test_Run'Access)); return S; end Test_Suite; end AUnit.Test_Cases.Tests.Suite; aunit-21.0.0.fa386849/test/src/aunit-test_cases-tests_fixtures.ads0000644000175000017500000000250513530730011024445 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- package AUnit.Test_Cases.Tests_Fixtures is type The_Test_Case is new Test_Cases.Test_Case with record Is_Set_Up, Is_Torn_Down : Boolean := False; end record; type The_Test_Case_Access is access all The_Test_Case'Class; procedure Register_Tests (T : in out The_Test_Case); -- Register routines to be run function Name (T : The_Test_Case) return Test_String; -- Provide name identifying the test case procedure Set_Up (T : in out The_Test_Case); -- Preparation performed before each routine procedure Tear_Down (T : in out The_Test_Case); -- Cleanup performed after each routine function Is_Set_Up (T : The_Test_Case) return Boolean; -- Set up? function Is_Torn_Down (T : The_Test_Case) return Boolean; -- Torn down? -------------------- -- Test Routines -- -------------------- procedure Fail (T : in out Test_Cases.Test_Case'Class); -- This routine produces a failure procedure Succeed (T : in out Test_Cases.Test_Case'Class); -- This routine does nothing, so succeeds procedure Double_Failure (T : in out The_Test_Case); -- This routine produces two failrues procedure Except (T : in out Test_Cases.Test_Case'Class); -- This routine raises an exception end AUnit.Test_Cases.Tests_Fixtures; aunit-21.0.0.fa386849/test/src/aunit-test_fixtures-tests-suite.ads0000644000175000017500000000033213530730011024412 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Suites; package AUnit.Test_Fixtures.Tests.Suite is function Test_Suite return AUnit.Test_Suites.Access_Test_Suite; end AUnit.Test_Fixtures.Tests.Suite; aunit-21.0.0.fa386849/test/src/aunit-test_cases-tests.adb0000644000175000017500000000464413530730011022501 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body AUnit.Test_Cases.Tests is ------------------------- -- Test_Register_Tests -- ------------------------- procedure Test_Register_Tests (T : in out Fixture) is Old_Count : constant Count_Type := Registration.Routine_Count (T.TC); Routines_In_Simple : constant := 4; begin Register_Tests (T.TC); Assert (Test_Cases.Registration.Routine_Count (T.TC) = Old_Count + Routines_In_Simple, "Routine not properly registered"); end Test_Register_Tests; ----------------- -- Test_Set_Up -- ----------------- procedure Test_Set_Up (T : in out Fixture) is Was_Reset : constant Boolean := not Is_Set_Up (T.TC); begin Set_Up (T.TC); Assert (Was_Reset and Is_Set_Up (T.TC), "Not set up correctly"); end Test_Set_Up; -------------------- -- Test_Torn_Down -- -------------------- procedure Test_Torn_Down (T : in out Fixture) is Was_Reset : constant Boolean := not Is_Torn_Down (T.TC); begin Tear_Down (T.TC); Assert (Was_Reset and Is_Torn_Down (T.TC), "Not torn down correctly"); end Test_Torn_Down; -------------- -- Test_Run -- -------------- procedure Test_Run (T : in out Fixture) is Count : constant Count_Type := Test_Cases.Registration.Routine_Count (T.TC); Outcome : AUnit.Status; R : Result; begin Run (T.TC'Access, AUnit.Options.Default_Options, R, Outcome); Assert (Count = 4, "Not enough routines in simple test case"); Assert (Test_Count (R) = Count, "Not all requested routines were run"); -- There are supposed to be two failed assertions for one routine -- in R, so we expect Count + Old_Count + 1: Assert (Success_Count (R) + Failure_Count (R) + Error_Count (R) = Count + 1, "Not all requested routines are recorded"); Assert (Is_Torn_Down (T.TC), "Not torn down correctly"); Assert (Success_Count (R) = 1, "Wrong success count"); Assert (Failure_Count (R) = 3, "Wrong failures count"); Assert (Error_Count (R) = 1, "Wrong errors count"); Assert (Outcome = Failure, "Result flag incorrect"); end Test_Run; end AUnit.Test_Cases.Tests; aunit-21.0.0.fa386849/test/src/aunit-test_suites-tests-suite.adb0000644000175000017500000000305313530730011024037 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Caller; package body AUnit.Test_Suites.Tests.Suite is package Caller is new AUnit.Test_Caller (AUnit.Test_Suites.Tests.Fixture); function Test_Suite return AUnit.Test_Suites.Access_Test_Suite is S : constant AUnit.Test_Suites.Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin AUnit.Test_Suites.Add_Test (S, Caller.Create ("(suite) Add test case", Test_Add_Test_Case'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(suite) Run empty suite", Test_Run_Empty'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(suite) Run suite with a successful test", Test_Run_With_Success'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(suite) Run suite with a failing test", Test_Run_With_Failure'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(suite) Run suite with a test raising an exception", Test_Run_With_Exception'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(suite) Run suite with various tests", Test_Run_With_All'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(suite) Verify Set_Up/Tear_Down are called", Test_Run_With_Setup'Access)); return S; end Test_Suite; end AUnit.Test_Suites.Tests.Suite; aunit-21.0.0.fa386849/test/src/aunit-test_fixtures-tests-suite.adb0000644000175000017500000000222713530730011024376 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Caller; package body AUnit.Test_Fixtures.Tests.Suite is package Caller is new AUnit.Test_Caller (AUnit.Test_Fixtures.Tests.Fixture); function Test_Suite return AUnit.Test_Suites.Access_Test_Suite is S : constant AUnit.Test_Suites.Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_fixture) Test Set_Up call", Test_Set_Up'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_fixture) Test Tear_Down call (the called test is success)", Test_Tear_Down_Success'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_fixture) Test Tear_Down call (the called test is failure)", Test_Tear_Down_Failure'Access)); AUnit.Test_Suites.Add_Test (S, Caller.Create ("(test_fixture) Test Tear_Down call (the called test is error)", Test_Tear_Down_Error'Access)); return S; end Test_Suite; end AUnit.Test_Fixtures.Tests.Suite; aunit-21.0.0.fa386849/test/src/aunit-test_cases-tests.ads0000644000175000017500000000101413530730011022506 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Fixtures; with AUnit.Test_Cases.Tests_Fixtures; use AUnit.Test_Cases.Tests_Fixtures; package AUnit.Test_Cases.Tests is type Fixture is new AUnit.Test_Fixtures.Test_Fixture with record TC : aliased The_Test_Case; end record; procedure Test_Register_Tests (T : in out Fixture); procedure Test_Set_Up (T : in out Fixture); procedure Test_Torn_Down (T : in out Fixture); procedure Test_Run (T : in out Fixture); end AUnit.Test_Cases.Tests; aunit-21.0.0.fa386849/test/src/aunit-test_fixtures-tests.ads0000644000175000017500000000161413530730011023267 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- package AUnit.Test_Fixtures.Tests is type Fixture is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Set_Up (T : in out Fixture); -- Test that Set_Up is correctly called when running a test, and that the -- same fixture object is used for different tests. procedure Test_Tear_Down_Success (T : in out Fixture); -- Test that Tear_Down is correctly called when running a test that -- succeeds, and that test result is correct. procedure Test_Tear_Down_Failure (T : in out Fixture); -- Test that Tear_Down is correctly called when running a test that -- fails, and that test result is correct. procedure Test_Tear_Down_Error (T : in out Fixture); -- Test that Tear_Down is correctly called when running a test with -- an error, and that test result is correct. end AUnit.Test_Fixtures.Tests; aunit-21.0.0.fa386849/test/src/aunit-test_fixtures-tests_fixtures.adb0000644000175000017500000000327313530730011025202 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Assertions; use AUnit.Assertions; package body AUnit.Test_Fixtures.Tests_Fixtures is Nb_Set_Up_Called : Natural := 0; Nb_Tear_Down_Called : Natural := 0; ------------ -- Set_Up -- ------------ procedure Set_Up (T : in out Fix) is begin T.Set_Up_Called := T.Set_Up_Called + 1; Nb_Set_Up_Called := T.Set_Up_Called; end Set_Up; --------------- -- Tear_Down -- --------------- procedure Tear_Down (T : in out Fix) is begin T.Tear_Down_Called := T.Tear_Down_Called + 1; Nb_Tear_Down_Called := T.Tear_Down_Called; end Tear_Down; ------------------ -- Test_Success -- ------------------ procedure Test_Success (T : in out Fix) is pragma Unreferenced (T); begin null; end Test_Success; ------------------ -- Test_Failure -- ------------------ procedure Test_Failure (T : in out Fix) is pragma Unreferenced (T); begin Assert (False, "Failure"); end Test_Failure; ---------------- -- Test_Error -- ---------------- procedure Test_Error (T : in out Fix) is pragma Unreferenced (T); begin raise Constraint_Error; end Test_Error; -------------------------- -- Get_Nb_Set_Up_Called -- -------------------------- function Get_Nb_Set_Up_Called return Natural is begin return Nb_Set_Up_Called; end Get_Nb_Set_Up_Called; ----------------------------- -- Get_Nb_Tear_Down_Called -- ----------------------------- function Get_Nb_Tear_Down_Called return Natural is begin return Nb_Tear_Down_Called; end Get_Nb_Tear_Down_Called; end AUnit.Test_Fixtures.Tests_Fixtures; aunit-21.0.0.fa386849/test/src/aunit-test_cases-tests-suite.ads0000644000175000017500000000032413530730011023640 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- with AUnit.Test_Suites; package AUnit.Test_Cases.Tests.Suite is function Test_Suite return AUnit.Test_Suites.Access_Test_Suite; end AUnit.Test_Cases.Tests.Suite; aunit-21.0.0.fa386849/test/src/aunit-test_suites-tests-suite.ads0000644000175000017500000000027513530730011024063 0ustar nicolasnicolas-- -- Copyright (C) 2009-2010, AdaCore -- package AUnit.Test_Suites.Tests.Suite is function Test_Suite return AUnit.Test_Suites.Access_Test_Suite; end AUnit.Test_Suites.Tests.Suite; aunit-21.0.0.fa386849/test/src/aunit_suite.adb0000644000175000017500000000115113530730011020405 0ustar nicolasnicolas-- -- Copyright (C) 2008-2010, AdaCore -- with AUnit.Test_Suites.Tests.Suite; with AUnit.Test_Cases.Tests.Suite; with AUnit.Test_Fixtures.Tests.Suite; package body AUnit_Suite is use Test_Suites; function Suite return Access_Test_Suite is S : constant AUnit.Test_Suites.Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin Add_Test (S, AUnit.Test_Suites.Tests.Suite.Test_Suite); Add_Test (S, AUnit.Test_Cases.Tests.Suite.Test_Suite); Add_Test (S, AUnit.Test_Fixtures.Tests.Suite.Test_Suite); return S; end Suite; end AUnit_Suite; aunit-21.0.0.fa386849/test/expected.out0000644000175000017500000000025213530730011017150 0ustar nicolasnicolasTotal Tests Run: 15 Successful Tests: 15 Failed Assertions: 0 Unexpected Errors: 0 Total Tests Run: 1 Successful Tests: 1 Failed Assertions: 0 Unexpected Errors: 0 aunit-21.0.0.fa386849/test/aunit_tests.gpr0000644000175000017500000000104713530730011017675 0ustar nicolasnicolaswith "aunit"; project Aunit_Tests is for Languages use ("Ada"); for Main use ("aunit_harness.adb"); for Source_Dirs use ("src"); for Exec_Dir use "exe"; for Object_Dir use "obj"; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Binder is for Default_Switches ("ada") use ("-E", "-static"); end Binder; package Compiler is for Default_Switches ("ada") use ("-g", "-gnatQ", "-O1", "-gnatf", "-gnato", "-gnatwa.Xe", "-gnaty"); end Compiler; end Aunit_Tests; aunit-21.0.0.fa386849/test/zfp.adc0000644000175000017500000000013213530730011016063 0ustar nicolasnicolaspragma Restrictions (No_Fixed_Point); pragma Restrictions (No_Implementation_Attributes); aunit-21.0.0.fa386849/test/support/0000755000175000017500000000000013530730011016333 5ustar nicolasnicolasaunit-21.0.0.fa386849/test/support/run-ppc-elf0000755000175000017500000000044413530730011020413 0ustar nicolasnicolas#!/bin/sh if [ $# -ne 1 ]; then echo "Usage: $0 obj" exit 2 fi obj=$1 # Generate the simple script cat > gdb.run << EOF # Load binary target sim -e bug -r 0x400000 load $obj set confirm off run quit EOF # Run gdb on it powerpc-elf-gdb -n --batch --command=gdb.run $obj rm -f gdb.run aunit-21.0.0.fa386849/COPYING.RUNTIME0000644000175000017500000000637413530730011016027 0ustar nicolasnicolasGCC RUNTIME LIBRARY EXCEPTION Version 3.1, 31 March 2009 Copyright (C) 2009 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This GCC Runtime Library Exception ("Exception") is an additional permission under section 7 of the GNU General Public License, version 3 ("GPLv3"). It applies to a given file (the "Runtime Library") that bears a notice placed by the copyright holder of the file stating that the file is governed by GPLv3 along with this Exception. When you use GCC to compile a program, GCC may combine portions of certain GCC header files and runtime libraries with the compiled program. The purpose of this Exception is to allow compilation of non-GPL (including proprietary) programs to use, in this way, the header files and runtime libraries covered by this Exception. 0. Definitions. A file is an "Independent Module" if it either requires the Runtime Library for execution after a Compilation Process, or makes use of an interface provided by the Runtime Library, but is not otherwise based on the Runtime Library. "GCC" means a version of the GNU Compiler Collection, with or without modifications, governed by version 3 (or a specified later version) of the GNU General Public License (GPL) with the option of using any subsequent versions published by the FSF. "GPL-compatible Software" is software whose conditions of propagation, modification and use would permit combination with GCC in accord with the license of GCC. "Target Code" refers to output from any compiler for a real or virtual target processor architecture, in executable form or suitable for input to an assembler, loader, linker and/or execution phase. Notwithstanding that, Target Code does not include data in any format that is used as a compiler intermediate representation, or used for producing a compiler intermediate representation. The "Compilation Process" transforms code entirely represented in non-intermediate languages designed for human-written code, and/or in Java Virtual Machine byte code, into Target Code. Thus, for example, use of source code generators and preprocessors need not be considered part of the Compilation Process, since the Compilation Process can be understood as starting with the output of the generators or preprocessors. A Compilation Process is "Eligible" if it is done using GCC, alone or with other GPL-compatible software, or if it is done without using any work based on GCC. For example, using non-GPL-compatible Software to optimize any GCC intermediate representations would not qualify as an Eligible Compilation Process. 1. Grant of Additional Permission. You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules. 2. No Weakening of GCC Copyleft. The availability of this Exception does not imply any general presumption that third-party software is unaffected by the copyleft requirements of the license of GCC.