Texas Hold’em with Cgreen

I’ve ben involved with the development of Cgreen for a few years, so when Software Craftsmanship Linköping asked me to do a TDD session for them I obviously choose that as my basis.

Cgreen is nice for allowing modern TDDing in C (and C++) using fluent API, mocks and the rest.

I talked and we coded. I selected the Texas Hold’em kata, which is interesting because of the multitude of dimensions that need to be covered. It is also a good kata to retry to experiment with different order of the tests. (Actually, I did it from memory and got it wrong, players have 2 private cards and community cards are delt until player folds. So the tests below are inaccurate.)

Here are the tests (of course I wrote one at a time with red-green-refactor in between):

And here is the implementation (C string handling is a bit hairy…):

Note that I’m not nearly done. That’s another thing with this kata, it’s long. E.g. there are a number of smaller refactorings that I’d like to do from this point.

What’s you suggestion for next action? Next test?

One thought on “Texas Hold’em with Cgreen”

Leave a Reply

Your email address will not be published. Required fields are marked *