@@ -158,6 +158,60 @@ describe('morsify', function () {
158
158
t . equal ( morsify . decode ( '---/.---/./../-/...' , options ) , 'ㅍ ㅎ ㅏ ㅑ ㅓ ㅕ' ) ;
159
159
t . equal ( morsify . decode ( '.-/-./..../.-./-../..-' , options ) , 'ㅗ ㅛ ㅜ ㅠ ㅡ ㅣ' ) ;
160
160
} ) ;
161
+ it ( 'encodes thai alphabet' , function ( ) {
162
+ var options = { priority : 11 } ;
163
+ t . equal ( morsify . encode ( 'กขคง' , options ) , '--./-.-./-.-/-.--.' ) ;
164
+ t . equal ( morsify . encode ( 'จฉชซญด' , options ) , '-..-./----/-..-/--../.---/-..' ) ;
165
+ t . equal ( morsify . encode ( 'ตถทนบ' , options ) , '-/-.-../-..--/-./-...' ) ;
166
+ t . equal ( morsify . encode ( 'ปผฝพฟ' , options ) , '.--./--.-/-.-.-/.--../..-.' ) ;
167
+ t . equal ( morsify . encode ( 'มยรลว' , options ) , '--/-.--/.-./.-../.--' ) ;
168
+ t . equal ( morsify . encode ( 'สหอฮฤ' , options ) , '.../..../-...-/--.--/.-.--' ) ;
169
+ t . equal ( morsify . encode ( 'ะาิีึืุูเแไโำ' , options ) , '.-.../.-/..-../../..--./..--/..-.-/---././.-.-/.-..-/---/...-.' ) ;
170
+ t . equal ( morsify . encode ( '่้๊๋' , options ) , '..-/...-/--.../.-.-.' ) ;
171
+ t . equal ( morsify . encode ( 'ั็์ๆฯ' , options ) , '.--.-/---../--..-/-.---/--.-.' ) ;
172
+
173
+ /* full test
174
+ ** this test can be used after figure out how to deal with Thai alphabeth duplications and conflicts
175
+
176
+ t.equal(morsify.encode('กขฃคฅฆง', options), '--./-.-./-.-./-.-/-.-/-.-/-.--.');
177
+ t.equal(morsify.encode('จฉชซญดฎ', options), '-..-./----/-..-/--../.---/-../-..');
178
+ t.equal(morsify.encode('ตฏถฐทธฑฒนณบ', options), '-/-/-.-../-.-../-..--/-..--/-..--/-..--/-./-./-...');
179
+ t.equal(morsify.encode('ปผฝพภฟ', options), '.--./--.-/-.-.-/.--../.--../..-.');
180
+ t.equal(morsify.encode('มยรลฬว', options), '--/-.--/.-./.-../.-../.--');
181
+ t.equal(morsify.encode('ศษสหอฮฤฤๅ', options), '.../.../.../..../-...-/--.--/.-.--/.-.--');
182
+ t.equal(morsify.encode('ะาิีึืุูเแไใโำ', options), '.-.../.-/..-../../..--./..--/..-.-/---././.-.-/.-..-/.-..-/---/...-.');
183
+ t.equal(morsify.encode('่้๊๋', options), '..-/...-/--.../.-.-.');
184
+ t.equal(morsify.encode('ั็์ๆฯฯลฯ', options), '.--.-/---../--..-/-.---/--.-./---.-');
185
+
186
+ */
187
+ } ) ;
188
+ it ( 'decodes thai alphabet' , function ( ) {
189
+ var options = { priority : 12 } ;
190
+ t . equal ( morsify . decode ( '--./-.-./-.-/-.--.' , options ) , 'ก ข ค ง' ) ;
191
+ t . equal ( morsify . decode ( '-..-./----/-..-/--../.---/-..' , options ) , 'จ ฉ ช ซ ญ ด' ) ;
192
+ t . equal ( morsify . decode ( '-/-.-../-..--/-./-...' , options ) , 'ต ถ ท น บ' ) ;
193
+ t . equal ( morsify . decode ( '.--./--.-/-.-.-/.--../..-.' , options ) , 'ป ผ ฝ พ ฟ' ) ;
194
+ t . equal ( morsify . decode ( '--/-.--/.-./.-../.--' , options ) , 'ม ย ร ล ว' ) ;
195
+ t . equal ( morsify . decode ( '.../..../-...-/--.--/.-.--' , options ) , 'ส ห อ ฮ ฤ' ) ;
196
+ t . equal ( morsify . decode ( '.-.../.-/..-../../..--./..--/..-.-/---././.-.-/.-..-/---/...-.' , options ) , 'ะ า ิ ี ึ ื ุ ู เ แ ไ โ ำ' ) ;
197
+ t . equal ( morsify . decode ( '..-/...-/--.../.-.-.' , options ) , '่ ้ ๊ ๋' ) ;
198
+ t . equal ( morsify . decode ( '.--.-/---../--..-/-.---/--.-.' , options ) , 'ั ็ ์ ๆ ฯ' ) ;
199
+
200
+ /* full test
201
+ ** this test can be used after figure out how to deal with Thai alphabeth duplications and conflicts
202
+
203
+ t.equal(morsify.decode('--./-.-./-.-./-.-/-.-/-.-/-.--.', options), 'ก ข ฃ ค ฅ ฆ ง');
204
+ t.equal(morsify.decode('-..-./----/-..-/--../.---/-../-..', options), 'จ ฉ ช ซ ญ ด ฎ');
205
+ t.equal(morsify.decode('-/-/-.-../-.-../-..--/-..--/-..--/-..--/-./-./-...', options), 'ต ฏ ถ ฐ ท ธ ฑ ฒ น ณ บ');
206
+ t.equal(morsify.decode('.--./--.-/-.-.-/.--../..-.', options), 'ป ผ ฝ พ ภ ฟ');
207
+ t.equal(morsify.decode('--/-.--/.-./.-../.-../.--', options), 'ม ย ร ล ฬ ว');
208
+ t.equal(morsify.decode('.../.../.../..../-...-/--.--/.-.--', options), 'ศ ษ ส ห อ ฮ ฤ ฤๅ');
209
+ t.equal(morsify.decode('.-.../.-/..-../../..--./..--/..-.-/---././.-.-/.-..-/.-..-/---/...-.', options), 'ะ า ิ ี ึ ื ุ ู เ แ ไ ใ โ ำ');
210
+ t.equal(morsify.decode('..-/...-/--.../.-.-.', options), '่ ้ ๊ ๋');
211
+ t.equal(morsify.decode('.--.-/---../--..-/-.---/--.-./---.-', options), 'ั ็ ์ ๆ ฯ ฯลฯ');
212
+
213
+ */
214
+ } ) ;
161
215
it ( 'returns mapped characters' , function ( ) {
162
216
var characters = morsify . characters ( ) ;
163
217
t . equal ( characters [ 1 ] [ 'A' ] , '.-' ) ;
@@ -171,6 +225,7 @@ describe('morsify', function () {
171
225
t . equal ( characters [ 9 ] [ 'ا' ] , '.-' ) ;
172
226
t . equal ( characters [ 10 ] [ 'ア' ] , '--.--' ) ;
173
227
t . equal ( characters [ 11 ] [ 'ㄱ' ] , '.-..' ) ;
228
+ t . equal ( characters [ 12 ] [ 'ก' ] , '--.' ) ;
174
229
characters = morsify . characters ( { dash : '–' , dot : '•' , space : ' ' } ) ;
175
230
t . equal ( characters [ 1 ] [ 'A' ] , '•–' ) ;
176
231
t . equal ( characters [ 2 ] [ '0' ] , '–––––' ) ;
@@ -183,5 +238,7 @@ describe('morsify', function () {
183
238
t . equal ( characters [ 9 ] [ 'ا' ] , '•–' ) ;
184
239
t . equal ( characters [ 10 ] [ 'ア' ] , '––•––' ) ;
185
240
t . equal ( characters [ 11 ] [ 'ㄱ' ] , '•–••' ) ;
241
+ t . equal ( characters [ 12 ] [ 'ก' ] , '––•' ) ;
186
242
} ) ;
243
+
187
244
} ) ;
0 commit comments