comp.lang.ada
 help / color / mirror / Atom feed
* How to test a library?
@ 2014-05-21 19:34 Victor Porton
  2014-05-21 20:32 ` Shark8
  2014-05-21 21:08 ` mockturtle
  0 siblings, 2 replies; 3+ messages in thread
From: Victor Porton @ 2014-05-21 19:34 UTC (permalink / raw)


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?

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to test a library?
  2014-05-21 19:34 How to test a library? Victor Porton
@ 2014-05-21 20:32 ` Shark8
  2014-05-21 21:08 ` mockturtle
  1 sibling, 0 replies; 3+ messages in thread
From: Shark8 @ 2014-05-21 20:32 UTC (permalink / raw)


On 21-May-14 13:34, 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 don't know if there's an official way to do it; but what I'd be 
inclined to do is have a testbed-program (that tests all the [exported] 
subprograms of the library) and issues a report.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to test a library?
  2014-05-21 19:34 How to test a library? Victor Porton
  2014-05-21 20:32 ` Shark8
@ 2014-05-21 21:08 ` mockturtle
  1 sibling, 0 replies; 3+ messages in thread
From: mockturtle @ 2014-05-21 21:08 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-21 21:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox