Tuesday, March 06, 2007

Dice

You can follow my progress at  http://flyingsheep.com/dicetest/test.asp
 
Back to it
 After a brief enjoyable break to play some Guitar Hero II and BattleLore, I'm back. My next goal is to create a Character class, add an attribute, and set the attribute by rolling 3d6 (sound familiar?).

Delay
 Finding my RL friends on Live Journal. I'm probably a few years behind the curve here, but there's a tangled web, and it's difficult to resist the urge to tease out a few strands and bookmark them. RSS Feeds are the next step, but for today, bookmarks will have to do.
 Also spent some time working on the intellisense problem with ASP classes. No progress.

Gunthar the Barbarian
 Created a character. Tested to make sure name matches Gunthar and archetype (class) matches Barbarian. Is it okay to pass parameters to tests? I'm thinking I might have to include an array of parameters in the test function definition (strTestResult, blnTestPassed, [arrParameters?]). I'm also thinking that I should move my successful tests out of the main file that I'm working in (just to tidy up a bit).
 The freedom to move things around and not worry about breaking something (and, worse, not realizing its been broken until much later) is exhilarating!

Generic Functions
 I need a generic function AssertNumberInRange(lngNumber, lngRangeMin, lngRangeMax, strResult). I'll write one and then refactor some of the tests.

Debugging
 For the first time so far, it took more than a minute for me to find the error. I fell back into debugging. It's a frustrating sign that I'm trying to move too fast. I've got to get back to baby steps.
 I was trying to test both the new Assert..Range function and the Character stat rolling function. I got greedy.
 Used the Assert Range function to find a bug in the stat rolling function. Investigating. Ah ha! ObjDie doesn't return the value. It simply sets objDie.Value. Hmm... Maybe I want to change that. If I can't remember how it worked this morning, that's not intuitive design.

So, Tell Me About Yourself
 I like my classes to have a .DebugPrint() method that returns an HTML formatted string with various information (state, variables, etc.) about itself. This helps debugging, of course. It end up being a holdover from my pre-TDD days (e.g. yesterday), but I'm going to give it a try.

Test too complicated?
 I've got a single test called CreateBasicCharacter. It's probably not descriptive enough. It does a lot of things, too - checks the name, the archetype, the strength, etc.

Adding function CDie.RollMultipleDice(lngNumberOfDice)
 Oops - I got a stack error. I guess if RollMultipleDice calls Roll(), I can't simplify Roll() by calling RollMultipleDice(1). Ha! Adding some tests for Multiple Dice Rolling.

Ok Everything working
5 Tests running. Progress is being made. Time for dinner.

0 Comments:

Post a Comment

<< Home