-- test cases for Aufgabe4.lhs ($Id: check_Aufgabe4.lhs,v 1.3 2003/11/26 07:26:46 fp010 Exp $) -- compr :: String -> [(Int,Char)] compr "aaabbbcccca" == [(3,'a'),(3,'b'),(4,'c'),(1,'a')] compr "" == [] compr "a" == [(1,'a')] compr "aa" == [(2,'a')] compr "\0" == [(1,'\0')] compr "aaObeZ-Z/saABEyebO!" == [(2,'a'),(1,'O'),(1,'b'),(1,'e'),(1,'Z'),(1,'-'),(1,'Z'),(1,'/'),(1,'s'),(1,'a'),(1,'A'),(1,'B'),(1,'E'),(1,'y'),(1,'e'),(1,'b'),(1,'O'),(1,'!')] -- uncompr :: [(Int,Char)] -> String uncompr [(3,'a'),(3,'b'),(4,'c'),(1,'a')] == "aaabbbcccca" "" == uncompr [] "a" == uncompr [(1,'a')] "aa" == uncompr [(2,'a')] "\0" == uncompr [(1,'\0')] "aaObeZ-Z/saABEyebO!" == uncompr [(2,'a'),(1,'O'),(1,'b'),(1,'e'),(1,'Z'),(1,'-'),(1,'Z'),(1,'/'),(1,'s'),(1,'a'),(1,'A'),(1,'B'),(1,'E'),(1,'y'),(1,'e'),(1,'b'),(1,'O'),(1,'!')] -- sums :: [Integer] -> [Integer] sums [1..4] == [4,7,9,10] sums [] == [] sums [1] == [1] sums [-1] == [-1] sums [0] == [0] sums [1,1] == [1,2] sums [1,1,1] == [1,2,3] sums [1,1,1,1,1,1,1,1,1,1] == [1..10] sums [-1,1,-1,1,-1,1,-1,1,-1,1] == [1,0,1,0,1,0,1,0,1,0] sums [1,-1,1,-1,1,-1,1,-1,1,-1] == [-1,0,-1,0,-1,0,-1,0,-1,0] sums [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] == reverse [-10..(-1)] sums [-9..10] == [10,19,27,34,40,45,49,52,54,55,55,54,52,49,45,40,34,27,19,10] -- sumBoth :: [Integer] -> [Integer] -> Integer sumBoth [1,2,1,2,3] [3,2,4] == 1 + 4 sumBoth [] [] == 0 sumBoth [1..10] [1..10] == 0 sumBoth (reverse [1..10]) [1..10] == 0 sumBoth [1..10] (reverse [1..10]) == 0 sumBoth [1..10] [] == sum [1..10] sumBoth [] [1..10] == sum [1..10] sumBoth [-10..(-1)] [1..10] == 0 sumBoth (reverse [-10..(-1)]) [1..10] == 0 sumBoth [-10..(-1)] (reverse [1..10]) == 0 sumBoth [1,-2,1,2,-3] [3,2,4] == 3 sumBoth [-100..50] [-50..100] == 0 sumBoth [-100..50] [-50,-48..100] == (-1875) -- anzSigmaSymbole :: String -> [[(Char,Int)]] anzSigmaSymbole "aaObeZ-Z/saABEyebO!" == [[('a',3),('b',2),('e',2),('s',1),('y',1)],[('A',1),('B',1),('E',1),('O',2),('Z',2)],[('A',4),('E',3),('O',2)]] anzSigmaSymbole "" == [[],[],[]] anzSigmaSymbole "1234567890" == [[],[],[]] anzSigmaSymbole "!@#$%^&*()_+-=" == [[],[],[]] anzSigmaSymbole "" == [[],[],[]] anzSigmaSymbole "A" == [[],[('A',1)],[('A',1)]] anzSigmaSymbole "Aa" == [[('a',1)],[('A',1)],[('A',2)]] anzSigmaSymbole "B" == [[],[('B',1)],[]] anzSigmaSymbole "Bb" == [[('b',1)],[('B',1)],[]] map (uncompr.(map(\(x,y)->(y,x)))) (anzSigmaSymbole([minBound..maxBound]::String)) == [['a'..'z'],['A'..'Z'],"AAEEIIOOUU"] -- EOF