Comparaison operators in Slim for Fitnesse

Now that the release of Slim is done, Bob Martin is spending time producing tutorial videos. The new one is about comparaisons in Slim.

There are two majors things to learn in it:

  • approximate equals
  • ranges

The ~= sign means “approximately equals to”, and depends on the number of decimals; for example,

~=1.3

in a cell will work for any value between 1.2 and 1.4.

A range allows Slim to accept results between boundaries. For example, put something like

1<_<8

in a cell and all values between 1 and 8 will be considered valid. This is something that some versions of Fit could do, but not all. With Slim, all versions of Slim will support this (since it will be evaluated on the Fitnesse side).

Last thing: Fitnesse contains a rather powerful expression evaluator that is not specific to Slim or Fit.
For example:

!define TIMES {1000}
|${=5*${TIMES}=}|

You can combine this construct with the range, and have something like this in your cell:

${=5*${TIMES}=}<_<${=6*${TIMES}=}

which will appear as

5000<_<6000

when viewing your wiki page.

Finally, you might want to watch out for the coming minor release of Fitnesse.

About Eric Lefevre-Ardant

Independent technical consultant.
This entry was posted in fit, tdr. Bookmark the permalink.

2 Responses to Comparaison operators in Slim for Fitnesse

  1. Pingback: Eric Lefevre-Ardant on Java & Agile » Bob Martin on Hudson

  2. Pingback: Why I use Twitter « Eric Lefevre-Ardant on Java & Agile

Comments are closed.