This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,7 @@
-module( palindrome_tests ).
-compile( export_all ).
-include_lib( "eunit/include/eunit.hrl" ).
abcba_test() -> ?assert( palindrome:is_palindrome("abcba") ).
abcdef_test() -> ?assertNot( palindrome:is_palindrome("abcdef") ).

View file

@ -0,0 +1,13 @@
#!/bin/bash
is_palindrome() {
local s1=$1
local s2=$(echo $1 | tr -d "[ ,!:;.'\"]" | tr '[A-Z]' '[a-z]')
if [[ $s2 = $(echo $s2 | rev) ]]
then
echo "[$s1] is a palindrome"
else
echo "[$s1] is NOT a palindrome"
fi
}