Do you know how hard it is to find non xxx fan fic pictures of Princess Jasmine on Google Image Search?
I'm converting some of my C++ library code into CoffeeScript. Like everyone else I've a set of 3d maths bits n pieces in the form of helper classes so I thought'd I'd get the across first.
Now I mentioned in the previous post was begining to dawn on me how useful test suites would be for dynamic languages but it was something I hadn't had much exposure to. Well that's changed over the last few days and after a bit of research I've had a go with Jasmine that has a node based implementation.
And yeah, it's been really good. The tests are kind of easy to implement and it exposed quite a few minor things I'd missed. Minor things that could have easily propogated out to be major things a long way away from the actually code if the project I'm toiling on got much bigger.
Here's one of the tests for Vec3 that makes sure if you create a Vec3 with no args it returns a zero vector.
# Vec3 Tests describe 'Vec3', -> it 'can make a Vec3, no args, be 0,0,0', -> got = new Vec3().getArray() expected = [0,0,0] for v,i in expected expect( v ).toBeCloseTo got[i], 10
This one used to fail and in the game code it did so silently.
And now it's all wrapped up nicely in a build task that gets run if any project file changes. Growl even moans at me when it fails.
Test Driven Development seems to be a pretty hot topic recently and I can see how it'd be a pretty cool approach. Start with your tests and then fill out the code until it all passes. I'd be interested in doing something like this for my C++. Anyone got any reccomendations? The hard thing about taking a new approach usually isn't the work to do it but the dead ends you have to go down finding a good path. I've heard googletest is supposed to be pretty good. Any opinions?