1
1
module Main where
2
2
3
3
import Control.Monad (unless )
4
- import Distribution.Server.Features.Browse (StartIndex (.. ), NumElems (.. ), paginate , PaginationConfig (.. ))
5
4
import System.Exit (die )
6
5
6
+ import Distribution.Server.Features.Browse (NumElems (.. ), PaginationConfig (.. ), StartIndex (.. ), paginate )
7
+
7
8
main :: IO ()
8
9
main = do
9
10
let res = paginate $ PaginationConfig 10 0
@@ -20,18 +21,18 @@ main = do
20
21
unless (res == Nothing ) $
21
22
die $ " Mismatch 3 " ++ show res
22
23
23
- let res = paginate $ PaginationConfig 11 1
24
- unless (res == Just (StartIndex 10 , NumElems 1 )) $
24
+ let res = paginate $ PaginationConfig 51 1
25
+ unless (res == Just (StartIndex 50 , NumElems 1 )) $
25
26
die $ " Mismatch 4 " ++ show res
26
27
27
28
let res = paginate $ PaginationConfig 9 0
28
29
unless (res == Just (StartIndex 0 , NumElems 9 )) $
29
30
die $ " Mismatch 5 " ++ show res
30
31
31
- let res = paginate $ PaginationConfig 20 0
32
- unless (res == Just (StartIndex 0 , NumElems 10 )) $
32
+ let res = paginate $ PaginationConfig 100 0
33
+ unless (res == Just (StartIndex 0 , NumElems 50 )) $
33
34
die $ " Mismatch 6 " ++ show res
34
35
35
- let res = paginate $ PaginationConfig 20 1
36
- unless (res == Just (StartIndex 10 , NumElems 10 )) $
36
+ let res = paginate $ PaginationConfig 100 1
37
+ unless (res == Just (StartIndex 50 , NumElems 50 )) $
37
38
die $ " Mismatch 7 " ++ show res
0 commit comments