Created
October 14, 2019 09:54
-
-
Save ininmm/3fa95f4d878a69b3f10d67a3c193e1ca to your computer and use it in GitHub Desktop.
a test for choosing the max value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun chooseTheMaxValue(first: Int, second: Int, third: Int): Int { | |
// 從三個數中找出最大數 | |
// 假設了一個故意錯誤的邏輯 | |
if (second > third) { | |
return third | |
} | |
if (first > third) { | |
return third | |
} | |
...... | |
return 正確的最大數 | |
} | |
...... | |
@Test | |
fun testSumAndDivide() { | |
assertThat(chooseTheMaxValue(6, 2, 1), `is`(6)) | |
assertThat(chooseTheMaxValue(1, 6, 2), `is`(6)) | |
assertThat(chooseTheMaxValue(1, 2, 6), `is`(6)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment