- Test-Driven Java Development(Second Edition)
- Alex Garcia Viktor Farcic
- 74字
- 2021-06-24 18:31:55
Test – winning condition III
Now that horizontal and vertical lines are covered, we should move our attention to diagonal combinations:
@Test public void whenPlayAndTopBottomDiagonalLineThenWinner() { ticTacToe.play(1, 1); // X ticTacToe.play(1, 2); // O ticTacToe.play(2, 2); // X ticTacToe.play(1, 3); // O String actual = ticTacToe.play(3, 3); // X assertEquals("X is the winner", actual); }
The player wins when the whole diagonal line from the top-left to bottom-right is occupied by his pieces.
推薦閱讀
- 流量的秘密:Google Analytics網(wǎng)站分析與優(yōu)化技巧(第2版)
- Learning Spring 5.0
- Clojure for Domain:specific Languages
- Securing WebLogic Server 12c
- Learning Three.js:The JavaScript 3D Library for WebGL
- 用戶體驗(yàn)增長(zhǎng):數(shù)字化·智能化·綠色化
- Learning Raspbian
- HoloLens與混合現(xiàn)實(shí)開(kāi)發(fā)
- Unity 2018 Augmented Reality Projects
- C語(yǔ)言程序設(shè)計(jì)習(xí)題與實(shí)驗(yàn)指導(dǎo)
- Cocos2d-x Game Development Blueprints
- 快樂(lè)編程:青少年思維訓(xùn)練
- Moodle 3.x Developer's Guide
- Docker on Windows
- Python機(jī)器學(xué)習(xí)