snake-biscuits / bsp_tool

Python library for analysing .bsp files
GNU General Public License v3.0
102 stars 8 forks source link

SpecialLumpClass testing #114

Open snake-biscuits opened 1 year ago

snake-biscuits commented 1 year ago

Forgot to write tests when all the SpecialLumpClasses got refactored in #68

112 shows how big a mistake that was

.from_bytes() -> .as_bytes() -> .from_bytes shouldn't mutate Some data loss is OK (comments in Entities etc.), but we should strive towards byte-for-byte

__init__ should also create a valid object

Some test maps & in-game checks will be needed in places (will it load? crash?) Plenty of SpecialLumpClasses can be tested w/ tailored samples w/o a test map

SpecialLumpClasses w/ enough tests

snake-biscuits commented 1 year ago

Currently working on id_software.quake2.Visibility as part of #112 valve_physics.Displacement / strata.strata.PhysicsDisplacement shared.Entities needs to test all known edge cases for regression shared.PakFile needs to confirm ZIP_DEFLATE compression etc. (strict standard) valve_physics.CollideLump is broken, write xfail tests for now quake.MipTextureLump needs bounds & size estimate checking (use a test map) The rest are string-based, should be fairly simple to test

snake-biscuits commented 1 year ago

Each test should live in a class inside it's branch script's test file:

# tests/branches/id_software/test_quake.py

class TestMipTextureLump:
    ...
snake-biscuits commented 1 year ago

include GameLumpClasses

counts GameLumpClasses as SpecialLumpClasses, we should as well valve.source.GameLump_sprp.as_bytes() fails to process model_names correctly:

Since we'll want samples for automated testing, this ties into:

Also related:

NOTE: shouldn't introduce any new GameLumpClasses (only StaticPropClasses), but we should be aware of it

snake-biscuits commented 6 months ago

Only 4 GameLump_SPRP classes define .from_bytes classmethods:

So we only really need to test those 4, the rest just set some common variables: