Skip to content

Commit

Permalink
tests: add BwClassTest
Browse files Browse the repository at this point in the history
  • Loading branch information
handymenny committed Nov 7, 2024
1 parent d56c19c commit 28780a7
Showing 1 changed file with 133 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package it.smartphonecombo.uecapabilityparser.model

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

internal class BwClassTest {

@Test
fun validFromString() {
val bwc = "A"
val actual = BwClass.valueOf(bwc).toString()
val expected = "A"

assertEquals(expected, actual)
}

@Test
fun invalidFromString() {
val bwc = "#@*"
val actual = BwClass.valueOf(bwc)
val expected = BwClass.INVALID

assertEquals(expected, actual)
}

@Test
fun noneFromString() {
val bwc = ""
val actual = BwClass.valueOf(bwc)
val expected = BwClass.NONE

assertEquals(expected, actual)
}

@Test
fun noneFromString2() {
val bwc = null
val actual = BwClass.valueOf(bwc)
val expected = BwClass.NONE

assertEquals(expected, actual)
}

@Test
fun validFromIndex() {
val bwc = 4
val actual = BwClass.valueOf(bwc).toString()
val expected = "D"

assertEquals(expected, actual)
}

@Test
fun validFromIndex2() {
val bwc = 6
val actual = BwClass.valueOf(bwc).toString()
val expected = "F"

assertEquals(expected, actual)
}

@Test
fun invalidFromIndex() {
val bwc = 100
val actual = BwClass.valueOf(bwc)
val expected = BwClass.INVALID

assertEquals(expected, actual)
}

@Test
fun invalidFromIndex2() {
val bwc = -100
val actual = BwClass.valueOf(bwc)
val expected = BwClass.INVALID

assertEquals(expected, actual)
}

@Test
fun noneFromIndex() {
val bwc = 0
val actual = BwClass.valueOf(bwc)
val expected = BwClass.NONE

assertEquals(expected, actual)
}

@Test
fun validFromMtkIndex() {
val bwc = 0
val actual = BwClass.valueOfMtkIndex(bwc).toString()
val expected = "A"

assertEquals(expected, actual)
}

@Test
fun validFromMtkIndex2() {
val bwc = 5
val actual = BwClass.valueOfMtkIndex(bwc).toString()
val expected = "F"

assertEquals(expected, actual)
}

@Test
fun invalidFromMtkIndex() {
val bwc = 7
val actual = BwClass.valueOfMtkIndex(bwc)
val expected = BwClass.INVALID

assertEquals(expected, actual)
}

@Test
fun invalidFromMtkIndex2() {
val bwc = -7
val actual = BwClass.valueOfMtkIndex(bwc)
val expected = BwClass.INVALID

assertEquals(expected, actual)
}

@Test
fun noneFromMtkIndex() {
val bwc = 6
val actual = BwClass.valueOfMtkIndex(bwc)
val expected = BwClass.NONE

assertEquals(expected, actual)
}
}

0 comments on commit 28780a7

Please sign in to comment.