Up to Main Index Up to Journal for June, 2019 JOURNAL FOR MONDAY 10TH JUNE, 2019 ______________________________________________________________________________ SUBJECT: An update on WolfMUD & the importance of testing the right things DATE: Mon 10 Jun 19:11:55 BST 2019 It seems like ages since I did any coding for WolfMUD. Some people have said it’s burnout. In reality I’ve just had a lot going on in real life. My little world, such as it is, has been turned upside down and thoroughly trashed. As a result getting into WolfMUD mode has been a struggle. It’s one reason why I dug out ‘The Cottage’ again — as a total distraction from all the ugly. However, I’ve put ‘The Cottage’ away for now and picked up WolfMUD again :) Well, at least I tried to :( I literally just stopped working on WolfMUD. I had incomplete changes laying around in various directories and half implemented ideas begging to be realised. First order of the day was to work out where I was and what I was doing… Back at the beginning of May[1] I was working on the new matcher code and testing player commands. The testing was getting to me — I could see myself writing masses of tests. I think this may have been another reason for picking up ‘The Cottage’ again. I’d even looked at scripting the tests, which I now realise was probably a terrible idea. Anyway, I started picking over my changes and filling my head with the code again, fixing a few items here and there as I went. It was while sauntering through the code that I suddenly realised I was testing the wrong things. I had written the tests for the WHICH command and then for GET and DROP. Each time the tests were actually exercising the matcher code and not the commands themselves. Hindsight, 20/20, yeah I know… I have now taken the tests for the WHICH command and rewritten them as proper tests for the matcher. In doing so I found and fixed two bugs. The first bug caused a ‘not enough’ result to be shadowed by an ‘unknown’ result. For example, assuming we have some chalk and one apple... >WHICH CHALK BALL 2ND APPLE You see some chalk here. You see no 'BALL' here. > The apple has been ignored. The response should include a “You don't see that many ‘APPLE’ here.” message. The second bug caused non-unique results to be returned by the matcher. For example: >WHICH BALL BALL You see a small green ball here. You see a small green ball here. >WHICH 1-3 BALL 2-4 BALL You see a small green ball here. You see a large green ball here. You see a large red ball here. You see a large red ball here. You see a small red ball here. You see a small red ball here. > The second example is interesting as it involves overlapping ranges. The correct output should be: >WHICH BALL BALL You see a small green ball here. >WHICH 1-3 BALL 2-4 BALL You see a small green ball here. You see a large green ball here. You see a large red ball here. You see a small red ball here. > Both of these issues have now been fixed. The fixes and new tests for the matcher have been pushed out to the public dev branch. Things I need to do next: - Finish the matcher tests — they currently only cover the MatchAll method. - Update the WHICH tests to specifically test the command, not the matcher. - Rewrite the (unreleased) tests for the GET and DROP commands. - Reimplement the EXAMINE, JUNK, PUT, TAKE, READ, OPEN and CLOSE commands to use the new matcher code. It may seem strange to update the OPEN and CLOSE commands. However, this will allow players to interact with more than one door in a location. Players will be able to say things like ‘OPEN EAST DOOR’, ‘OPEN 2ND DOOR’, ‘OPEN RED DOOR’, ‘OPEN FRONT DOOR’. I’m even thinking of adding the direction qualifier of the door, for example ‘EAST’, automatically where possible. After all of that, I think I’ve earned a release. WolfMUD v0.0.14 anyone? It’s going to be a large release, already over 60 commits, and will include the inventory rework, per IP quotas, recordjar fixes and the updated player commands. -- Diddymus [1] Journal for 4th May; With time comes wisdom… ../5/4.html Up to Main Index Up to Journal for June, 2019