From a043a16a6e9a192e2760d9b43197a9383b7790c2 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 19 Oct 2017 12:10:34 +0200 Subject: Unit tests --- src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt | 10 ++++++++++ .../test/pl/treksoft/kvision/utils/UtilsSpec.kt | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt diff --git a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt index fbda7a45..87c0e87f 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt @@ -18,6 +18,16 @@ interface TestSpec { } } +interface SimpleSpec : TestSpec { + + override fun beforeTest() { + } + + override fun afterTest() { + } + +} + interface DomSpec : TestSpec { override fun beforeTest() { diff --git a/src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt new file mode 100644 index 00000000..5ea10c7a --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt @@ -0,0 +1,19 @@ +package test.pl.treksoft.kvision.utils + +import pl.treksoft.kvision.utils.Utils +import test.pl.treksoft.kvision.SimpleSpec +import kotlin.test.Test +import kotlin.test.assertEquals + +class UtilsSpec : SimpleSpec { + + @Test + fun intToHexString() { + run { + val res = Utils.intToHexString(0xabcdef) + assertEquals("abcdef", res, "Should convert int value to hex string") + val res2 = Utils.intToHexString(0x123456) + assertEquals("123456", res2, "Should convert int value to hex string") + } + } +} \ No newline at end of file -- cgit