Right, I won't have a lot of development time ahead of me, but at any rate I'd like to setup a couple of tests for the structures I have in place right now. The plan is to pull in cxxtest, and then create a semi-complex level file and load that when running the tests.
That worked surprisingly well! I've got a pretty complete set of tests for the LevelFloor classes and the stuff below. I'll spend the next couple of days adding to this test base, because I wish so hard I had done this for Galder. I'm a bit unsure about the next steps forward, and I have a metric ton of other development chores to take care of, so I might as well pause for a couple of days and see where I'm going.
While setting up a test for BaseLevel, I stumbled into the memory ownership problem outlined above. I want to call cpSpaceFreeChildren to make sure I remove all of the shapes I'm not keeping around, but StaticBody wants to free its body pointer (which was already killed by FreeChildren). I think I've resolved to keep a flag around to track whether a body is currently added to a space. I think that is a good solution, since I have at least one active cpBody that is not added to a cpSpace: a level's rigid wall body.
Phew, it's been a while since last I pulled an all-nighter, but I've setup good tests for all the modules, which I'm proud of. Looking forward to writing new functionality with the test suites in place, TDD looks interesting.
No comments:
Post a Comment