forked from tiyd-python-2015-05/palindrome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·40 lines (31 loc) · 1007 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env roundup
describe "palindrome.py: Determines if a text is palindromic"
prog="python3 palindrome.py"
it_works_for_even_numbers() {
out="$(echo 'toot' | $prog)"
[[ "$out" =~ "is a palindrome" ]]
}
it_works_for_odd_numbers() {
out="$(echo 'tot' | $prog)"
[[ "$out" =~ "is a palindrome" ]]
}
it_works_for_simple_values() {
out="$(echo 'stunt nuts' | $prog)"
[[ "$out" =~ "is a palindrome" ]]
}
it_works_for_complete_sentences() {
out="$(echo 'Lisa Bonet ate no basil.' | $prog)"
[[ "$out" =~ "is a palindrome" ]]
}
it_works_for_complex_sentences() {
out="$(echo 'A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal: Panama!' | $prog)"
[[ "$out" =~ "is a palindrome" ]]
}
it_works_for_multiple_sentences() {
out="$(echo 'Doc, note, I dissent. A fast never prevents a fatness. I diet on cod.' | $prog)"
[[ "$out" =~ "is a palindrome" ]]
}
it_works_for_non_palindromes() {
out=$(echo 'i am not a palindrome' | $prog)
[[ "$out" =~ "is not a palindrome" ]]
}