Friday, June 25, 2010

Test Framework Update

As planned, I've created test cases that research each TechType and fully upgrade each UpgradeType. Like before, adding these test cases has revealed several bugs which I have since fixed:
  • Fixed a bug where Unit::getRemainingResearchTime would sometimes return 0 due to latency.
  • Fixed a bug where Unit::getRemainingUpgradeTime would sometimes return 0 due to latency.
  • Fixed a bug where Game::canResearch would return true while another unit was researching the same TechType.
  • Fixed a bug where Game::canUpgrade would return true while another unit was upgrading the same UpgradeType.
  • Fixed a bug with UpgradeType::Apial_Sensors.whatResearches() so that it now correctly returns UnitTypes::Protoss_Fleet_Beacon.
I've also added the following two new error codes:
  • Error::Currently_Researching - generated when you try to tell a unit to research a TechType that is already being researched (at that unit or another unit).
  • Error::Currently_Upgrading - generated when you try to tell a unit to upgrade an UpgradeType that is already being upgraded (at that unit or another unit).

Since each special ability affects the game state in a unique way, creating UseTech test cases for each special ability may take a few days. For example, to check that the Stasis ability works, I'll need to check the target unit to verify that it is Stasised, while to check that Dark Swarm works correctly I'll need to verify that a Dark Swarm unit is produced at the target position.

Earlier today I fixed the following bugs related to Protoss Interceptors:
  • Fixed Unit::getTransport so that it works for Protoss Interceptors
  • Fixed Unit::isLoaded so that it returns true if and only if Unit::getTransport!=NULL.
  • Fixed Unit::getLoadedUnits so that it also returns the Interceptors currently loaded inside a Protoss Carrier.
  • Fixed a bug where Unit::getPosition and Unit::getTilePosition would return incorrect positions for loaded units.
I also added the following functions to the interface:
  • Unit::getCarrier - return the Carrier that created this Protoss Interceptor
  • Unit::getInterceptors - returns the Interceptors controlled by this Protoss Carrier.
  • Unit::getNydusExit - should return the connect Nydus Canal Exit (untested)
The one remaining bug with Protoss Interceptors is that the interceptors cannot be detected until they leave the carrier they are loaded in. It should be possible to fix once I change unit detection so that it traverses the other linked lists of Units, not just the main one. Also once this is implemented it should be easy to fix bugs related to unit deaths/removals.

No comments:

Post a Comment