comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: How to test a library?
Date: Wed, 21 May 2014 14:08:30 -0700 (PDT)
Date: 2014-05-21T14:08:30-07:00	[thread overview]
Message-ID: <555cfef5-5cde-453f-a24c-0df108ce2979@googlegroups.com> (raw)
In-Reply-To: <lliv4i$90q$1@speranza.aioe.org>

On Wednesday, May 21, 2014 9:34:46 PM UTC+2, Victor Porton wrote:
> What is the correct way to test a (shared) library I am going to create?
> 
> I assume there are special libraries for unit tests or something like this. 
> Where to get more info on this?
> 

I know about AUnit that is available on the AdaCore site.  If I remember correctly, it is integrated in some way inside GPS.  However, I never used it since I use my own home-brew library suited for my own need.

As a side note, I find it very convenient to have the test code being a procedure that is a child of the tested package.  For example, the test for package foo.bar could be

    procedure Foo.Bar.Test is
      ...
    end Foo.Bar.Test;

Of course, if you use GPS/GNAT you must register in the project file that foo-bar-test.adb is a main.

In this way you have also the visibility of the internal details of your package and sometimes (not often, at least in my experience) this is useful in testing.   Also, I like this solution for its "cleanness," since the package brings its own test with it...

Riccardo


      parent reply	other threads:[~2014-05-21 21:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 19:34 How to test a library? Victor Porton
2014-05-21 20:32 ` Shark8
2014-05-21 21:08 ` mockturtle [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox