Remove tests. need to rewrite them.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,55 +0,0 @@
|
|||||||
package me.zobrist.tichucounter
|
|
||||||
|
|
||||||
import me.zobrist.tichucounter.domain.History
|
|
||||||
import me.zobrist.tichucounter.domain.Round
|
|
||||||
import org.junit.Assert.assertEquals
|
|
||||||
import org.junit.Assert.assertNotEquals
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
class HistoryUnitTest {
|
|
||||||
@Test
|
|
||||||
fun calculation_isCorrect() {
|
|
||||||
val history = History()
|
|
||||||
|
|
||||||
history.revertLastRound()
|
|
||||||
history.getHistoryA()
|
|
||||||
history.getHistoryB()
|
|
||||||
history.getScoreA()
|
|
||||||
history.getScoreB()
|
|
||||||
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
history.logRound(Round(10, 10))
|
|
||||||
|
|
||||||
assertEquals(100, history.getScoreA())
|
|
||||||
assertEquals(100, history.getScoreB())
|
|
||||||
|
|
||||||
history.revertLastRound()
|
|
||||||
|
|
||||||
assertEquals(90, history.getScoreA())
|
|
||||||
assertEquals(90, history.getScoreB())
|
|
||||||
|
|
||||||
assertNotEquals("", history.getHistoryA())
|
|
||||||
assertNotEquals("", history.getHistoryB())
|
|
||||||
|
|
||||||
history.clearAll()
|
|
||||||
assertEquals(0, history.getScoreA())
|
|
||||||
assertEquals(0, history.getScoreB())
|
|
||||||
|
|
||||||
|
|
||||||
assertEquals("", history.getHistoryA())
|
|
||||||
assertEquals("", history.getHistoryB())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
package me.zobrist.tichucounter
|
|
||||||
|
|
||||||
import me.zobrist.tichucounter.domain.Round
|
|
||||||
import org.junit.Assert.*
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
class RoundUnitTest {
|
|
||||||
@Test
|
|
||||||
fun calculation_isCorrect() {
|
|
||||||
|
|
||||||
var inputScoreA = 125
|
|
||||||
var inputScoreB = -25
|
|
||||||
var temp: Round
|
|
||||||
|
|
||||||
// Normal round range -25 to 125 as input
|
|
||||||
while (inputScoreB <= 125) {
|
|
||||||
temp = Round(inputScoreA, true)
|
|
||||||
assertEquals(inputScoreB, temp.scoreB)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
temp = Round(inputScoreA, false)
|
|
||||||
assertEquals(inputScoreB, temp.scoreA)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
inputScoreA -= 5
|
|
||||||
inputScoreB += 5
|
|
||||||
}
|
|
||||||
|
|
||||||
// Double win
|
|
||||||
temp = Round(200, true)
|
|
||||||
assertEquals(0, temp.scoreB)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
temp = Round(200, false)
|
|
||||||
assertEquals(0, temp.scoreA)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
// Double win with Tichu
|
|
||||||
temp = Round(300, true)
|
|
||||||
assertEquals(0, temp.scoreB)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
temp = Round(300, false)
|
|
||||||
assertEquals(0, temp.scoreA)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
// Double win with Grand Tichu
|
|
||||||
temp = Round(400, true)
|
|
||||||
assertEquals(0, temp.scoreB)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
temp = Round(400, false)
|
|
||||||
assertEquals(0, temp.scoreA)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
//Good rounds
|
|
||||||
temp = Round(0, 0)
|
|
||||||
assertTrue(temp.isValidRound())
|
|
||||||
|
|
||||||
//Bad rounds
|
|
||||||
temp = Round(5, 12)
|
|
||||||
assertFalse(temp.isValidRound())
|
|
||||||
|
|
||||||
temp = Round(12, 5)
|
|
||||||
assertFalse(temp.isValidRound())
|
|
||||||
|
|
||||||
temp = Round(5, 55)
|
|
||||||
assertFalse(temp.isValidRound())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user