注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
有一个简单的design题,写一个走路的程序,一个5x5的棋盘, 物体有(x,y,方向)这些属性,move 向前,left/right旋转,place重置位置。
程序很简单 我写成了一个console 程序,while(cin, command) 来读命令。 关键是要求提供测试数据来证明程序是对的
- There must be a way to supply the application with input data.
- Provide test data to exercise the application.
- The application must run and you should provide sufficient evidence that your solution is complete by, as a minimum, indicating that it works correctly against the supplied test data
- you may use external libraries or tools for building or testing purposes. Specifically, you may use unit testing libraries or build tools available for your chosen language
我估计他是让你写unit test.
我的问题是,Unittest里面就是 判断做了一个操作以后的位置是不是指定的位置,这个指定的位置肯定是hardcode的,不可能是按照逻辑算出来的, 因为操作本身是程序算出来的,期望位置也是算出来的话这比较就没有意义。 那如果是手写,怎么完全覆盖呢? 5x5的位置有25个起始位置,操作组合无数种,我不可能每种情况都写个test case啊
|