]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/morse/morse-tests.factor
io.streams.tee: more tests
[factor.git] / extra / morse / morse-tests.factor
index 97efe1afb4695684212249c1bb7c5e2908bce79a..86dad6b9b72ea51f5c5468c053c98959664431ca 100644 (file)
@@ -1,11 +1,43 @@
 ! Copyright (C) 2007 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
+! See https://factorcode.org/license.txt for BSD license.
 USING: arrays morse strings tools.test ;
 
-[ "" ] [ CHAR: \\ ch>morse ] unit-test
-[ "..." ] [ CHAR: s ch>morse ] unit-test
-[ CHAR: s ] [ "..." morse>ch ] unit-test
-[ f ] [ "..--..--.." morse>ch ] unit-test
-[ "-- --- .-. ... . / -.-. --- -.. ." ] [ "morse code" >morse ] unit-test
-[ "morse code" ] [ "-- --- .-. ... . / -.-. --- -.. ." morse> ] unit-test
-[ "hello, world!" ] [ "Hello, World!" >morse morse> ] unit-test
+{ "?" } [ CHAR: \\ ch>morse ] unit-test
+{ "..." } [ CHAR: s ch>morse ] unit-test
+{ CHAR: s } [ "..." morse>ch ] unit-test
+{ CHAR: \s } [ "..--..--.." morse>ch ] unit-test
+{ "-- --- .-. ... . / -.-. --- -.. ." } [ "morse code" >morse ] unit-test
+{ "morse code" } [ "-- --- .-. ... . / -.-. --- -.. ." morse> ] unit-test
+{ "hello, world!" } [ "Hello, World!" >morse morse> ] unit-test
+{ ".- -... -.-." } [ "abc" >morse ] unit-test
+
+{ "abc" } [ ".- -... -.-." morse> ] unit-test
+
+{ "morse code" } [
+    [MORSE
+        -- --- .-. ... . /
+        -.-. --- -.. .
+    MORSE] >morse morse> ] unit-test
+
+{ "morse code 123" } [
+    [MORSE
+        __ ___ ._. ... . /
+        _._. ___ _.. . /
+        .____ ..___ ...__
+    MORSE] ] unit-test
+
+{ [MORSE
+      -- --- .-. ... . /
+      -.-. --- -.. .
+  MORSE] } [
+    "morse code" >morse morse>
+] unit-test
+
+{ "factor rocks!" } [
+    [MORSE
+      ..-. .- -.-. - --- .-. /
+      .-. --- -.-. -.- ... -.-.--
+    MORSE] ] unit-test
+! [ ] [ "sos" 0.075 play-as-morse* ] unit-test
+! [ ] [ "Factor rocks!" play-as-morse ] unit-test
+! [ ] [ "\n" play-as-morse ] unit-test