-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTests.hs
53 lines (38 loc) · 1.35 KB
/
Tests.hs
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
41
42
43
44
45
46
47
48
49
50
51
52
53
module Main where
import Convert
import Data.Char
main :: IO ()
main = do
case convertNum 2 16 "1010" of
Nothing -> putStrLn "Invalid inputs"
Just q -> putStrLn $ show $ q == "A"
case convertNum 2 1 "1010" of
Nothing -> putStrLn "Invalid inputs"
Just q -> putStrLn $ show $ q == "0000000000"
case convertNum 1 2 "0000000000" of
Nothing -> putStrLn "Invalid inputs"
Just q -> putStrLn $ show $ q == "1010"
--case convertNum 10 1 "1010" of
-- Nothing -> putStrLn "Invalid inputs"
-- Just q -> putStrLn q
case convertNum 2 16 "1010A" of
Nothing -> putStrLn "True" --"Invalid inputs"
Just q -> putStrLn q
case convertNum 80 76 "1010," of
Nothing -> putStrLn "True" -- "Invalid inputs"
Just q -> putStrLn q
case convertNum 10 17 "16" of
Nothing -> putStrLn "Invalid inputs" -- "Invalid inputs"
Just q -> putStrLn $ show $ q == "G"
case convertNumByArrays 2 16 [1,0,1,0,2] of
Nothing -> putStrLn "True" -- "Invalid inputs"
Just q -> print q
case convertNumByArrays 2 16 [1,0,1,0] of
Nothing -> putStrLn "Invalid inputs"
Just q -> print $ show $ q == [10]
case convertNumBySpaces 2 16 "1 0 1 0 9" of
Nothing -> putStrLn "True"
Just q -> print q
case convertNumBySpaces 2 16 "1 0 1 0" of
Nothing -> putStrLn "Invalid inputs"
Just q -> print $ show $ q == "10"