-
Notifications
You must be signed in to change notification settings - Fork 2
/
CharTests.kt
60 lines (57 loc) · 1.79 KB
/
CharTests.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import com.meowool.sweekt.isChinese
import com.meowool.sweekt.isChineseNotPunctuation
import com.meowool.sweekt.isChinesePunctuation
import com.meowool.sweekt.isEnglish
import com.meowool.sweekt.isEnglishNotPunctuation
import com.meowool.sweekt.isEnglishPunctuation
import com.meowool.sweekt.isPunctuation
import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe
/**
* @author 凛 (RinOrz)
*/
class CharTests : StringSpec({
"isChinese" {
'汉'.isChinese() shouldBe true
'働'.isChinese() shouldBe true
'み'.isChinese() shouldBe false
'목'.isChinese() shouldBe false
','.isChinese() shouldBe true
'。'.isChinese() shouldBe true
'a'.isChinese() shouldBe false
}
"isChinesePunctuation" {
'?'.isChinesePunctuation() shouldBe true
'?'.isChinesePunctuation() shouldBe false
}
"isChineseNotPunctuation" {
'凛'.isChineseNotPunctuation() shouldBe true
','.isChineseNotPunctuation() shouldBe false
','.isChineseNotPunctuation() shouldBe false
}
"isEnglish" {
'a'.isEnglish() shouldBe true
'.'.isEnglish() shouldBe true
'汉'.isEnglish() shouldBe false
}
"isEnglishPunctuation" {
'@'.isEnglishPunctuation() shouldBe true
'-'.isEnglishPunctuation() shouldBe true
'O'.isEnglishPunctuation() shouldBe false
'。'.isEnglishPunctuation() shouldBe false
}
"isEnglishNotPunctuation" {
'O'.isEnglishNotPunctuation() shouldBe true
'.'.isEnglishNotPunctuation() shouldBe false
}
"isPunctuation" {
','.isPunctuation() shouldBe true
','.isPunctuation() shouldBe true
'?'.isPunctuation() shouldBe true
'-'.isPunctuation() shouldBe true
'、'.isPunctuation() shouldBe true
'\\'.isPunctuation() shouldBe true
'@'.isPunctuation() shouldBe true
'^'.isPunctuation() shouldBe true
}
})