- Test-Driven Java Development(Second Edition)
- Alex Garcia Viktor Farcic
- 74字
- 2021-06-24 18:31:55
Test – winning condition I
Now that we have declared what the default response is (No winner), it's time to start working on different winning conditions:
@Test public void whenPlayAndWholeHorizontalLineThenWinner() { ticTacToe.play(1, 1); // X ticTacToe.play(1, 2); // O ticTacToe.play(2, 1); // X ticTacToe.play(2, 2); // O String actual = ticTacToe.play(3, 1); // X assertEquals("X is the winner", actual); }
The player wins when the whole horizontal line is occupied by his pieces.
推薦閱讀
- C++面向?qū)ο蟪绦蛟O(shè)計(jì)(第三版)
- Java范例大全
- Effective C#:改善C#代碼的50個(gè)有效方法(原書(shū)第3版)
- Swift 3 New Features
- 游戲程序設(shè)計(jì)教程
- Interactive Applications Using Matplotlib
- 運(yùn)用后端技術(shù)處理業(yè)務(wù)邏輯(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- Rust游戲開(kāi)發(fā)實(shí)戰(zhàn)
- Hadoop 2.X HDFS源碼剖析
- C編程技巧:117個(gè)問(wèn)題解決方案示例
- Python計(jì)算機(jī)視覺(jué)和自然語(yǔ)言處理
- ASP.NET Web API Security Essentials
- Learning Bootstrap 4(Second Edition)
- Building a Media Center with Raspberry Pi
- Kotlin程序員面試算法寶典