The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,230 other followers

Archive for September 8th, 2010

Delphi: Use TStrings to parse non-standard separated strings, and validate it with DUnit tests

Posted by jpluimers on 2010/09/08

Recently, I was at a client where in a project strings had to be split from:

'FI-150 1U; FI-049-I L=20 MM;LET OP LASVORM'


  • 'FI-150 1U'
  • 'FI-049-I L=20 MM'

At first sight, this looks simple: Semicolon Separated Values and you are done.
Not so fast Mr Smart Alec: watch the optional spaces!

The best thing for problems like these is to start with an empty implementation that some units tests covering it.
I use DUnit for Delphi unit testing.

Unit testing should go with code coverage, but there are few Delphi code coverage articles.
I’ll get into code coverage later on, as I’m working with two of the code coverage people to get this to work nicely with Delphi 2010.

Mock objects can be a good addition to unit testing too, so in a future article, I will cover using mock objects with Delphi.

Read the rest of this entry »

Posted in Agile, Conference Topics, Conferences, Delphi, Development, DUnit, Event, Software Development, Unit Testing | 8 Comments »

%d bloggers like this: