高级农民
- 积分
- 1064
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2016-8-3
- 最后登录
- 1970-1-1
|
程序里还有两个错误一直没解决。满分的同学能否给点提示?谢谢!
BruteCollinearPoints.java和FastCollinearPoints.java里各一个错误,类型相同。
Test 10: Check that data type is immutable by testing whether each method
returns the same value, regardless of any intervening operations
* input8.txt
- failed after 12 operations involving BruteCollinearPoints
- first and last call to segments() returned different arrays
- sequence of operations was:
BruteCollinearPoints collinear = new BruteCollinearPoints(points);
collinear.numberOfSegments() -> 2
collinear.numberOfSegments() -> 2
mutate points[] array that was passed to constructor
mutate points[] array that was passed to constructor
collinear.numberOfSegments() -> 2
mutate points[] array that was passed to constructor
collinear.segments()
mutate array returned by last call to segments()
collinear.numberOfSegments() -> 2
collinear.numberOfSegments() -> 2
collinear.segments()
- failed on trial 1 of 100
* equidistant.txt
- failed after 9 operations involving BruteCollinearPoints
- first and last call to segments() returned different arrays
- sequence of operations was:
BruteCollinearPoints collinear = new BruteCollinearPoints(points);
mutate points[] array that was passed to constructor
collinear.segments()
collinear.numberOfSegments() -> 4
mutate points[] array that was passed to constructor
mutate array returned by last call to segments()
collinear.numberOfSegments() -> 4
mutate points[] array that was passed to constructor
collinear.segments()
- failed on trial 1 of 100
==> FAILED
Test 13: Check that data type is immutable by testing whether each method
returns the same value, regardless of any intervening operations
* input8.txt
- failed after 10 operations involving FastCollinearPoints
- first and last call to segments() returned different arrays
- sequence of operations was:
FastCollinearPoints collinear = new FastCollinearPoints(points);
collinear.numberOfSegments() -> 2
collinear.segments()
mutate points[] array that was passed to constructor
collinear.segments()
mutate array returned by last call to segments()
mutate points[] array that was passed to constructor
mutate points[] array that was passed to constructor
collinear.numberOfSegments() -> 2
collinear.segments()
- failed on trial 1 of 100
* equidistant.txt
- failed after 11 operations involving FastCollinearPoints
- first and last call to segments() returned different arrays
- sequence of operations was:
FastCollinearPoints collinear = new FastCollinearPoints(points);
collinear.numberOfSegments() -> 4
collinear.numberOfSegments() -> 4
collinear.segments()
mutate points[] array that was passed to constructor
collinear.segments()
collinear.numberOfSegments() -> 4
collinear.numberOfSegments() -> 4
collinear.numberOfSegments() -> 4
mutate array returned by last call to segments()
collinear.segments()
- failed on trial 1 of 100
==> FAILED
补充内容 (2017-2-28 20:15):
immutable的问题后来解决了。补发下了思路。请帖子内找。 |
|