11#! /bin/bash
22
33set -e
4+
5+ rare_str_range_names=(" CJKUnifiedIdeographs" " CJKCompatibilityIdeographs" " CJKCompatibilityIdeographsSupplement" " KangxiRadicals" " CJKRadicalsSupplement" " IdeographicDescriptionCharacters" " Bopomofo" " BopomofoExtended" " CJKStrokes" " CJKSymbolsandPunctuation" " CJKCompatibilityForms" " CJKCompatibility" " EnclosedCJKLettersandMonths" " CJKUnifiedIdeographsExtensionA" " CJKUnifiedIdeographsExtensionB" " CJKUnifiedIdeographsExtensionC" " CJKUnifiedIdeographsExtensionD" " CJKUnifiedIdeographsExtensionE" " CJKUnifiedIdeographsExtensionF" )
6+ rare_str_range_values=(" 19968,40959" " 63744,64255" " 194560,195103" " 12032,12255" " 11904,12031" " 12272,12287" " 12544,12591" " 12704,12735" " 12736,12783" " 12288,12351" " 65072,65103" " 13056,13311" " 12800,13055" " 13312,19903" " 131072,173791" " 173824,177977" " 177984,178205" " 178208,183969" " 183984,191456" )
7+
48LOG_INFO () {
59 local content=${1}
610 echo -e " \033[32m ${content} \033[0m"
@@ -28,6 +32,11 @@ get_sed_cmd()
2832 echo " $sed_cmd "
2933}
3034
35+ download_rare_string_jar () {
36+ LOG_INFO " ----- Downloading get-rare-string-with-unicode.jar -------"
37+ curl -LO " https://github.com/FISCO-BCOS/LargeFiles/raw/master/binaries/jar/get-rare-string-with-unicode.jar"
38+ }
39+
3140download_build_chain ()
3241{
3342 local tag=" ${1} "
@@ -83,13 +92,60 @@ clean_node()
8392 fi
8493}
8594
95+ getRangeValues () {
96+ local rangeValue=$1
97+ IFS=' ,' read -r startValue endValue <<< " $rangeValue"
98+
99+ echo " $startValue $endValue "
100+ }
101+
102+ getConcatenatedRareStringWithRange () {
103+ local startUnicode=${1}
104+ local endUnicode=${2}
105+
106+ # concatenate strings with begin middle end
107+ local concatenatedString=$( java -cp ' ./get-rare-string-with-unicode.jar' org.example.Main ${startUnicode} )
108+ local midUnicode=$(( ($startUnicode + $endUnicode ) / 2 ))
109+ for (( i = midUnicode; i <= midUnicode + 5 ; i++ )) ; do
110+ local currentRareString=$( java -cp ' ./get-rare-string-with-unicode.jar' org.example.Main ${i} )
111+ concatenatedString+=" $currentRareString "
112+ done
113+ local endRareString=$( java -cp ' ./get-rare-string-with-unicode.jar' org.example.Main ${endUnicode} )
114+ concatenatedString+=" $endRareString "
115+ echo " $concatenatedString "
116+ }
117+
118+ check_rare_string () {
119+ download_rare_string_jar
120+ bash gradlew assemble
121+ cp ./src/integration-test/resources/config.toml ./dist/conf/config.toml
122+ cp -r ./nodes/127.0.0.1/sdk/* ./dist/conf/
123+ export LC_ALL=en_US.UTF-8
124+ export LANG=en_US.UTF-8
125+ export LANGUAGE=en_US.UTF-8
126+
127+ finalConcatenatedInputString=" "
128+ for (( i = 0 ; i < ${# rare_str_range_names[@]} ; i++ )) ; do
129+ rangeName=" ${rare_str_range_names[$i]} "
130+ rangeValue=" ${rare_str_range_values[$i]} "
131+
132+ read -r startValue endValue <<< $( getRangeValues " $rangeValue " )
133+ concatenatedString=$( getConcatenatedRareStringWithRange $startValue $endValue )
134+ finalConcatenatedInputString+=" $concatenatedString "
135+ done
136+
137+ bash -x .ci/check_rare_string.sh ${finalConcatenatedInputString}
138+ }
139+
86140check_standard_node ()
87141{
88142 build_node ${@: 2}
89143 prepare_environment
90144 # # run integration test
91145 bash gradlew test --info
92146 bash gradlew integrationTest --info
147+ LOG_INFO " ------ standard_node check_rare_string---------"
148+ check_rare_string
93149 clean_node " ${1} "
94150}
95151
@@ -100,6 +156,8 @@ check_sm_node()
100156 # # run integration test
101157 bash gradlew test --info
102158 bash gradlew integrationTest --info
159+ LOG_INFO " ------ standard_node check_rare_string---------"
160+ check_rare_string
103161 clean_node " ${1} "
104162}
105163
0 commit comments