一句话:基于纯函数式 FRP 的引用透明性,提出跨平台的时间逻辑断言、记录回放与随机测试方法。
交互式应用(如视频游戏)的测试与调试面临可复现性差、难以自动生成测试数据等挑战。本文指出,用纯函数式语言实现的某些函数式反应式编程(FRP)变体可在整个程序层面提供引用透明性,从而缓解这些问题。作者据此提出跨平台的多手段方法:基于时间逻辑的断言、运行记录与回放(也可用于已部署代码),以及 QuickCheck 自动随机测试。该方法在 Yampa 实现的真实非平凡游戏上验证,并配有图形界面工具,可控制执行、沿时间线移动并定位断言违规,支持 PC 和移动平台。
Many types of interactive applications, including video games, raise particular challenges when it comes to testing and debugging. Reasons include de-facto lack of reproducibility and difficulties of automatically generating suitable test data. This paper demonstrates that certain variants of Functional Reactive Programming (FRP) implemented in pure functional languages can mitigate such difficulties by offering referential transparency at the level of whole programs. This opens up for a multi-pronged approach for assisting with testing and debugging that works across platforms, including assertions based on temporal logic, recording and replaying of runs (also from deployed code), and automated random testing using QuickCheck. The approach has been validated on real, non-trivial games implemented in the FRP system Yampa through a tool providing a convenient Graphical User Interface that allows the execution of the code under scrutiny to be controlled, moving along the execution time line, and pin-pointing of violations of assertions on PCs as well as mobile platforms.