Thread overview
HOWTO: automatic test a D program
Aug 09, 2012
maboiteaspam
Aug 09, 2012
Jacob Carlborg
Aug 09, 2012
simendsjo
Aug 09, 2012
simendsjo
August 09, 2012
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
August 09, 2012
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
August 09, 2012
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
August 09, 2012
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