Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
7
Task/Test-a-function/Erlang/test-a-function.erl
Normal file
7
Task/Test-a-function/Erlang/test-a-function.erl
Normal 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") ).
|
||||
13
Task/Test-a-function/UNIX-Shell/test-a-function.sh
Normal file
13
Task/Test-a-function/UNIX-Shell/test-a-function.sh
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue