Is unit testing viable in game programming?

后端 未结 7 1089
-上瘾入骨i
-上瘾入骨i 2021-01-30 01:06

I\'m fond of the idea of unit testing but I\'m having trouble applying it to game programming. Games are highly stateful and often the code doesn\'t break itself into distinct u

7条回答
  •  星月不相逢
    2021-01-30 01:42

    Unit tests can be useful for a lot of the low level libraries you may use with game code but I seriously doubt it is of much use for the higher level stuff. Games are usually simulations and rely on massive amounts of shared state which can't meaningfully be mocked up and tested in isolation. Often functions in games do not return any sort of value that you can instantly check but instead set a process in motion which should complete at some point in the future. Testing such behaviour is worthwhile but requires a significantly different approach to the unit test idea of testing pieces of code in isolation.

提交回复
热议问题