File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- Problem 6
2
+ -- Find out whether a list is a palindrome.
3
+ -- A palindrome can be read forward or backward; e.g. (x a m a x).
4
+
5
+ module Wiki_99_Questions.Problem6 where
6
+
7
+ isPalindrome :: (Eq a ) => [a ] -> Bool
8
+ isPalindrome xs = xs == (reverse xs)
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ library
20
20
, Wiki_99_Questions.Problem3
21
21
, Wiki_99_Questions.Problem4
22
22
, Wiki_99_Questions.Problem5
23
+ , Wiki_99_Questions.Problem6
23
24
, Lib
24
25
build-depends : base >= 4.7 && < 5
25
26
default-language : Haskell2010
Original file line number Diff line number Diff line change
1
+ module Wiki_99_Questions.Problem6Spec where
2
+
3
+ import Test.Hspec
4
+ import Wiki_99_Questions.Problem6
5
+
6
+ spec :: Spec
7
+ spec = do
8
+ describe " Test1 for Problem6" $ do
9
+ it " isPalindrome \" Hello\" -> false" $ do
10
+ isPalindrome " Hello" `shouldBe` False
11
+
12
+ describe " Test2 for Problem6" $ do
13
+ it " isPalindrome \" tweewt\" -> true" $ do
14
+ isPalindrome " tweewt" `shouldBe` True
You can’t perform that action at this time.
0 commit comments