jvmTest.com.bkahlert.kommons.test.UnicodeFontTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kommons-test Show documentation
Show all versions of kommons-test Show documentation
Kommons Test is a Kotlin Multiplatform Library to ease testing.
package com.bkahlert.kommons.test
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Test
internal class UnicodeFontTest {
@Test fun format() = testAll {
UnicodeFont.Bold.format(capitalLetters) shouldBe "๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐"
UnicodeFont.Italic.format(capitalLetters) shouldBe "๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐
๐๐๐๐๐๐๐๐"
UnicodeFont.BoldItalic.format(capitalLetters) shouldBe "๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐"
UnicodeFont.Script.format(capitalLetters) shouldBe "๐โฌ๐๐โฐโฑ๐ขโโ๐ฅ๐ฆโโณ๐ฉ๐ช๐ซ๐ฌโ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต"
UnicodeFont.BoldScript.format(capitalLetters) shouldBe "๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ"
UnicodeFont.Fraktur.format(capitalLetters) shouldBe "๐๐
โญ๐๐๐๐โโ๐๐๐๐๐๐๐๐โ๐๐๐๐๐๐๐โจ"
UnicodeFont.BoldFraktur.format(capitalLetters) shouldBe "๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐
"
UnicodeFont.DoubleStruck.format(capitalLetters) shouldBe "๐ธ๐นโ๐ป๐ผ๐ฝ๐พโ๐๐๐๐๐โ๐โโโ๐๐๐๐๐๐๐โค"
UnicodeFont.SansSerif.format(capitalLetters) shouldBe "๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น"
UnicodeFont.SansSerifBold.format(capitalLetters) shouldBe "๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ"
UnicodeFont.SansSerifItalic.format(capitalLetters) shouldBe "๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก"
UnicodeFont.SansSerifBoldItalic.format(capitalLetters) shouldBe "๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐"
UnicodeFont.Monospace.format(capitalLetters) shouldBe "๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐
๐๐๐๐"
UnicodeFont.Bold.format(smallLetters) shouldBe "๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ"
UnicodeFont.Italic.format(smallLetters) shouldBe "๐๐๐๐๐๐๐โ๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง"
UnicodeFont.BoldItalic.format(smallLetters) shouldBe "๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐"
UnicodeFont.Script.format(smallLetters) shouldBe "๐ถ๐ท๐ธ๐นโฏ๐ปโ๐ฝ๐พ๐ฟ๐๐๐๐โด๐
๐๐๐๐๐๐๐๐๐๐"
UnicodeFont.BoldScript.format(smallLetters) shouldBe "๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐"
UnicodeFont.Fraktur.format(smallLetters) shouldBe "๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท"
UnicodeFont.BoldFraktur.format(smallLetters) shouldBe "๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐"
UnicodeFont.DoubleStruck.format(smallLetters) shouldBe "๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ"
UnicodeFont.SansSerif.format(smallLetters) shouldBe "๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐"
UnicodeFont.SansSerifBold.format(smallLetters) shouldBe "๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐
๐๐"
UnicodeFont.SansSerifItalic.format(smallLetters) shouldBe "๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป"
UnicodeFont.SansSerifBoldItalic.format(smallLetters) shouldBe "๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ"
UnicodeFont.Monospace.format(smallLetters) shouldBe "๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ"
UnicodeFont.Bold.format(digits) shouldBe "๐๐๐๐๐๐๐๐๐๐"
UnicodeFont.Italic.format(digits) shouldBe digits
UnicodeFont.BoldItalic.format(digits) shouldBe digits
UnicodeFont.Script.format(digits) shouldBe digits
UnicodeFont.BoldScript.format(digits) shouldBe digits
UnicodeFont.Fraktur.format(digits) shouldBe digits
UnicodeFont.BoldFraktur.format(digits) shouldBe digits
UnicodeFont.DoubleStruck.format(digits) shouldBe "๐๐๐๐๐๐๐๐๐ ๐ก"
UnicodeFont.SansSerif.format(digits) shouldBe "๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ"
UnicodeFont.SansSerifBold.format(digits) shouldBe "๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต"
UnicodeFont.SansSerifItalic.format(digits) shouldBe digits
UnicodeFont.SansSerifBoldItalic.format(digits) shouldBe digits
UnicodeFont.Monospace.format(digits) shouldBe "๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ"
}
@Test fun format_throwing() = testAll {
UnicodeFont.Bold.format(digits) shouldBe "๐๐๐๐๐๐๐๐๐๐"
shouldThrow { UnicodeFont.Italic.format(digits) { throw IllegalArgumentException("cannot format $it") } }
}
}
private const val capitalLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
private const val smallLetters = "abcdefghijklmnopqrstuvwxyz"
private const val digits = "0123456789"