Choosing a testing system

25 November 2009

It’s a first step in starting to create software using Test-Driven Development – deciding on how you want to write the tests.  Having decided that I wanted to give TDD a good ol’ fashioned college try for my next projects (still somewhat under wraps), I found myself faced with a plethora of testing suites for C++ that were – no offense to the authors, effort and massive amount of time that obviously went into them all – not very good.

Being used to the simplicity of writing tests in C# using NUnit, I think I was a bit spoiled.  Having to derive classes from a test class, declare tests in a header then implement them in a source file, manually add tests to a runner, and implement my own main() function to create and run a test suite – and almost every testing system for C++ I looked at required me to do at least one of these – seems like a lot more effort and room for mistake than I wanted in my testing suite.

Noel Llopis gave an excellent run-down of available testing suites for C++ on his blog a while back – it’s a fantastic read and I recommend you look at it if you want a full discussion of the available options.  Having read the article myself I ended up needing to decide between only two suites: cxxtest, and UnitTest++.  The former ended up being the victor of the available suites in Noel’s blog – the latter was written by Noel to fill the absence of a suite he actually wanted to use.  Both implement the kind of easy creation of tests that I’m looking for.

They have their differences though: cxxtest uses Python (or Perl) to create the actual test code, parsing the header files defining the tests to create the implementation of the tests themselves.  This makes the tests easy to write (just a header file), but it requires having Python or Perl installed on the system and setting the project or makefile up to generate and run the tests.
UnitTest++ on the other hand uses macros: the tests are defined in a source file using the TEST(testName) macro, which contains enough magic to turn the test into legal C++ and automatically register it.  Organising tests into fixtures is a little different, as it’s designed to make it easy to create reusable variables without requiring accessors on them, which overall makes them quicker to use than the member variables in cxxtest.

In the end I’ve ended up going with cxxtest, despite the advantages offered by UnitTest++.  My main reasoning behind this is that cxxtest has been seen working on an OSX build server (like ours will be), and as far as I know UnitTest++ may not have been.  If I’m proved wrong, I may end up switching.  But for now, we’re going with cxxtest.

 | Posted by | Categories: Blog | Tagged: , , , , |

Ubiquitous notepadding

19 November 2009

I was recently introduced to the concept of ubiquitous capture, recently popularised in the David Allen book Getting Things Done.  I haven’t actually read the book yet, but a friend explained this part of it to me and I took an instant liking to it.

Basically, the idea is to “never have a thought twice”.  Anytime I think of something I should do, or that can be improved, or that I’d like to aim for etc. – I write it down.  The very first step of organising ones self, is to capture the data that needs to be organised.

The most important question for any interested aficionado of ubiquitous capture is how to do it.  From what I’ve read around the interblags it seems everyone find their own way to implement ubiquitous capture in their lives.  Some use post-its, others prefer note-taking apps on their phones or iPods.  The tools that work for some, work work for others, and vice versa.

For me, I find note-taking apps too slow to load, too difficult to type into, and somewhat limited when it comes to adding pictures or sketches.  The best option for me is this guy:IMG_1132

$22 from Dymocks, and it’s one of the best purchases I’ve ever made.  After years of trying to get synergy happening with PDA’s, phones, netbooks and laptops it turns out that the best solution for me is the simple back-pocket notebook.  I can write my notes, draw little pictures or diagrams, get phone numbers when I make new friends etc. so easily now!IMG_1133

Sure, it’s illegible to anyone but me.  But I’ll deal with that when I try to back it up :)

 | Posted by | Categories: Blog |

Uncharted 2

12 November 2009

The latest IP from Naughty Dog Studios, a studio that originally rose to fame in the Playstation days with Crash Bandicoot, and in the PS2 days with their Jak and Daxter games, is called ‘Uncharted’.  Anyone with a PS3 is familiar with the license, but for those who aren’t: the stories revolve around the character Nate Drake, a bar-brawling, one-lining, running, gunning treasure hunter and part-time ladies man.  I think Yahtzee summed the character up quite nicely when he described him as “Indiana Jones as written by Joss Whedon”.

Anyway, Drakes latest foray into stealing Lara Croft’s mojo is Uncharted 2: Among Thieves, and it bears a lot of similarity to the first Uncharted game.  In this outing Drake is looking for The Chintomani stone: a giant sapphire that sounds irrationally impossible to sell to anyone once he drags it home.  Oblivious to these glaring issues, the story happily charges, flash-back driven, through several countries and missions, introducing new characters and reuniting us with old ones from the previous game along the way.  The gameplay remains essentially unchanged – alternating between third-person shooting and jumping puzzles, with a rarely-used melee mechanic thrown in there.  And cutscenes.  A lot of cutscenes.

One of the (maybe) new mechanics in Among Thieves is the ability to sneak up behind enemies and take them out all stealthy.  I say maybe because as far as I know it might have actually been in the first game but I never used it.  It often makes a nice change to sneak up and take out a couple enemies silently before the real shooting starts – but that’s pretty much all you can do with stealth in the game.  The few missions that try to strongarm you into being stealthy the whole time show off the glaring issues with the stealth system: it’s almost impossible to tell if an enemy will or won’t see you.  There’s no light-dark meter like Splinter Cell, no visibility gem like Thief – sometimes it works perfectly and the enemies obliviously walk past the newly added corpse on the corner – other times they see your left toe and shoot you in the face.

Speaking of corpses, this is another thing that disturbed me about Uncharted 2.  In the original, I could at least pretend that my main character was murdering hundreds of people in self-defence.  In the second one, the character mercilessly sneaks up behind them and removes them from play with a sickening crack of the neck.  It’s not really self-defence at this point.  It’s just murdering people because they’re standing between you and the shiny treasure.  And to add irony, the games storyline becomes all about stopping a mass murderer – who at the end of the game has killed about 398 less people than I have.

Anyway – summing up, UC2 is samey, predictable, cliched and all the characters are smarmy and annoying.  The game looks good, but it tries far too hard to be a movie that it will only ever be a mediocre game.

 | Posted by | Categories: Blog |