www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - HOWTO: automatic test a D program

reply "maboiteaspam" <maboiteaspam wanadoo.fr> writes:
Hi,

I m looking for some methods/tools to implement tests on my very 
little application about strings manipulation.

I m looking to
- avoid regressions
- measure performance
- learn it

I made a quick search on the newsgroup archives, without success.

In case my question is obvious, i would say that this is my very 
first desktop program,  i m really unfamiliar with this 
environment.

Any suggestions are appreciated !
bye
Aug 09 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-08-09 13:24, maboiteaspam wrote:
 Hi,

 I m looking for some methods/tools to implement tests on my very little
 application about strings manipulation.

 I m looking to
 - avoid regressions
 - measure performance
 - learn it

 I made a quick search on the newsgroup archives, without success.

 In case my question is obvious, i would say that this is my very first
 desktop program,  i m really unfamiliar with this environment.

 Any suggestions are appreciated !
 bye
D has built in support for unit testing. It's a very simple system but it should cover the first point, regressions. It's possible to build a library solution on top with more features. D also supports contract programming via pre and post conditions. http://dlang.org/unittest.html http://dlang.org/dbc.html I have a very simple unit test framework part of my serialization library: https://github.com/jacob-carlborg/orange/blob/master/orange/test/UnitTester.d -- /Jacob Carlborg
Aug 09 2012
parent reply simendsjo <simendsjo gmail.com> writes:
On Thu, 09 Aug 2012 15:41:44 +0200, Jacob Carlborg <doob me.com> wrote:

 On 2012-08-09 13:24, maboiteaspam wrote:
 Hi,

 I m looking for some methods/tools to implement tests on my very little
 application about strings manipulation.

 I m looking to
 - avoid regressions
 - measure performance
 - learn it

 I made a quick search on the newsgroup archives, without success.

 In case my question is obvious, i would say that this is my very first
 desktop program,  i m really unfamiliar with this environment.

 Any suggestions are appreciated !
 bye
D has built in support for unit testing. It's a very simple system but it should cover the first point, regressions. It's possible to build a library solution on top with more features. D also supports contract programming via pre and post conditions. http://dlang.org/unittest.html http://dlang.org/dbc.html I have a very simple unit test framework part of my serialization library: https://github.com/jacob-carlborg/orange/blob/master/orange/test/UnitTester.d
There's also dunit: https://github.com/jmcabo/dunit and benchmark from std.datetime: http://dlang.org/phobos/std_datetime.html#benchmark
Aug 09 2012
parent simendsjo <simendsjo gmail.com> writes:
On Thu, 09 Aug 2012 17:39:34 +0200, simendsjo <simendsjo gmail.com> wrote:

 On Thu, 09 Aug 2012 15:41:44 +0200, Jacob Carlborg <doob me.com> wrote:

 On 2012-08-09 13:24, maboiteaspam wrote:
 Hi,

 I m looking for some methods/tools to implement tests on my very little
 application about strings manipulation.

 I m looking to
 - avoid regressions
 - measure performance
 - learn it

 I made a quick search on the newsgroup archives, without success.

 In case my question is obvious, i would say that this is my very first
 desktop program,  i m really unfamiliar with this environment.

 Any suggestions are appreciated !
 bye
D has built in support for unit testing. It's a very simple system but it should cover the first point, regressions. It's possible to build a library solution on top with more features. D also supports contract programming via pre and post conditions. http://dlang.org/unittest.html http://dlang.org/dbc.html I have a very simple unit test framework part of my serialization library: https://github.com/jacob-carlborg/orange/blob/master/orange/test/UnitTester.d
There's also dunit: https://github.com/jmcabo/dunit and benchmark from std.datetime: http://dlang.org/phobos/std_datetime.html#benchmark
And unittest blocks of course: unittest { // test code here } dmd -unittest
Aug 09 2012