]> gitweb.factorcode.org Git - factor.git/blob - extra/morse/morse-tests.factor
scryfall: better moxfield words
[factor.git] / extra / morse / morse-tests.factor
1 ! Copyright (C) 2007 Alex Chapman
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays morse strings tools.test ;
4
5 { "?" } [ CHAR: \\ ch>morse ] unit-test
6 { "..." } [ CHAR: s ch>morse ] unit-test
7 { CHAR: s } [ "..." morse>ch ] unit-test
8 { CHAR: \s } [ "..--..--.." morse>ch ] unit-test
9 { "-- --- .-. ... . / -.-. --- -.. ." } [ "morse code" >morse ] unit-test
10 { "morse code" } [ "-- --- .-. ... . / -.-. --- -.. ." morse> ] unit-test
11 { "hello, world!" } [ "Hello, World!" >morse morse> ] unit-test
12 { ".- -... -.-." } [ "abc" >morse ] unit-test
13
14 { "abc" } [ ".- -... -.-." morse> ] unit-test
15
16 { "morse code" } [
17     [MORSE
18         -- --- .-. ... . /
19         -.-. --- -.. .
20     MORSE] >morse morse> ] unit-test
21
22 { "morse code 123" } [
23     [MORSE
24         __ ___ ._. ... . /
25         _._. ___ _.. . /
26         .____ ..___ ...__
27     MORSE] ] unit-test
28
29 { [MORSE
30       -- --- .-. ... . /
31       -.-. --- -.. .
32   MORSE] } [
33     "morse code" >morse morse>
34 ] unit-test
35
36 { "factor rocks!" } [
37     [MORSE
38       ..-. .- -.-. - --- .-. /
39       .-. --- -.-. -.- ... -.-.--
40     MORSE] ] unit-test
41 ! [ ] [ "sos" 0.075 play-as-morse* ] unit-test
42 ! [ ] [ "Factor rocks!" play-as-morse ] unit-test
43 ! [ ] [ "\n" play-as-morse ] unit-test