diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-23 10:39:46 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-23 10:39:46 -0700 |
commit | e48d21718c3a0b0663fb5e2a7ca67a20853df584 (patch) | |
tree | ab4dd19c754f07904643f512e494be3556a4b354 /library/src/test | |
parent | ff17cd5daac40418e6e1bc89e9f65bd0fc8ea6af (diff) | |
download | kau-e48d21718c3a0b0663fb5e2a7ca67a20853df584.tar.gz kau-e48d21718c3a0b0663fb5e2a7ca67a20853df584.tar.bz2 kau-e48d21718c3a0b0663fb5e2a7ca67a20853df584.zip |
Rgba string
Diffstat (limited to 'library/src/test')
-rw-r--r-- | library/src/test/java/ca/allanwang/kprefs/library/ExampleUnitTest.java | 17 | ||||
-rw-r--r-- | library/src/test/kotlin/ca/allanwang/kprefs/library/UtilsTest.kt | 25 |
2 files changed, 25 insertions, 17 deletions
diff --git a/library/src/test/java/ca/allanwang/kprefs/library/ExampleUnitTest.java b/library/src/test/java/ca/allanwang/kprefs/library/ExampleUnitTest.java deleted file mode 100644 index 12e478b..0000000 --- a/library/src/test/java/ca/allanwang/kprefs/library/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package ca.allanwang.kprefs.library; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } -}
\ No newline at end of file diff --git a/library/src/test/kotlin/ca/allanwang/kprefs/library/UtilsTest.kt b/library/src/test/kotlin/ca/allanwang/kprefs/library/UtilsTest.kt new file mode 100644 index 0000000..c2c96e4 --- /dev/null +++ b/library/src/test/kotlin/ca/allanwang/kprefs/library/UtilsTest.kt @@ -0,0 +1,25 @@ +package ca.allanwang.kprefs.library + +import android.graphics.Color +import ca.allanwang.kau.utils.round +import ca.allanwang.kau.utils.toHexString +import org.junit.Test +import kotlin.test.assertEquals + +/** + * Created by Allan Wang on 2017-06-23. + */ +class UtilsTest { + + @Test + fun colorToHex() { + assertEquals("#ffffff", Color.WHITE.toHexString(withAlpha = false, withHexPrefix = true).toLowerCase()) + } + + @Test + fun rounding() { + assertEquals("1.23", 1.23456f.round(2)) + assertEquals("22.466", 22.465920439.round(3)) + assertEquals("22", 22f.round(3)) + } +}
\ No newline at end of file |