summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib')
-rw-r--r--testsuite/tests/lib/CPUTime/CPUTime001.hs26
-rw-r--r--testsuite/tests/lib/CPUTime/CPUTime001.stdout4
-rw-r--r--testsuite/tests/lib/CPUTime/Makefile3
-rw-r--r--testsuite/tests/lib/CPUTime/all.T1
-rw-r--r--testsuite/tests/lib/Char/Makefile3
-rw-r--r--testsuite/tests/lib/Char/all.T10
-rw-r--r--testsuite/tests/lib/Char/readLitChar.hs12
-rw-r--r--testsuite/tests/lib/Char/readLitChar.stdout4
-rw-r--r--testsuite/tests/lib/Char/unicode001.hs46
-rw-r--r--testsuite/tests/lib/Char/unicode001.stdout14
-rw-r--r--testsuite/tests/lib/Char/unicode001.stdout-hugs14
-rw-r--r--testsuite/tests/lib/Char/unicode002.hs44
-rw-r--r--testsuite/tests/lib/Char/unicode002.stdout6555
-rw-r--r--testsuite/tests/lib/Concurrent/4876.hs19
-rw-r--r--testsuite/tests/lib/Concurrent/4876.stdout1
-rw-r--r--testsuite/tests/lib/Concurrent/Chan001.hs109
-rw-r--r--testsuite/tests/lib/Concurrent/Chan001.stdout3
-rw-r--r--testsuite/tests/lib/Concurrent/MVar001.hs148
-rw-r--r--testsuite/tests/lib/Concurrent/MVar001.stdout6
-rw-r--r--testsuite/tests/lib/Concurrent/Makefile3
-rw-r--r--testsuite/tests/lib/Concurrent/QSem001.hs93
-rw-r--r--testsuite/tests/lib/Concurrent/QSem001.stdout2
-rw-r--r--testsuite/tests/lib/Concurrent/QSemN001.hs96
-rw-r--r--testsuite/tests/lib/Concurrent/QSemN001.stdout2
-rw-r--r--testsuite/tests/lib/Concurrent/SampleVar001.hs132
-rw-r--r--testsuite/tests/lib/Concurrent/SampleVar001.stdout6
-rw-r--r--testsuite/tests/lib/Concurrent/ThreadDelay001.hs26
-rw-r--r--testsuite/tests/lib/Concurrent/all.T10
-rw-r--r--testsuite/tests/lib/Data.ByteString/Makefile3
-rw-r--r--testsuite/tests/lib/Data.ByteString/all.T18
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring001.hs948
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring001.stdout185
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring002.hs6
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring002.stdin1000
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring002.stdout1
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring003.hs36
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring003.stdin1000
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring003.stdout1
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring004.hs564
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring004.stdout45
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring005.hs1138
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring005.stdout226
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring006.hs10
-rw-r--r--testsuite/tests/lib/Data.ByteString/bytestring006.stdout2
-rw-r--r--testsuite/tests/lib/Data.Fixed/Makefile3
-rw-r--r--testsuite/tests/lib/Data.Fixed/all.T1
-rw-r--r--testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs22
-rw-r--r--testsuite/tests/lib/Data.Fixed/data-fixed-show-read.stdout18
-rw-r--r--testsuite/tests/lib/Data.HashTable/Makefile3
-rw-r--r--testsuite/tests/lib/Data.HashTable/all.T1
-rw-r--r--testsuite/tests/lib/Data.HashTable/hash001.hs14
-rw-r--r--testsuite/tests/lib/Data.Ix/Makefile3
-rw-r--r--testsuite/tests/lib/Data.Ix/all.T1
-rw-r--r--testsuite/tests/lib/Data.Ix/ix001.hs4
-rw-r--r--testsuite/tests/lib/Data.Ix/ix001.stdout1
-rw-r--r--testsuite/tests/lib/Data.List/Makefile3
-rw-r--r--testsuite/tests/lib/Data.List/all.T2
-rw-r--r--testsuite/tests/lib/Data.List/genericNegative001.hs8
-rw-r--r--testsuite/tests/lib/Data.List/genericNegative001.stdout3
-rw-r--r--testsuite/tests/lib/Data.List/take001.hs5
-rw-r--r--testsuite/tests/lib/Data.List/take001.stdout1
-rw-r--r--testsuite/tests/lib/IO/2122.hs76
-rw-r--r--testsuite/tests/lib/IO/3307.hs52
-rw-r--r--testsuite/tests/lib/IO/3307.stdout12
-rw-r--r--testsuite/tests/lib/IO/4808.hs12
-rw-r--r--testsuite/tests/lib/IO/4808.stderr1
-rw-r--r--testsuite/tests/lib/IO/4808.stdout1
-rw-r--r--testsuite/tests/lib/IO/4855.hs3
-rw-r--r--testsuite/tests/lib/IO/4855.stderr1
-rw-r--r--testsuite/tests/lib/IO/4895.hs9
-rw-r--r--testsuite/tests/lib/IO/4895.stdout1
-rw-r--r--testsuite/tests/lib/IO/IOError001.hs7
-rw-r--r--testsuite/tests/lib/IO/IOError001.stdout2
-rw-r--r--testsuite/tests/lib/IO/IOError001.stdout-hugs2
-rw-r--r--testsuite/tests/lib/IO/IOError002.hs5
-rw-r--r--testsuite/tests/lib/IO/IOError002.stdout1
-rw-r--r--testsuite/tests/lib/IO/Makefile48
-rw-r--r--testsuite/tests/lib/IO/T4113.hs20
-rw-r--r--testsuite/tests/lib/IO/T4113.stdout2
-rw-r--r--testsuite/tests/lib/IO/T4113.stdout-i386-unknown-mingw322
-rw-r--r--testsuite/tests/lib/IO/T4144.hs115
-rw-r--r--testsuite/tests/lib/IO/T4144.stdout1
-rw-r--r--testsuite/tests/lib/IO/all.T173
-rw-r--r--testsuite/tests/lib/IO/concio001.hs6
-rw-r--r--testsuite/tests/lib/IO/concio001.stdout2
-rw-r--r--testsuite/tests/lib/IO/concio001.thr.stdout2
-rw-r--r--testsuite/tests/lib/IO/concio002.hs14
-rw-r--r--testsuite/tests/lib/IO/concio002.stdout4
-rw-r--r--testsuite/tests/lib/IO/countReaders001.hs17
-rw-r--r--testsuite/tests/lib/IO/countReaders001.stdout1
-rw-r--r--testsuite/tests/lib/IO/countReaders001.stdout-i386-unknown-mingw321
-rw-r--r--testsuite/tests/lib/IO/decodingerror001.hs22
-rw-r--r--testsuite/tests/lib/IO/decodingerror001.in11
-rw-r--r--testsuite/tests/lib/IO/decodingerror001.in21
-rw-r--r--testsuite/tests/lib/IO/decodingerror001.stdout10
-rw-r--r--testsuite/tests/lib/IO/encoding001.hs71
-rw-r--r--testsuite/tests/lib/IO/encoding002.hs67
-rw-r--r--testsuite/tests/lib/IO/encoding002.stdout61
-rw-r--r--testsuite/tests/lib/IO/encodingerror001.hs27
-rw-r--r--testsuite/tests/lib/IO/encodingerror001.stdout36
-rw-r--r--testsuite/tests/lib/IO/environment001.hs16
-rw-r--r--testsuite/tests/lib/IO/environment001.stdout6
-rw-r--r--testsuite/tests/lib/IO/finalization001.hs26
-rw-r--r--testsuite/tests/lib/IO/finalization001.stdout200
-rw-r--r--testsuite/tests/lib/IO/hClose001.hs8
-rw-r--r--testsuite/tests/lib/IO/hClose001.stdout1
-rw-r--r--testsuite/tests/lib/IO/hClose002.hs32
-rw-r--r--testsuite/tests/lib/IO/hClose002.stdout4
-rw-r--r--testsuite/tests/lib/IO/hClose002.stdout-i386-unknown-solaris24
-rw-r--r--testsuite/tests/lib/IO/hClose003.hs42
-rw-r--r--testsuite/tests/lib/IO/hClose003.stdout4
-rw-r--r--testsuite/tests/lib/IO/hDuplicateTo001.hs24
-rw-r--r--testsuite/tests/lib/IO/hDuplicateTo001.stderr2
-rw-r--r--testsuite/tests/lib/IO/hFileSize001.hs8
-rw-r--r--testsuite/tests/lib/IO/hFileSize001.stdout1
-rw-r--r--testsuite/tests/lib/IO/hFileSize001.stdout-mingw1
-rw-r--r--testsuite/tests/lib/IO/hFileSize002.hs35
-rw-r--r--testsuite/tests/lib/IO/hFileSize002.stdout5
-rw-r--r--testsuite/tests/lib/IO/hFlush001.hs31
-rw-r--r--testsuite/tests/lib/IO/hFlush001.stdout2
-rw-r--r--testsuite/tests/lib/IO/hGetBuf001.hs218
-rw-r--r--testsuite/tests/lib/IO/hGetBuf001.stdout117
-rw-r--r--testsuite/tests/lib/IO/hGetBuffering001.hs21
-rw-r--r--testsuite/tests/lib/IO/hGetBuffering001.stdout7
-rw-r--r--testsuite/tests/lib/IO/hGetChar001.hs18
-rw-r--r--testsuite/tests/lib/IO/hGetChar001.stdin2
-rw-r--r--testsuite/tests/lib/IO/hGetChar001.stdout1
-rw-r--r--testsuite/tests/lib/IO/hGetLine001.hs25
-rw-r--r--testsuite/tests/lib/IO/hGetLine001.stdout100
-rw-r--r--testsuite/tests/lib/IO/hGetLine002.hs16
-rw-r--r--testsuite/tests/lib/IO/hGetLine002.stdin1
-rw-r--r--testsuite/tests/lib/IO/hGetLine002.stdout2
-rw-r--r--testsuite/tests/lib/IO/hGetLine002.stdout-hugs2
-rw-r--r--testsuite/tests/lib/IO/hGetLine003.hs9
-rw-r--r--testsuite/tests/lib/IO/hGetLine003.stdin1
-rw-r--r--testsuite/tests/lib/IO/hGetLine003.stdout2
-rw-r--r--testsuite/tests/lib/IO/hGetPosn001.hs28
-rw-r--r--testsuite/tests/lib/IO/hGetPosn001.in2
-rw-r--r--testsuite/tests/lib/IO/hGetPosn001.stdout5
-rw-r--r--testsuite/tests/lib/IO/hGetPosn001.stdout-hugs5
-rw-r--r--testsuite/tests/lib/IO/hIsEOF001.hs7
-rw-r--r--testsuite/tests/lib/IO/hIsEOF001.stdout2
-rw-r--r--testsuite/tests/lib/IO/hIsEOF002.hs48
-rw-r--r--testsuite/tests/lib/IO/hIsEOF002.stdout16
-rw-r--r--testsuite/tests/lib/IO/hReady001.hs11
-rw-r--r--testsuite/tests/lib/IO/hReady001.stdout2
-rw-r--r--testsuite/tests/lib/IO/hReady002.hs10
-rw-r--r--testsuite/tests/lib/IO/hReady002.stdout1
-rw-r--r--testsuite/tests/lib/IO/hSeek001.hs30
-rw-r--r--testsuite/tests/lib/IO/hSeek001.in1
-rw-r--r--testsuite/tests/lib/IO/hSeek001.stdout7
-rw-r--r--testsuite/tests/lib/IO/hSeek002.hs25
-rw-r--r--testsuite/tests/lib/IO/hSeek002.stdout5
-rw-r--r--testsuite/tests/lib/IO/hSeek003.hs51
-rw-r--r--testsuite/tests/lib/IO/hSeek003.stdout24
-rw-r--r--testsuite/tests/lib/IO/hSeek004.hs8
-rw-r--r--testsuite/tests/lib/IO/hSeek004.stdout1
-rw-r--r--testsuite/tests/lib/IO/hSeek004.stdout-mingw5
-rw-r--r--testsuite/tests/lib/IO/hSetBuffering002.hs6
-rw-r--r--testsuite/tests/lib/IO/hSetBuffering002.stdout6
-rw-r--r--testsuite/tests/lib/IO/hSetBuffering003.hs79
-rw-r--r--testsuite/tests/lib/IO/hSetBuffering003.stderr1
-rw-r--r--testsuite/tests/lib/IO/hSetBuffering003.stdout22
-rw-r--r--testsuite/tests/lib/IO/hSetBuffering004.hs9
-rw-r--r--testsuite/tests/lib/IO/hSetBuffering004.stdout1
-rw-r--r--testsuite/tests/lib/IO/hSetEncoding001.hs49
-rw-r--r--testsuite/tests/lib/IO/hSetEncoding001.inbin0 -> 2076 bytes
-rw-r--r--testsuite/tests/lib/IO/hSetEncoding001.stdout90
-rw-r--r--testsuite/tests/lib/IO/hSetEncoding002.hs13
-rw-r--r--testsuite/tests/lib/IO/hSetEncoding002.stdout1
-rw-r--r--testsuite/tests/lib/IO/ioeGetErrorString001.hs13
-rw-r--r--testsuite/tests/lib/IO/ioeGetErrorString001.stdout1
-rw-r--r--testsuite/tests/lib/IO/ioeGetFileName001.hs12
-rw-r--r--testsuite/tests/lib/IO/ioeGetFileName001.stdout1
-rw-r--r--testsuite/tests/lib/IO/ioeGetHandle001.hs13
-rw-r--r--testsuite/tests/lib/IO/ioeGetHandle001.stdout1
-rw-r--r--testsuite/tests/lib/IO/isEOF001.hs3
-rw-r--r--testsuite/tests/lib/IO/isEOF001.stdout1
-rw-r--r--testsuite/tests/lib/IO/latin15
-rw-r--r--testsuite/tests/lib/IO/misc001.hs24
-rw-r--r--testsuite/tests/lib/IO/misc001.stdout0
-rw-r--r--testsuite/tests/lib/IO/newline001.hs121
-rw-r--r--testsuite/tests/lib/IO/openFile001.hs11
-rw-r--r--testsuite/tests/lib/IO/openFile001.stdout1
-rw-r--r--testsuite/tests/lib/IO/openFile002.hs6
-rw-r--r--testsuite/tests/lib/IO/openFile002.stderr1
-rw-r--r--testsuite/tests/lib/IO/openFile002.stderr-hugs1
-rw-r--r--testsuite/tests/lib/IO/openFile003.hs14
-rw-r--r--testsuite/tests/lib/IO/openFile003.stdout4
-rw-r--r--testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-mingw324
-rw-r--r--testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-solaris24
-rw-r--r--testsuite/tests/lib/IO/openFile003.stdout-mingw16
-rw-r--r--testsuite/tests/lib/IO/openFile003.stdout-mips-sgi-irix4
-rw-r--r--testsuite/tests/lib/IO/openFile003.stdout-sparc-sun-solaris24
-rw-r--r--testsuite/tests/lib/IO/openFile004.hs23
-rw-r--r--testsuite/tests/lib/IO/openFile004.stdout1
-rw-r--r--testsuite/tests/lib/IO/openFile005.hs45
-rw-r--r--testsuite/tests/lib/IO/openFile005.stdout12
-rw-r--r--testsuite/tests/lib/IO/openFile005.stdout-i386-unknown-mingw3212
-rw-r--r--testsuite/tests/lib/IO/openFile006.hs14
-rw-r--r--testsuite/tests/lib/IO/openFile006.stdout2
-rw-r--r--testsuite/tests/lib/IO/openFile007.hs18
-rw-r--r--testsuite/tests/lib/IO/openFile007.stdout2
-rw-r--r--testsuite/tests/lib/IO/openFile007.stdout-i386-unknown-mingw322
-rw-r--r--testsuite/tests/lib/IO/openFile008.hs22
-rw-r--r--testsuite/tests/lib/IO/openTempFile001.hs13
-rw-r--r--testsuite/tests/lib/IO/putStr001.hs6
-rw-r--r--testsuite/tests/lib/IO/putStr001.stdout1
-rw-r--r--testsuite/tests/lib/IO/readFile001.hs26
-rw-r--r--testsuite/tests/lib/IO/readFile001.stdout30
-rw-r--r--testsuite/tests/lib/IO/readFile001.stdout-i386-unknown-mingw3230
-rw-r--r--testsuite/tests/lib/IO/readwrite001.hs23
-rw-r--r--testsuite/tests/lib/IO/readwrite001.stdout3
-rw-r--r--testsuite/tests/lib/IO/readwrite002.hs49
-rw-r--r--testsuite/tests/lib/IO/readwrite002.stdout9
-rw-r--r--testsuite/tests/lib/IO/readwrite003.hs12
-rw-r--r--testsuite/tests/lib/IO/readwrite003.stdout4
-rw-r--r--testsuite/tests/lib/IO/utf8-test3
-rw-r--r--testsuite/tests/lib/IOExts/Makefile3
-rw-r--r--testsuite/tests/lib/IOExts/all.T15
-rw-r--r--testsuite/tests/lib/IOExts/echo001.hs13
-rw-r--r--testsuite/tests/lib/IOExts/echo001.stdout14
-rw-r--r--testsuite/tests/lib/IOExts/hGetBuf002.hs22
-rw-r--r--testsuite/tests/lib/IOExts/hGetBuf002.stdout44
-rw-r--r--testsuite/tests/lib/IOExts/hGetBuf003.hs26
-rw-r--r--testsuite/tests/lib/IOExts/hGetBuf003.stdout52
-rw-r--r--testsuite/tests/lib/IOExts/hPutBuf001.hs7
-rw-r--r--testsuite/tests/lib/IOExts/hPutBuf001.stdout1
-rw-r--r--testsuite/tests/lib/IOExts/hPutBuf002.hs9
-rw-r--r--testsuite/tests/lib/IOExts/hPutBuf002.stdout1
-rw-r--r--testsuite/tests/lib/IOExts/hTell001.hs63
-rw-r--r--testsuite/tests/lib/IOExts/hTell001.stdout38
-rw-r--r--testsuite/tests/lib/IOExts/hTell002.hs33
-rw-r--r--testsuite/tests/lib/IOExts/hTell002.stdoutbin0 -> 51 bytes
-rw-r--r--testsuite/tests/lib/IOExts/performGC001.hs5
-rw-r--r--testsuite/tests/lib/IOExts/performGC001.stdout0
-rw-r--r--testsuite/tests/lib/IOExts/trace001.hs10
-rw-r--r--testsuite/tests/lib/IOExts/trace001.stderr14
-rw-r--r--testsuite/tests/lib/IOExts/trace001.stdout1
-rw-r--r--testsuite/tests/lib/IORef/Makefile3
-rw-r--r--testsuite/tests/lib/IORef/all.T4
-rw-r--r--testsuite/tests/lib/IORef/ioref001.hs9
-rw-r--r--testsuite/tests/lib/IORef/ioref001.stdout1
-rw-r--r--testsuite/tests/lib/Lex/Makefile3
-rw-r--r--testsuite/tests/lib/Lex/all.T2
-rw-r--r--testsuite/tests/lib/Lex/lexNum.hs28
-rw-r--r--testsuite/tests/lib/Lex/lexNum.stdout17
-rw-r--r--testsuite/tests/lib/Makefile3
-rw-r--r--testsuite/tests/lib/Numeric/Makefile3
-rw-r--r--testsuite/tests/lib/Numeric/all.T10
-rw-r--r--testsuite/tests/lib/Numeric/num001.hs6
-rw-r--r--testsuite/tests/lib/Numeric/num001.stdout1
-rw-r--r--testsuite/tests/lib/Numeric/num002.hs20
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf36
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix6
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-ws-646
-rw-r--r--testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd6
-rw-r--r--testsuite/tests/lib/Numeric/num003.hs20
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf36
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix6
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-ws-646
-rw-r--r--testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd6
-rw-r--r--testsuite/tests/lib/Numeric/num004.hs20
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf36
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix6
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-ws-646
-rw-r--r--testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd6
-rw-r--r--testsuite/tests/lib/Numeric/num005.hs23
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout55
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf355
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix55
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-ws-6455
-rw-r--r--testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd55
-rw-r--r--testsuite/tests/lib/Numeric/num006.hs28
-rw-r--r--testsuite/tests/lib/Numeric/num006.stdout6
-rw-r--r--testsuite/tests/lib/Numeric/num007.hs17
-rw-r--r--testsuite/tests/lib/Numeric/num007.stdout9
-rw-r--r--testsuite/tests/lib/Numeric/num008.hs57
-rw-r--r--testsuite/tests/lib/Numeric/num008.stdout148
-rw-r--r--testsuite/tests/lib/Numeric/num009.hs39
-rw-r--r--testsuite/tests/lib/Numeric/num009.stdout1
-rw-r--r--testsuite/tests/lib/Numeric/num010.hs29
-rw-r--r--testsuite/tests/lib/Numeric/num010.stdout189
-rw-r--r--testsuite/tests/lib/OldException/Makefile4
-rw-r--r--testsuite/tests/lib/OldException/OldException001.hs22
-rw-r--r--testsuite/tests/lib/OldException/OldException001.stdout2
-rw-r--r--testsuite/tests/lib/OldException/all.T3
-rw-r--r--testsuite/tests/lib/PrettyPrint/Makefile3
-rw-r--r--testsuite/tests/lib/PrettyPrint/T3911.hs23
-rw-r--r--testsuite/tests/lib/PrettyPrint/T3911.stdout4
-rw-r--r--testsuite/tests/lib/PrettyPrint/all.T2
-rw-r--r--testsuite/tests/lib/PrettyPrint/pp1.hs18
-rw-r--r--testsuite/tests/lib/PrettyPrint/pp1.stdout4
-rw-r--r--testsuite/tests/lib/Regex/Makefile3
-rw-r--r--testsuite/tests/lib/Regex/all.T3
-rw-r--r--testsuite/tests/lib/Regex/regex001.hs11
-rw-r--r--testsuite/tests/lib/Regex/regex002.hs13
-rw-r--r--testsuite/tests/lib/Regex/regex002.stdout3
-rw-r--r--testsuite/tests/lib/Regex/regex003.hs43
-rw-r--r--testsuite/tests/lib/Regex/regex003.stdout8
-rw-r--r--testsuite/tests/lib/Show/Makefile3
-rw-r--r--testsuite/tests/lib/Show/all.T2
-rw-r--r--testsuite/tests/lib/Show/showDouble.hs41
-rw-r--r--testsuite/tests/lib/Show/showDouble.stdout22
-rw-r--r--testsuite/tests/lib/System/Makefile3
-rw-r--r--testsuite/tests/lib/System/all.T8
-rw-r--r--testsuite/tests/lib/System/exitWith001.hs3
-rw-r--r--testsuite/tests/lib/System/exitWith001.stdout0
-rw-r--r--testsuite/tests/lib/System/getArgs001.hs9
-rw-r--r--testsuite/tests/lib/System/getArgs001.stdout1
-rw-r--r--testsuite/tests/lib/System/getEnv001.hs15
-rw-r--r--testsuite/tests/lib/System/getEnv001.stdout2
-rw-r--r--testsuite/tests/lib/System/system001.hs14
-rw-r--r--testsuite/tests/lib/System/system001.stdout14
-rw-r--r--testsuite/tests/lib/Text.Printf/1548.hs11
-rw-r--r--testsuite/tests/lib/Text.Printf/1548.stdout3
-rw-r--r--testsuite/tests/lib/Text.Printf/Makefile3
-rw-r--r--testsuite/tests/lib/Text.Printf/all.T1
-rw-r--r--testsuite/tests/lib/Time/Makefile3
-rw-r--r--testsuite/tests/lib/Time/all.T3
-rw-r--r--testsuite/tests/lib/Time/time002.hs16
-rw-r--r--testsuite/tests/lib/Time/time002.stdout1
-rw-r--r--testsuite/tests/lib/Time/time003.hs24
-rw-r--r--testsuite/tests/lib/Time/time003.stdout2
-rw-r--r--testsuite/tests/lib/Time/time004.hs10
-rw-r--r--testsuite/tests/lib/Time/time004.stdout1
-rw-r--r--testsuite/tests/lib/exceptions/Makefile3
-rw-r--r--testsuite/tests/lib/exceptions/all.T1
-rw-r--r--testsuite/tests/lib/exceptions/exceptions001.hs7
-rw-r--r--testsuite/tests/lib/haskell98/Makefile3
-rw-r--r--testsuite/tests/lib/haskell98/all.T1
-rw-r--r--testsuite/tests/lib/haskell98/instance-leaks.hs27
-rw-r--r--testsuite/tests/lib/integer/Makefile3
-rw-r--r--testsuite/tests/lib/integer/all.T3
-rw-r--r--testsuite/tests/lib/integer/integerBits.hs134
-rw-r--r--testsuite/tests/lib/integer/integerBits.stdout2
-rw-r--r--testsuite/tests/lib/integer/integerConversions.hs80
-rw-r--r--testsuite/tests/lib/integer/integerConversions.stdout299
-rw-r--r--testsuite/tests/lib/integer/integerConversions.stdout-ws-64299
-rw-r--r--testsuite/tests/lib/libposix/Makefile3
-rw-r--r--testsuite/tests/lib/libposix/posix001.hs24
-rw-r--r--testsuite/tests/lib/libposix/posix001.stdout4
-rw-r--r--testsuite/tests/lib/libposix/posix002.hs4
-rw-r--r--testsuite/tests/lib/libposix/posix002.stdout2
-rw-r--r--testsuite/tests/lib/libposix/posix003.hs6
-rw-r--r--testsuite/tests/lib/libposix/posix003.stdout0
-rw-r--r--testsuite/tests/lib/libposix/posix004.hs58
-rw-r--r--testsuite/tests/lib/libposix/posix004.stdout1
-rw-r--r--testsuite/tests/lib/libposix/posix005.hs25
-rw-r--r--testsuite/tests/lib/libposix/posix005.stdout7
-rw-r--r--testsuite/tests/lib/libposix/posix006.hs14
-rw-r--r--testsuite/tests/lib/libposix/posix006.stdout6
-rw-r--r--testsuite/tests/lib/libposix/posix007.hs34
-rw-r--r--testsuite/tests/lib/libposix/posix007.stdout2
-rw-r--r--testsuite/tests/lib/libposix/posix008.hs12
-rw-r--r--testsuite/tests/lib/libposix/posix008.stdout3
-rw-r--r--testsuite/tests/lib/libposix/posix009.hs15
-rw-r--r--testsuite/tests/lib/libposix/posix009.stdout0
-rw-r--r--testsuite/tests/lib/libposix/posix010.hs24
-rw-r--r--testsuite/tests/lib/libposix/posix010.stdout4
-rw-r--r--testsuite/tests/lib/libposix/posix011.hs22
-rw-r--r--testsuite/tests/lib/libposix/posix011.stdout4
-rw-r--r--testsuite/tests/lib/libposix/posix012.hs59
-rw-r--r--testsuite/tests/lib/libposix/posix012.stdout0
-rw-r--r--testsuite/tests/lib/libposix/posix013.hs21
-rw-r--r--testsuite/tests/lib/libposix/posix014.hs19
-rw-r--r--testsuite/tests/lib/should_run/4006.hs8
-rw-r--r--testsuite/tests/lib/should_run/4006.stdout2
-rw-r--r--testsuite/tests/lib/should_run/Makefile3
-rw-r--r--testsuite/tests/lib/should_run/Memo1.lhs142
-rw-r--r--testsuite/tests/lib/should_run/Memo2.lhs142
-rw-r--r--testsuite/tests/lib/should_run/addr001.hs10
-rw-r--r--testsuite/tests/lib/should_run/addr001.stdout2
-rw-r--r--testsuite/tests/lib/should_run/addr001.stdout-alpha-dec-osf32
-rw-r--r--testsuite/tests/lib/should_run/addr001.stdout-mips-sgi-irix2
-rw-r--r--testsuite/tests/lib/should_run/addr001.stdout-ws-642
-rw-r--r--testsuite/tests/lib/should_run/addr001.stdout-x86_64-unknown-openbsd2
-rw-r--r--testsuite/tests/lib/should_run/all.T70
-rw-r--r--testsuite/tests/lib/should_run/array001.hs34
-rw-r--r--testsuite/tests/lib/should_run/array001.stdout2
-rw-r--r--testsuite/tests/lib/should_run/char001.hs43
-rw-r--r--testsuite/tests/lib/should_run/char001.stdout18
-rw-r--r--testsuite/tests/lib/should_run/char002.hs7
-rw-r--r--testsuite/tests/lib/should_run/char002.stdout4
-rw-r--r--testsuite/tests/lib/should_run/cstring001.hs18
-rw-r--r--testsuite/tests/lib/should_run/dynamic001.hs107
-rw-r--r--testsuite/tests/lib/should_run/dynamic001.stdout42
-rw-r--r--testsuite/tests/lib/should_run/dynamic002.hs91
-rw-r--r--testsuite/tests/lib/should_run/dynamic002.stdout64
-rw-r--r--testsuite/tests/lib/should_run/dynamic003.hs12
-rw-r--r--testsuite/tests/lib/should_run/dynamic003.stdout1
-rw-r--r--testsuite/tests/lib/should_run/dynamic004.hs36
-rw-r--r--testsuite/tests/lib/should_run/dynamic004.stdout1
-rw-r--r--testsuite/tests/lib/should_run/dynamic005.hs14
-rw-r--r--testsuite/tests/lib/should_run/dynamic005.stdout1
-rw-r--r--testsuite/tests/lib/should_run/enum01.hs526
-rw-r--r--testsuite/tests/lib/should_run/enum01.stdout246
-rw-r--r--testsuite/tests/lib/should_run/enum01.stdout-alpha-dec-osf3230
-rw-r--r--testsuite/tests/lib/should_run/enum01.stdout-hugs246
-rw-r--r--testsuite/tests/lib/should_run/enum01.stdout-ws-64246
-rw-r--r--testsuite/tests/lib/should_run/enum02.hs263
-rw-r--r--testsuite/tests/lib/should_run/enum02.stdout141
-rw-r--r--testsuite/tests/lib/should_run/enum02.stdout-alpha-dec-osf3141
-rw-r--r--testsuite/tests/lib/should_run/enum02.stdout-hugs141
-rw-r--r--testsuite/tests/lib/should_run/enum02.stdout-mips-sgi-irix141
-rw-r--r--testsuite/tests/lib/should_run/enum02.stdout-ws-64141
-rw-r--r--testsuite/tests/lib/should_run/enum02.stdout-x86_64-unknown-openbsd141
-rw-r--r--testsuite/tests/lib/should_run/enum03.hs266
-rw-r--r--testsuite/tests/lib/should_run/enum03.stdout142
-rw-r--r--testsuite/tests/lib/should_run/enum03.stdout-alpha-dec-osf3142
-rw-r--r--testsuite/tests/lib/should_run/enum03.stdout-hugs142
-rw-r--r--testsuite/tests/lib/should_run/enum03.stdout-mips-sgi-irix142
-rw-r--r--testsuite/tests/lib/should_run/enum03.stdout-ws-64142
-rw-r--r--testsuite/tests/lib/should_run/enum03.stdout-x86_64-unknown-openbsd142
-rw-r--r--testsuite/tests/lib/should_run/enum04.hs15
-rw-r--r--testsuite/tests/lib/should_run/enum04.stdout4
-rw-r--r--testsuite/tests/lib/should_run/exceptionsrun001.hs56
-rw-r--r--testsuite/tests/lib/should_run/exceptionsrun001.stdout6
-rw-r--r--testsuite/tests/lib/should_run/exceptionsrun002.hs105
-rw-r--r--testsuite/tests/lib/should_run/exceptionsrun002.stdout40
-rw-r--r--testsuite/tests/lib/should_run/length001.hs8
-rw-r--r--testsuite/tests/lib/should_run/length001.stdout2
-rw-r--r--testsuite/tests/lib/should_run/list001.hs152
-rw-r--r--testsuite/tests/lib/should_run/list001.stdout54
-rw-r--r--testsuite/tests/lib/should_run/list001.stdout-ghc54
-rw-r--r--testsuite/tests/lib/should_run/list002.hs6
-rw-r--r--testsuite/tests/lib/should_run/list002.stdout1
-rw-r--r--testsuite/tests/lib/should_run/list003.hs7
-rw-r--r--testsuite/tests/lib/should_run/list003.stdout1
-rw-r--r--testsuite/tests/lib/should_run/memo001.hs19
-rw-r--r--testsuite/tests/lib/should_run/memo001.stdout1
-rw-r--r--testsuite/tests/lib/should_run/memo002.hs30
-rw-r--r--testsuite/tests/lib/should_run/memo002.stdout44
-rw-r--r--testsuite/tests/lib/should_run/packedstring001.hs11
-rw-r--r--testsuite/tests/lib/should_run/packedstring001.stdout1
-rw-r--r--testsuite/tests/lib/should_run/rand001.hs22
-rw-r--r--testsuite/tests/lib/should_run/rand001.stdout5
-rw-r--r--testsuite/tests/lib/should_run/ratio001.hs4
-rw-r--r--testsuite/tests/lib/should_run/ratio001.stdout1
-rw-r--r--testsuite/tests/lib/should_run/ratio001.stdout-ghc1
-rw-r--r--testsuite/tests/lib/should_run/reads001.hs10
-rw-r--r--testsuite/tests/lib/should_run/reads001.stdout4
-rw-r--r--testsuite/tests/lib/should_run/show001.hs24
-rw-r--r--testsuite/tests/lib/should_run/show001.stdout15
-rw-r--r--testsuite/tests/lib/should_run/stableptr001.hs19
-rw-r--r--testsuite/tests/lib/should_run/stableptr001.stdout1
-rw-r--r--testsuite/tests/lib/should_run/stableptr003.hs16
-rw-r--r--testsuite/tests/lib/should_run/stableptr004.hs12
-rw-r--r--testsuite/tests/lib/should_run/stableptr004.stdout2
-rw-r--r--testsuite/tests/lib/should_run/stableptr005.hs22
-rw-r--r--testsuite/tests/lib/should_run/stableptr005.stdout1
-rw-r--r--testsuite/tests/lib/should_run/text001.hs15
-rw-r--r--testsuite/tests/lib/should_run/text001.stdout1
-rw-r--r--testsuite/tests/lib/should_run/tup001.hs33
-rw-r--r--testsuite/tests/lib/should_run/tup001.stdout7
-rw-r--r--testsuite/tests/lib/should_run/weak001.hs12
-rw-r--r--testsuite/tests/lib/socket/Makefile3
-rw-r--r--testsuite/tests/lib/socket/socket001.hs58
-rw-r--r--testsuite/tests/lib/socket/socket001.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket002.hs45
-rw-r--r--testsuite/tests/lib/socket/socket002.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket003.hs43
-rw-r--r--testsuite/tests/lib/socket/socket003.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket004.hs38
-rw-r--r--testsuite/tests/lib/socket/socket004.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket005.hs37
-rw-r--r--testsuite/tests/lib/socket/socket005.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket006.hs27
-rw-r--r--testsuite/tests/lib/socket/socket006.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket007.hs44
-rw-r--r--testsuite/tests/lib/socket/socket007.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket008.hs21
-rw-r--r--testsuite/tests/lib/socket/socket008.stdout0
-rw-r--r--testsuite/tests/lib/socket/socket009.hs28
-rw-r--r--testsuite/tests/lib/socket/socket009.stdout0
-rw-r--r--testsuite/tests/lib/win32/Makefile3
-rw-r--r--testsuite/tests/lib/win32/all.T10
-rw-r--r--testsuite/tests/lib/win32/win32001.hs104
-rw-r--r--testsuite/tests/lib/win32/win32002.hs19
482 files changed, 24727 insertions, 0 deletions
diff --git a/testsuite/tests/lib/CPUTime/CPUTime001.hs b/testsuite/tests/lib/CPUTime/CPUTime001.hs
new file mode 100644
index 0000000000..6c43c57ec5
--- /dev/null
+++ b/testsuite/tests/lib/CPUTime/CPUTime001.hs
@@ -0,0 +1,26 @@
+-- !!! Test getCPUTime
+
+import System.CPUTime
+import System.IO
+
+main :: IO ()
+main = do
+ t28 <- timeFib 28
+ t29 <- timeFib 29
+ t30 <- timeFib 30
+ print (t28 <= t29, t29 <= t30)
+
+timeFib :: Integer -> IO Integer
+timeFib n = do
+ start <- getCPUTime
+ print (nfib n)
+ end <- getCPUTime
+ return (end - start)
+
+nfib :: Integer -> Integer
+nfib n
+ | n <= 1 = 1
+ | otherwise = (n1 + n2 + 1)
+ where
+ n1 = nfib (n-1)
+ n2 = nfib (n-2)
diff --git a/testsuite/tests/lib/CPUTime/CPUTime001.stdout b/testsuite/tests/lib/CPUTime/CPUTime001.stdout
new file mode 100644
index 0000000000..032e7595f0
--- /dev/null
+++ b/testsuite/tests/lib/CPUTime/CPUTime001.stdout
@@ -0,0 +1,4 @@
+1028457
+1664079
+2692537
+(True,True)
diff --git a/testsuite/tests/lib/CPUTime/Makefile b/testsuite/tests/lib/CPUTime/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/CPUTime/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/CPUTime/all.T b/testsuite/tests/lib/CPUTime/all.T
new file mode 100644
index 0000000000..d204b0a7aa
--- /dev/null
+++ b/testsuite/tests/lib/CPUTime/all.T
@@ -0,0 +1 @@
+test('CPUTime001', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Char/Makefile b/testsuite/tests/lib/Char/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Char/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Char/all.T b/testsuite/tests/lib/Char/all.T
new file mode 100644
index 0000000000..81ecb28f69
--- /dev/null
+++ b/testsuite/tests/lib/Char/all.T
@@ -0,0 +1,10 @@
+test('readLitChar', normal, compile_and_run, [''])
+
+if config.platform == 'i386-unknown-openbsd':
+ ways = expect_fail
+else:
+ ways = normal
+
+test('unicode001', ways, compile_and_run, [''])
+test('unicode002', ways, compile_and_run, [''])
+
diff --git a/testsuite/tests/lib/Char/readLitChar.hs b/testsuite/tests/lib/Char/readLitChar.hs
new file mode 100644
index 0000000000..7dc01e36e4
--- /dev/null
+++ b/testsuite/tests/lib/Char/readLitChar.hs
@@ -0,0 +1,12 @@
+module Main (main)
+where
+
+import Data.Char (digitToInt, lexLitChar, readLitChar)
+
+main :: IO ()
+main =
+ do putStrLn (show $ readLitChar "A")
+ putStrLn (show $ readLitChar "'A'")
+ putStrLn (show $ lexLitChar "A")
+ putStrLn (show $ lexLitChar "'A'")
+
diff --git a/testsuite/tests/lib/Char/readLitChar.stdout b/testsuite/tests/lib/Char/readLitChar.stdout
new file mode 100644
index 0000000000..649c342e4a
--- /dev/null
+++ b/testsuite/tests/lib/Char/readLitChar.stdout
@@ -0,0 +1,4 @@
+[('A',"")]
+[('\'',"A'")]
+[("A","")]
+[("'","A'")]
diff --git a/testsuite/tests/lib/Char/unicode001.hs b/testsuite/tests/lib/Char/unicode001.hs
new file mode 100644
index 0000000000..90da1d80ee
--- /dev/null
+++ b/testsuite/tests/lib/Char/unicode001.hs
@@ -0,0 +1,46 @@
+-- !!! Tests the various character classifiactions for a selection of Unicode
+-- characters.
+
+module Main where
+
+import Data.Char
+
+main = do
+ putStrLn (" " ++ concat (map (++" ") strs))
+ mapM putStrLn (map do_char chars)
+ where
+ do_char char = s ++ (take (12-length s) (repeat ' ')) ++ concat (map f bs)
+ where
+ s = show char
+ bs = map ($char) functions
+ f True = "X "
+ f False = " "
+
+strs = ["upper","lower","alpha","alnum","digit","print","space","cntrl"]
+
+functions = [isUpper,isLower,isAlpha,isAlphaNum,isDigit,isPrint,isSpace,isControl]
+
+chars = [backspace,tab,space,zero,lower_a,upper_a,delete,
+ right_pointing_double_angle_quotation_mark,
+ greek_capital_letter_alpha,
+ bengali_digit_zero,
+ en_space,
+ gothic_letter_ahsa,
+ monospaced_digit_zero
+ ]
+
+backspace = '\x08'
+tab = '\t'
+space = ' '
+zero = '0'
+lower_a = 'a'
+upper_a = 'A'
+delete = '\x7f'
+right_pointing_double_angle_quotation_mark = '\xBB'
+latin_small_letter_i_with_caron = '\x1D0'
+combining_acute_accent = '\x301'
+greek_capital_letter_alpha = '\x0391'
+bengali_digit_zero = '\x09E6'
+en_space = '\x2002'
+gothic_letter_ahsa = '\x10330'
+monospaced_digit_zero = '\x1D7F6'
diff --git a/testsuite/tests/lib/Char/unicode001.stdout b/testsuite/tests/lib/Char/unicode001.stdout
new file mode 100644
index 0000000000..86163abae1
--- /dev/null
+++ b/testsuite/tests/lib/Char/unicode001.stdout
@@ -0,0 +1,14 @@
+ upper lower alpha alnum digit print space cntrl
+'\b' X
+'\t' X X
+' ' X X
+'0' X X X
+'a' X X X X
+'A' X X X X
+'\DEL' X
+'\187' X
+'\913' X X X X
+'\2534' X X
+'\8194' X X
+'\66352' X X X
+'\120822' X X
diff --git a/testsuite/tests/lib/Char/unicode001.stdout-hugs b/testsuite/tests/lib/Char/unicode001.stdout-hugs
new file mode 100644
index 0000000000..98c9568f8e
--- /dev/null
+++ b/testsuite/tests/lib/Char/unicode001.stdout-hugs
@@ -0,0 +1,14 @@
+ upper lower alpha alnum digit print space cntrl
+'\b' X
+'\t' X X
+' ' X X
+'0' X X X
+'a' X X X X
+'A' X X X X
+'\DEL' X
+'\187' X
+'\913' X X X X
+'\2534' X X
+'\8194' X
+'\66352' X X X
+'\120822' X X
diff --git a/testsuite/tests/lib/Char/unicode002.hs b/testsuite/tests/lib/Char/unicode002.hs
new file mode 100644
index 0000000000..50ed5ddf44
--- /dev/null
+++ b/testsuite/tests/lib/Char/unicode002.hs
@@ -0,0 +1,44 @@
+module Main where
+
+
+import Data.Char
+import Numeric
+
+header = "Code C P S U L A D"
+
+preds = [
+ isControl,
+ isPrint,
+ isSpace,
+ isUpper,
+ isLower,
+ isAlpha,
+ isDigit]
+
+prtBool :: Bool -> String
+
+prtBool True = "T "
+prtBool False = "F "
+
+showCode :: Char -> Int -> String
+
+showCode c w = code ++ pad
+ where
+ code = show (ord c)
+ l = length code
+ spaces = map anytospace [1..]
+ anytospace _ = ' '
+ pad | l >= w = ""
+ | otherwise = take (w - l) spaces
+
+charCode :: Char -> String
+
+rapply a b = b a
+
+charCode c = (showCode c 5) ++ (foldr1 (++) $ map prtBool $ map (rapply c) preds)
+
+main = do
+ putStrLn header
+ mapM (putStrLn . charCode) [ (chr 0) .. (chr 6553) ]
+
+
diff --git a/testsuite/tests/lib/Char/unicode002.stdout b/testsuite/tests/lib/Char/unicode002.stdout
new file mode 100644
index 0000000000..5c1f4c3342
--- /dev/null
+++ b/testsuite/tests/lib/Char/unicode002.stdout
@@ -0,0 +1,6555 @@
+Code C P S U L A D
+0 T F F F F F F
+1 T F F F F F F
+2 T F F F F F F
+3 T F F F F F F
+4 T F F F F F F
+5 T F F F F F F
+6 T F F F F F F
+7 T F F F F F F
+8 T F F F F F F
+9 T F T F F F F
+10 T F T F F F F
+11 T F T F F F F
+12 T F T F F F F
+13 T F T F F F F
+14 T F F F F F F
+15 T F F F F F F
+16 T F F F F F F
+17 T F F F F F F
+18 T F F F F F F
+19 T F F F F F F
+20 T F F F F F F
+21 T F F F F F F
+22 T F F F F F F
+23 T F F F F F F
+24 T F F F F F F
+25 T F F F F F F
+26 T F F F F F F
+27 T F F F F F F
+28 T F F F F F F
+29 T F F F F F F
+30 T F F F F F F
+31 T F F F F F F
+32 F T T F F F F
+33 F T F F F F F
+34 F T F F F F F
+35 F T F F F F F
+36 F T F F F F F
+37 F T F F F F F
+38 F T F F F F F
+39 F T F F F F F
+40 F T F F F F F
+41 F T F F F F F
+42 F T F F F F F
+43 F T F F F F F
+44 F T F F F F F
+45 F T F F F F F
+46 F T F F F F F
+47 F T F F F F F
+48 F T F F F F T
+49 F T F F F F T
+50 F T F F F F T
+51 F T F F F F T
+52 F T F F F F T
+53 F T F F F F T
+54 F T F F F F T
+55 F T F F F F T
+56 F T F F F F T
+57 F T F F F F T
+58 F T F F F F F
+59 F T F F F F F
+60 F T F F F F F
+61 F T F F F F F
+62 F T F F F F F
+63 F T F F F F F
+64 F T F F F F F
+65 F T F T F T F
+66 F T F T F T F
+67 F T F T F T F
+68 F T F T F T F
+69 F T F T F T F
+70 F T F T F T F
+71 F T F T F T F
+72 F T F T F T F
+73 F T F T F T F
+74 F T F T F T F
+75 F T F T F T F
+76 F T F T F T F
+77 F T F T F T F
+78 F T F T F T F
+79 F T F T F T F
+80 F T F T F T F
+81 F T F T F T F
+82 F T F T F T F
+83 F T F T F T F
+84 F T F T F T F
+85 F T F T F T F
+86 F T F T F T F
+87 F T F T F T F
+88 F T F T F T F
+89 F T F T F T F
+90 F T F T F T F
+91 F T F F F F F
+92 F T F F F F F
+93 F T F F F F F
+94 F T F F F F F
+95 F T F F F F F
+96 F T F F F F F
+97 F T F F T T F
+98 F T F F T T F
+99 F T F F T T F
+100 F T F F T T F
+101 F T F F T T F
+102 F T F F T T F
+103 F T F F T T F
+104 F T F F T T F
+105 F T F F T T F
+106 F T F F T T F
+107 F T F F T T F
+108 F T F F T T F
+109 F T F F T T F
+110 F T F F T T F
+111 F T F F T T F
+112 F T F F T T F
+113 F T F F T T F
+114 F T F F T T F
+115 F T F F T T F
+116 F T F F T T F
+117 F T F F T T F
+118 F T F F T T F
+119 F T F F T T F
+120 F T F F T T F
+121 F T F F T T F
+122 F T F F T T F
+123 F T F F F F F
+124 F T F F F F F
+125 F T F F F F F
+126 F T F F F F F
+127 T F F F F F F
+128 T F F F F F F
+129 T F F F F F F
+130 T F F F F F F
+131 T F F F F F F
+132 T F F F F F F
+133 T F F F F F F
+134 T F F F F F F
+135 T F F F F F F
+136 T F F F F F F
+137 T F F F F F F
+138 T F F F F F F
+139 T F F F F F F
+140 T F F F F F F
+141 T F F F F F F
+142 T F F F F F F
+143 T F F F F F F
+144 T F F F F F F
+145 T F F F F F F
+146 T F F F F F F
+147 T F F F F F F
+148 T F F F F F F
+149 T F F F F F F
+150 T F F F F F F
+151 T F F F F F F
+152 T F F F F F F
+153 T F F F F F F
+154 T F F F F F F
+155 T F F F F F F
+156 T F F F F F F
+157 T F F F F F F
+158 T F F F F F F
+159 T F F F F F F
+160 F T T F F F F
+161 F T F F F F F
+162 F T F F F F F
+163 F T F F F F F
+164 F T F F F F F
+165 F T F F F F F
+166 F T F F F F F
+167 F T F F F F F
+168 F T F F F F F
+169 F T F F F F F
+170 F T F F T T F
+171 F T F F F F F
+172 F T F F F F F
+173 F F F F F F F
+174 F T F F F F F
+175 F T F F F F F
+176 F T F F F F F
+177 F T F F F F F
+178 F T F F F F F
+179 F T F F F F F
+180 F T F F F F F
+181 F T F F T T F
+182 F T F F F F F
+183 F T F F F F F
+184 F T F F F F F
+185 F T F F F F F
+186 F T F F T T F
+187 F T F F F F F
+188 F T F F F F F
+189 F T F F F F F
+190 F T F F F F F
+191 F T F F F F F
+192 F T F T F T F
+193 F T F T F T F
+194 F T F T F T F
+195 F T F T F T F
+196 F T F T F T F
+197 F T F T F T F
+198 F T F T F T F
+199 F T F T F T F
+200 F T F T F T F
+201 F T F T F T F
+202 F T F T F T F
+203 F T F T F T F
+204 F T F T F T F
+205 F T F T F T F
+206 F T F T F T F
+207 F T F T F T F
+208 F T F T F T F
+209 F T F T F T F
+210 F T F T F T F
+211 F T F T F T F
+212 F T F T F T F
+213 F T F T F T F
+214 F T F T F T F
+215 F T F F F F F
+216 F T F T F T F
+217 F T F T F T F
+218 F T F T F T F
+219 F T F T F T F
+220 F T F T F T F
+221 F T F T F T F
+222 F T F T F T F
+223 F T F F T T F
+224 F T F F T T F
+225 F T F F T T F
+226 F T F F T T F
+227 F T F F T T F
+228 F T F F T T F
+229 F T F F T T F
+230 F T F F T T F
+231 F T F F T T F
+232 F T F F T T F
+233 F T F F T T F
+234 F T F F T T F
+235 F T F F T T F
+236 F T F F T T F
+237 F T F F T T F
+238 F T F F T T F
+239 F T F F T T F
+240 F T F F T T F
+241 F T F F T T F
+242 F T F F T T F
+243 F T F F T T F
+244 F T F F T T F
+245 F T F F T T F
+246 F T F F T T F
+247 F T F F F F F
+248 F T F F T T F
+249 F T F F T T F
+250 F T F F T T F
+251 F T F F T T F
+252 F T F F T T F
+253 F T F F T T F
+254 F T F F T T F
+255 F T F F T T F
+256 F T F T F T F
+257 F T F F T T F
+258 F T F T F T F
+259 F T F F T T F
+260 F T F T F T F
+261 F T F F T T F
+262 F T F T F T F
+263 F T F F T T F
+264 F T F T F T F
+265 F T F F T T F
+266 F T F T F T F
+267 F T F F T T F
+268 F T F T F T F
+269 F T F F T T F
+270 F T F T F T F
+271 F T F F T T F
+272 F T F T F T F
+273 F T F F T T F
+274 F T F T F T F
+275 F T F F T T F
+276 F T F T F T F
+277 F T F F T T F
+278 F T F T F T F
+279 F T F F T T F
+280 F T F T F T F
+281 F T F F T T F
+282 F T F T F T F
+283 F T F F T T F
+284 F T F T F T F
+285 F T F F T T F
+286 F T F T F T F
+287 F T F F T T F
+288 F T F T F T F
+289 F T F F T T F
+290 F T F T F T F
+291 F T F F T T F
+292 F T F T F T F
+293 F T F F T T F
+294 F T F T F T F
+295 F T F F T T F
+296 F T F T F T F
+297 F T F F T T F
+298 F T F T F T F
+299 F T F F T T F
+300 F T F T F T F
+301 F T F F T T F
+302 F T F T F T F
+303 F T F F T T F
+304 F T F T F T F
+305 F T F F T T F
+306 F T F T F T F
+307 F T F F T T F
+308 F T F T F T F
+309 F T F F T T F
+310 F T F T F T F
+311 F T F F T T F
+312 F T F F T T F
+313 F T F T F T F
+314 F T F F T T F
+315 F T F T F T F
+316 F T F F T T F
+317 F T F T F T F
+318 F T F F T T F
+319 F T F T F T F
+320 F T F F T T F
+321 F T F T F T F
+322 F T F F T T F
+323 F T F T F T F
+324 F T F F T T F
+325 F T F T F T F
+326 F T F F T T F
+327 F T F T F T F
+328 F T F F T T F
+329 F T F F T T F
+330 F T F T F T F
+331 F T F F T T F
+332 F T F T F T F
+333 F T F F T T F
+334 F T F T F T F
+335 F T F F T T F
+336 F T F T F T F
+337 F T F F T T F
+338 F T F T F T F
+339 F T F F T T F
+340 F T F T F T F
+341 F T F F T T F
+342 F T F T F T F
+343 F T F F T T F
+344 F T F T F T F
+345 F T F F T T F
+346 F T F T F T F
+347 F T F F T T F
+348 F T F T F T F
+349 F T F F T T F
+350 F T F T F T F
+351 F T F F T T F
+352 F T F T F T F
+353 F T F F T T F
+354 F T F T F T F
+355 F T F F T T F
+356 F T F T F T F
+357 F T F F T T F
+358 F T F T F T F
+359 F T F F T T F
+360 F T F T F T F
+361 F T F F T T F
+362 F T F T F T F
+363 F T F F T T F
+364 F T F T F T F
+365 F T F F T T F
+366 F T F T F T F
+367 F T F F T T F
+368 F T F T F T F
+369 F T F F T T F
+370 F T F T F T F
+371 F T F F T T F
+372 F T F T F T F
+373 F T F F T T F
+374 F T F T F T F
+375 F T F F T T F
+376 F T F T F T F
+377 F T F T F T F
+378 F T F F T T F
+379 F T F T F T F
+380 F T F F T T F
+381 F T F T F T F
+382 F T F F T T F
+383 F T F F T T F
+384 F T F F T T F
+385 F T F T F T F
+386 F T F T F T F
+387 F T F F T T F
+388 F T F T F T F
+389 F T F F T T F
+390 F T F T F T F
+391 F T F T F T F
+392 F T F F T T F
+393 F T F T F T F
+394 F T F T F T F
+395 F T F T F T F
+396 F T F F T T F
+397 F T F F T T F
+398 F T F T F T F
+399 F T F T F T F
+400 F T F T F T F
+401 F T F T F T F
+402 F T F F T T F
+403 F T F T F T F
+404 F T F T F T F
+405 F T F F T T F
+406 F T F T F T F
+407 F T F T F T F
+408 F T F T F T F
+409 F T F F T T F
+410 F T F F T T F
+411 F T F F T T F
+412 F T F T F T F
+413 F T F T F T F
+414 F T F F T T F
+415 F T F T F T F
+416 F T F T F T F
+417 F T F F T T F
+418 F T F T F T F
+419 F T F F T T F
+420 F T F T F T F
+421 F T F F T T F
+422 F T F T F T F
+423 F T F T F T F
+424 F T F F T T F
+425 F T F T F T F
+426 F T F F T T F
+427 F T F F T T F
+428 F T F T F T F
+429 F T F F T T F
+430 F T F T F T F
+431 F T F T F T F
+432 F T F F T T F
+433 F T F T F T F
+434 F T F T F T F
+435 F T F T F T F
+436 F T F F T T F
+437 F T F T F T F
+438 F T F F T T F
+439 F T F T F T F
+440 F T F T F T F
+441 F T F F T T F
+442 F T F F T T F
+443 F T F F F T F
+444 F T F T F T F
+445 F T F F T T F
+446 F T F F T T F
+447 F T F F T T F
+448 F T F F F T F
+449 F T F F F T F
+450 F T F F F T F
+451 F T F F F T F
+452 F T F T F T F
+453 F T F T F T F
+454 F T F F T T F
+455 F T F T F T F
+456 F T F T F T F
+457 F T F F T T F
+458 F T F T F T F
+459 F T F T F T F
+460 F T F F T T F
+461 F T F T F T F
+462 F T F F T T F
+463 F T F T F T F
+464 F T F F T T F
+465 F T F T F T F
+466 F T F F T T F
+467 F T F T F T F
+468 F T F F T T F
+469 F T F T F T F
+470 F T F F T T F
+471 F T F T F T F
+472 F T F F T T F
+473 F T F T F T F
+474 F T F F T T F
+475 F T F T F T F
+476 F T F F T T F
+477 F T F F T T F
+478 F T F T F T F
+479 F T F F T T F
+480 F T F T F T F
+481 F T F F T T F
+482 F T F T F T F
+483 F T F F T T F
+484 F T F T F T F
+485 F T F F T T F
+486 F T F T F T F
+487 F T F F T T F
+488 F T F T F T F
+489 F T F F T T F
+490 F T F T F T F
+491 F T F F T T F
+492 F T F T F T F
+493 F T F F T T F
+494 F T F T F T F
+495 F T F F T T F
+496 F T F F T T F
+497 F T F T F T F
+498 F T F T F T F
+499 F T F F T T F
+500 F T F T F T F
+501 F T F F T T F
+502 F T F T F T F
+503 F T F T F T F
+504 F T F T F T F
+505 F T F F T T F
+506 F T F T F T F
+507 F T F F T T F
+508 F T F T F T F
+509 F T F F T T F
+510 F T F T F T F
+511 F T F F T T F
+512 F T F T F T F
+513 F T F F T T F
+514 F T F T F T F
+515 F T F F T T F
+516 F T F T F T F
+517 F T F F T T F
+518 F T F T F T F
+519 F T F F T T F
+520 F T F T F T F
+521 F T F F T T F
+522 F T F T F T F
+523 F T F F T T F
+524 F T F T F T F
+525 F T F F T T F
+526 F T F T F T F
+527 F T F F T T F
+528 F T F T F T F
+529 F T F F T T F
+530 F T F T F T F
+531 F T F F T T F
+532 F T F T F T F
+533 F T F F T T F
+534 F T F T F T F
+535 F T F F T T F
+536 F T F T F T F
+537 F T F F T T F
+538 F T F T F T F
+539 F T F F T T F
+540 F T F T F T F
+541 F T F F T T F
+542 F T F T F T F
+543 F T F F T T F
+544 F T F T F T F
+545 F T F F T T F
+546 F T F T F T F
+547 F T F F T T F
+548 F T F T F T F
+549 F T F F T T F
+550 F T F T F T F
+551 F T F F T T F
+552 F T F T F T F
+553 F T F F T T F
+554 F T F T F T F
+555 F T F F T T F
+556 F T F T F T F
+557 F T F F T T F
+558 F T F T F T F
+559 F T F F T T F
+560 F T F T F T F
+561 F T F F T T F
+562 F T F T F T F
+563 F T F F T T F
+564 F T F F T T F
+565 F T F F T T F
+566 F T F F T T F
+567 F T F F T T F
+568 F T F F T T F
+569 F T F F T T F
+570 F T F T F T F
+571 F T F T F T F
+572 F T F F T T F
+573 F T F T F T F
+574 F T F T F T F
+575 F T F F T T F
+576 F T F F T T F
+577 F T F T F T F
+578 F T F F T T F
+579 F T F T F T F
+580 F T F T F T F
+581 F T F T F T F
+582 F T F T F T F
+583 F T F F T T F
+584 F T F T F T F
+585 F T F F T T F
+586 F T F T F T F
+587 F T F F T T F
+588 F T F T F T F
+589 F T F F T T F
+590 F T F T F T F
+591 F T F F T T F
+592 F T F F T T F
+593 F T F F T T F
+594 F T F F T T F
+595 F T F F T T F
+596 F T F F T T F
+597 F T F F T T F
+598 F T F F T T F
+599 F T F F T T F
+600 F T F F T T F
+601 F T F F T T F
+602 F T F F T T F
+603 F T F F T T F
+604 F T F F T T F
+605 F T F F T T F
+606 F T F F T T F
+607 F T F F T T F
+608 F T F F T T F
+609 F T F F T T F
+610 F T F F T T F
+611 F T F F T T F
+612 F T F F T T F
+613 F T F F T T F
+614 F T F F T T F
+615 F T F F T T F
+616 F T F F T T F
+617 F T F F T T F
+618 F T F F T T F
+619 F T F F T T F
+620 F T F F T T F
+621 F T F F T T F
+622 F T F F T T F
+623 F T F F T T F
+624 F T F F T T F
+625 F T F F T T F
+626 F T F F T T F
+627 F T F F T T F
+628 F T F F T T F
+629 F T F F T T F
+630 F T F F T T F
+631 F T F F T T F
+632 F T F F T T F
+633 F T F F T T F
+634 F T F F T T F
+635 F T F F T T F
+636 F T F F T T F
+637 F T F F T T F
+638 F T F F T T F
+639 F T F F T T F
+640 F T F F T T F
+641 F T F F T T F
+642 F T F F T T F
+643 F T F F T T F
+644 F T F F T T F
+645 F T F F T T F
+646 F T F F T T F
+647 F T F F T T F
+648 F T F F T T F
+649 F T F F T T F
+650 F T F F T T F
+651 F T F F T T F
+652 F T F F T T F
+653 F T F F T T F
+654 F T F F T T F
+655 F T F F T T F
+656 F T F F T T F
+657 F T F F T T F
+658 F T F F T T F
+659 F T F F T T F
+660 F T F F F T F
+661 F T F F T T F
+662 F T F F T T F
+663 F T F F T T F
+664 F T F F T T F
+665 F T F F T T F
+666 F T F F T T F
+667 F T F F T T F
+668 F T F F T T F
+669 F T F F T T F
+670 F T F F T T F
+671 F T F F T T F
+672 F T F F T T F
+673 F T F F T T F
+674 F T F F T T F
+675 F T F F T T F
+676 F T F F T T F
+677 F T F F T T F
+678 F T F F T T F
+679 F T F F T T F
+680 F T F F T T F
+681 F T F F T T F
+682 F T F F T T F
+683 F T F F T T F
+684 F T F F T T F
+685 F T F F T T F
+686 F T F F T T F
+687 F T F F T T F
+688 F T F F F T F
+689 F T F F F T F
+690 F T F F F T F
+691 F T F F F T F
+692 F T F F F T F
+693 F T F F F T F
+694 F T F F F T F
+695 F T F F F T F
+696 F T F F F T F
+697 F T F F F T F
+698 F T F F F T F
+699 F T F F F T F
+700 F T F F F T F
+701 F T F F F T F
+702 F T F F F T F
+703 F T F F F T F
+704 F T F F F T F
+705 F T F F F T F
+706 F T F F F F F
+707 F T F F F F F
+708 F T F F F F F
+709 F T F F F F F
+710 F T F F F T F
+711 F T F F F T F
+712 F T F F F T F
+713 F T F F F T F
+714 F T F F F T F
+715 F T F F F T F
+716 F T F F F T F
+717 F T F F F T F
+718 F T F F F T F
+719 F T F F F T F
+720 F T F F F T F
+721 F T F F F T F
+722 F T F F F F F
+723 F T F F F F F
+724 F T F F F F F
+725 F T F F F F F
+726 F T F F F F F
+727 F T F F F F F
+728 F T F F F F F
+729 F T F F F F F
+730 F T F F F F F
+731 F T F F F F F
+732 F T F F F F F
+733 F T F F F F F
+734 F T F F F F F
+735 F T F F F F F
+736 F T F F F T F
+737 F T F F F T F
+738 F T F F F T F
+739 F T F F F T F
+740 F T F F F T F
+741 F T F F F F F
+742 F T F F F F F
+743 F T F F F F F
+744 F T F F F F F
+745 F T F F F F F
+746 F T F F F F F
+747 F T F F F F F
+748 F T F F F T F
+749 F T F F F F F
+750 F T F F F T F
+751 F T F F F F F
+752 F T F F F F F
+753 F T F F F F F
+754 F T F F F F F
+755 F T F F F F F
+756 F T F F F F F
+757 F T F F F F F
+758 F T F F F F F
+759 F T F F F F F
+760 F T F F F F F
+761 F T F F F F F
+762 F T F F F F F
+763 F T F F F F F
+764 F T F F F F F
+765 F T F F F F F
+766 F T F F F F F
+767 F T F F F F F
+768 F T F F F F F
+769 F T F F F F F
+770 F T F F F F F
+771 F T F F F F F
+772 F T F F F F F
+773 F T F F F F F
+774 F T F F F F F
+775 F T F F F F F
+776 F T F F F F F
+777 F T F F F F F
+778 F T F F F F F
+779 F T F F F F F
+780 F T F F F F F
+781 F T F F F F F
+782 F T F F F F F
+783 F T F F F F F
+784 F T F F F F F
+785 F T F F F F F
+786 F T F F F F F
+787 F T F F F F F
+788 F T F F F F F
+789 F T F F F F F
+790 F T F F F F F
+791 F T F F F F F
+792 F T F F F F F
+793 F T F F F F F
+794 F T F F F F F
+795 F T F F F F F
+796 F T F F F F F
+797 F T F F F F F
+798 F T F F F F F
+799 F T F F F F F
+800 F T F F F F F
+801 F T F F F F F
+802 F T F F F F F
+803 F T F F F F F
+804 F T F F F F F
+805 F T F F F F F
+806 F T F F F F F
+807 F T F F F F F
+808 F T F F F F F
+809 F T F F F F F
+810 F T F F F F F
+811 F T F F F F F
+812 F T F F F F F
+813 F T F F F F F
+814 F T F F F F F
+815 F T F F F F F
+816 F T F F F F F
+817 F T F F F F F
+818 F T F F F F F
+819 F T F F F F F
+820 F T F F F F F
+821 F T F F F F F
+822 F T F F F F F
+823 F T F F F F F
+824 F T F F F F F
+825 F T F F F F F
+826 F T F F F F F
+827 F T F F F F F
+828 F T F F F F F
+829 F T F F F F F
+830 F T F F F F F
+831 F T F F F F F
+832 F T F F F F F
+833 F T F F F F F
+834 F T F F F F F
+835 F T F F F F F
+836 F T F F F F F
+837 F T F F F F F
+838 F T F F F F F
+839 F T F F F F F
+840 F T F F F F F
+841 F T F F F F F
+842 F T F F F F F
+843 F T F F F F F
+844 F T F F F F F
+845 F T F F F F F
+846 F T F F F F F
+847 F T F F F F F
+848 F T F F F F F
+849 F T F F F F F
+850 F T F F F F F
+851 F T F F F F F
+852 F T F F F F F
+853 F T F F F F F
+854 F T F F F F F
+855 F T F F F F F
+856 F T F F F F F
+857 F T F F F F F
+858 F T F F F F F
+859 F T F F F F F
+860 F T F F F F F
+861 F T F F F F F
+862 F T F F F F F
+863 F T F F F F F
+864 F T F F F F F
+865 F T F F F F F
+866 F T F F F F F
+867 F T F F F F F
+868 F T F F F F F
+869 F T F F F F F
+870 F T F F F F F
+871 F T F F F F F
+872 F T F F F F F
+873 F T F F F F F
+874 F T F F F F F
+875 F T F F F F F
+876 F T F F F F F
+877 F T F F F F F
+878 F T F F F F F
+879 F T F F F F F
+880 F T F T F T F
+881 F T F F T T F
+882 F T F T F T F
+883 F T F F T T F
+884 F T F F F T F
+885 F T F F F F F
+886 F T F T F T F
+887 F T F F T T F
+888 F F F F F F F
+889 F F F F F F F
+890 F T F F F T F
+891 F T F F T T F
+892 F T F F T T F
+893 F T F F T T F
+894 F T F F F F F
+895 F F F F F F F
+896 F F F F F F F
+897 F F F F F F F
+898 F F F F F F F
+899 F F F F F F F
+900 F T F F F F F
+901 F T F F F F F
+902 F T F T F T F
+903 F T F F F F F
+904 F T F T F T F
+905 F T F T F T F
+906 F T F T F T F
+907 F F F F F F F
+908 F T F T F T F
+909 F F F F F F F
+910 F T F T F T F
+911 F T F T F T F
+912 F T F F T T F
+913 F T F T F T F
+914 F T F T F T F
+915 F T F T F T F
+916 F T F T F T F
+917 F T F T F T F
+918 F T F T F T F
+919 F T F T F T F
+920 F T F T F T F
+921 F T F T F T F
+922 F T F T F T F
+923 F T F T F T F
+924 F T F T F T F
+925 F T F T F T F
+926 F T F T F T F
+927 F T F T F T F
+928 F T F T F T F
+929 F T F T F T F
+930 F F F F F F F
+931 F T F T F T F
+932 F T F T F T F
+933 F T F T F T F
+934 F T F T F T F
+935 F T F T F T F
+936 F T F T F T F
+937 F T F T F T F
+938 F T F T F T F
+939 F T F T F T F
+940 F T F F T T F
+941 F T F F T T F
+942 F T F F T T F
+943 F T F F T T F
+944 F T F F T T F
+945 F T F F T T F
+946 F T F F T T F
+947 F T F F T T F
+948 F T F F T T F
+949 F T F F T T F
+950 F T F F T T F
+951 F T F F T T F
+952 F T F F T T F
+953 F T F F T T F
+954 F T F F T T F
+955 F T F F T T F
+956 F T F F T T F
+957 F T F F T T F
+958 F T F F T T F
+959 F T F F T T F
+960 F T F F T T F
+961 F T F F T T F
+962 F T F F T T F
+963 F T F F T T F
+964 F T F F T T F
+965 F T F F T T F
+966 F T F F T T F
+967 F T F F T T F
+968 F T F F T T F
+969 F T F F T T F
+970 F T F F T T F
+971 F T F F T T F
+972 F T F F T T F
+973 F T F F T T F
+974 F T F F T T F
+975 F T F T F T F
+976 F T F F T T F
+977 F T F F T T F
+978 F T F T F T F
+979 F T F T F T F
+980 F T F T F T F
+981 F T F F T T F
+982 F T F F T T F
+983 F T F F T T F
+984 F T F T F T F
+985 F T F F T T F
+986 F T F T F T F
+987 F T F F T T F
+988 F T F T F T F
+989 F T F F T T F
+990 F T F T F T F
+991 F T F F T T F
+992 F T F T F T F
+993 F T F F T T F
+994 F T F T F T F
+995 F T F F T T F
+996 F T F T F T F
+997 F T F F T T F
+998 F T F T F T F
+999 F T F F T T F
+1000 F T F T F T F
+1001 F T F F T T F
+1002 F T F T F T F
+1003 F T F F T T F
+1004 F T F T F T F
+1005 F T F F T T F
+1006 F T F T F T F
+1007 F T F F T T F
+1008 F T F F T T F
+1009 F T F F T T F
+1010 F T F F T T F
+1011 F T F F T T F
+1012 F T F T F T F
+1013 F T F F T T F
+1014 F T F F F F F
+1015 F T F T F T F
+1016 F T F F T T F
+1017 F T F T F T F
+1018 F T F T F T F
+1019 F T F F T T F
+1020 F T F F T T F
+1021 F T F T F T F
+1022 F T F T F T F
+1023 F T F T F T F
+1024 F T F T F T F
+1025 F T F T F T F
+1026 F T F T F T F
+1027 F T F T F T F
+1028 F T F T F T F
+1029 F T F T F T F
+1030 F T F T F T F
+1031 F T F T F T F
+1032 F T F T F T F
+1033 F T F T F T F
+1034 F T F T F T F
+1035 F T F T F T F
+1036 F T F T F T F
+1037 F T F T F T F
+1038 F T F T F T F
+1039 F T F T F T F
+1040 F T F T F T F
+1041 F T F T F T F
+1042 F T F T F T F
+1043 F T F T F T F
+1044 F T F T F T F
+1045 F T F T F T F
+1046 F T F T F T F
+1047 F T F T F T F
+1048 F T F T F T F
+1049 F T F T F T F
+1050 F T F T F T F
+1051 F T F T F T F
+1052 F T F T F T F
+1053 F T F T F T F
+1054 F T F T F T F
+1055 F T F T F T F
+1056 F T F T F T F
+1057 F T F T F T F
+1058 F T F T F T F
+1059 F T F T F T F
+1060 F T F T F T F
+1061 F T F T F T F
+1062 F T F T F T F
+1063 F T F T F T F
+1064 F T F T F T F
+1065 F T F T F T F
+1066 F T F T F T F
+1067 F T F T F T F
+1068 F T F T F T F
+1069 F T F T F T F
+1070 F T F T F T F
+1071 F T F T F T F
+1072 F T F F T T F
+1073 F T F F T T F
+1074 F T F F T T F
+1075 F T F F T T F
+1076 F T F F T T F
+1077 F T F F T T F
+1078 F T F F T T F
+1079 F T F F T T F
+1080 F T F F T T F
+1081 F T F F T T F
+1082 F T F F T T F
+1083 F T F F T T F
+1084 F T F F T T F
+1085 F T F F T T F
+1086 F T F F T T F
+1087 F T F F T T F
+1088 F T F F T T F
+1089 F T F F T T F
+1090 F T F F T T F
+1091 F T F F T T F
+1092 F T F F T T F
+1093 F T F F T T F
+1094 F T F F T T F
+1095 F T F F T T F
+1096 F T F F T T F
+1097 F T F F T T F
+1098 F T F F T T F
+1099 F T F F T T F
+1100 F T F F T T F
+1101 F T F F T T F
+1102 F T F F T T F
+1103 F T F F T T F
+1104 F T F F T T F
+1105 F T F F T T F
+1106 F T F F T T F
+1107 F T F F T T F
+1108 F T F F T T F
+1109 F T F F T T F
+1110 F T F F T T F
+1111 F T F F T T F
+1112 F T F F T T F
+1113 F T F F T T F
+1114 F T F F T T F
+1115 F T F F T T F
+1116 F T F F T T F
+1117 F T F F T T F
+1118 F T F F T T F
+1119 F T F F T T F
+1120 F T F T F T F
+1121 F T F F T T F
+1122 F T F T F T F
+1123 F T F F T T F
+1124 F T F T F T F
+1125 F T F F T T F
+1126 F T F T F T F
+1127 F T F F T T F
+1128 F T F T F T F
+1129 F T F F T T F
+1130 F T F T F T F
+1131 F T F F T T F
+1132 F T F T F T F
+1133 F T F F T T F
+1134 F T F T F T F
+1135 F T F F T T F
+1136 F T F T F T F
+1137 F T F F T T F
+1138 F T F T F T F
+1139 F T F F T T F
+1140 F T F T F T F
+1141 F T F F T T F
+1142 F T F T F T F
+1143 F T F F T T F
+1144 F T F T F T F
+1145 F T F F T T F
+1146 F T F T F T F
+1147 F T F F T T F
+1148 F T F T F T F
+1149 F T F F T T F
+1150 F T F T F T F
+1151 F T F F T T F
+1152 F T F T F T F
+1153 F T F F T T F
+1154 F T F F F F F
+1155 F T F F F F F
+1156 F T F F F F F
+1157 F T F F F F F
+1158 F T F F F F F
+1159 F T F F F F F
+1160 F T F F F F F
+1161 F T F F F F F
+1162 F T F T F T F
+1163 F T F F T T F
+1164 F T F T F T F
+1165 F T F F T T F
+1166 F T F T F T F
+1167 F T F F T T F
+1168 F T F T F T F
+1169 F T F F T T F
+1170 F T F T F T F
+1171 F T F F T T F
+1172 F T F T F T F
+1173 F T F F T T F
+1174 F T F T F T F
+1175 F T F F T T F
+1176 F T F T F T F
+1177 F T F F T T F
+1178 F T F T F T F
+1179 F T F F T T F
+1180 F T F T F T F
+1181 F T F F T T F
+1182 F T F T F T F
+1183 F T F F T T F
+1184 F T F T F T F
+1185 F T F F T T F
+1186 F T F T F T F
+1187 F T F F T T F
+1188 F T F T F T F
+1189 F T F F T T F
+1190 F T F T F T F
+1191 F T F F T T F
+1192 F T F T F T F
+1193 F T F F T T F
+1194 F T F T F T F
+1195 F T F F T T F
+1196 F T F T F T F
+1197 F T F F T T F
+1198 F T F T F T F
+1199 F T F F T T F
+1200 F T F T F T F
+1201 F T F F T T F
+1202 F T F T F T F
+1203 F T F F T T F
+1204 F T F T F T F
+1205 F T F F T T F
+1206 F T F T F T F
+1207 F T F F T T F
+1208 F T F T F T F
+1209 F T F F T T F
+1210 F T F T F T F
+1211 F T F F T T F
+1212 F T F T F T F
+1213 F T F F T T F
+1214 F T F T F T F
+1215 F T F F T T F
+1216 F T F T F T F
+1217 F T F T F T F
+1218 F T F F T T F
+1219 F T F T F T F
+1220 F T F F T T F
+1221 F T F T F T F
+1222 F T F F T T F
+1223 F T F T F T F
+1224 F T F F T T F
+1225 F T F T F T F
+1226 F T F F T T F
+1227 F T F T F T F
+1228 F T F F T T F
+1229 F T F T F T F
+1230 F T F F T T F
+1231 F T F F T T F
+1232 F T F T F T F
+1233 F T F F T T F
+1234 F T F T F T F
+1235 F T F F T T F
+1236 F T F T F T F
+1237 F T F F T T F
+1238 F T F T F T F
+1239 F T F F T T F
+1240 F T F T F T F
+1241 F T F F T T F
+1242 F T F T F T F
+1243 F T F F T T F
+1244 F T F T F T F
+1245 F T F F T T F
+1246 F T F T F T F
+1247 F T F F T T F
+1248 F T F T F T F
+1249 F T F F T T F
+1250 F T F T F T F
+1251 F T F F T T F
+1252 F T F T F T F
+1253 F T F F T T F
+1254 F T F T F T F
+1255 F T F F T T F
+1256 F T F T F T F
+1257 F T F F T T F
+1258 F T F T F T F
+1259 F T F F T T F
+1260 F T F T F T F
+1261 F T F F T T F
+1262 F T F T F T F
+1263 F T F F T T F
+1264 F T F T F T F
+1265 F T F F T T F
+1266 F T F T F T F
+1267 F T F F T T F
+1268 F T F T F T F
+1269 F T F F T T F
+1270 F T F T F T F
+1271 F T F F T T F
+1272 F T F T F T F
+1273 F T F F T T F
+1274 F T F T F T F
+1275 F T F F T T F
+1276 F T F T F T F
+1277 F T F F T T F
+1278 F T F T F T F
+1279 F T F F T T F
+1280 F T F T F T F
+1281 F T F F T T F
+1282 F T F T F T F
+1283 F T F F T T F
+1284 F T F T F T F
+1285 F T F F T T F
+1286 F T F T F T F
+1287 F T F F T T F
+1288 F T F T F T F
+1289 F T F F T T F
+1290 F T F T F T F
+1291 F T F F T T F
+1292 F T F T F T F
+1293 F T F F T T F
+1294 F T F T F T F
+1295 F T F F T T F
+1296 F T F T F T F
+1297 F T F F T T F
+1298 F T F T F T F
+1299 F T F F T T F
+1300 F T F T F T F
+1301 F T F F T T F
+1302 F T F T F T F
+1303 F T F F T T F
+1304 F T F T F T F
+1305 F T F F T T F
+1306 F T F T F T F
+1307 F T F F T T F
+1308 F T F T F T F
+1309 F T F F T T F
+1310 F T F T F T F
+1311 F T F F T T F
+1312 F T F T F T F
+1313 F T F F T T F
+1314 F T F T F T F
+1315 F T F F T T F
+1316 F T F T F T F
+1317 F T F F T T F
+1318 F T F T F T F
+1319 F T F F T T F
+1320 F F F F F F F
+1321 F F F F F F F
+1322 F F F F F F F
+1323 F F F F F F F
+1324 F F F F F F F
+1325 F F F F F F F
+1326 F F F F F F F
+1327 F F F F F F F
+1328 F F F F F F F
+1329 F T F T F T F
+1330 F T F T F T F
+1331 F T F T F T F
+1332 F T F T F T F
+1333 F T F T F T F
+1334 F T F T F T F
+1335 F T F T F T F
+1336 F T F T F T F
+1337 F T F T F T F
+1338 F T F T F T F
+1339 F T F T F T F
+1340 F T F T F T F
+1341 F T F T F T F
+1342 F T F T F T F
+1343 F T F T F T F
+1344 F T F T F T F
+1345 F T F T F T F
+1346 F T F T F T F
+1347 F T F T F T F
+1348 F T F T F T F
+1349 F T F T F T F
+1350 F T F T F T F
+1351 F T F T F T F
+1352 F T F T F T F
+1353 F T F T F T F
+1354 F T F T F T F
+1355 F T F T F T F
+1356 F T F T F T F
+1357 F T F T F T F
+1358 F T F T F T F
+1359 F T F T F T F
+1360 F T F T F T F
+1361 F T F T F T F
+1362 F T F T F T F
+1363 F T F T F T F
+1364 F T F T F T F
+1365 F T F T F T F
+1366 F T F T F T F
+1367 F F F F F F F
+1368 F F F F F F F
+1369 F T F F F T F
+1370 F T F F F F F
+1371 F T F F F F F
+1372 F T F F F F F
+1373 F T F F F F F
+1374 F T F F F F F
+1375 F T F F F F F
+1376 F F F F F F F
+1377 F T F F T T F
+1378 F T F F T T F
+1379 F T F F T T F
+1380 F T F F T T F
+1381 F T F F T T F
+1382 F T F F T T F
+1383 F T F F T T F
+1384 F T F F T T F
+1385 F T F F T T F
+1386 F T F F T T F
+1387 F T F F T T F
+1388 F T F F T T F
+1389 F T F F T T F
+1390 F T F F T T F
+1391 F T F F T T F
+1392 F T F F T T F
+1393 F T F F T T F
+1394 F T F F T T F
+1395 F T F F T T F
+1396 F T F F T T F
+1397 F T F F T T F
+1398 F T F F T T F
+1399 F T F F T T F
+1400 F T F F T T F
+1401 F T F F T T F
+1402 F T F F T T F
+1403 F T F F T T F
+1404 F T F F T T F
+1405 F T F F T T F
+1406 F T F F T T F
+1407 F T F F T T F
+1408 F T F F T T F
+1409 F T F F T T F
+1410 F T F F T T F
+1411 F T F F T T F
+1412 F T F F T T F
+1413 F T F F T T F
+1414 F T F F T T F
+1415 F T F F T T F
+1416 F F F F F F F
+1417 F T F F F F F
+1418 F T F F F F F
+1419 F F F F F F F
+1420 F F F F F F F
+1421 F F F F F F F
+1422 F F F F F F F
+1423 F F F F F F F
+1424 F F F F F F F
+1425 F T F F F F F
+1426 F T F F F F F
+1427 F T F F F F F
+1428 F T F F F F F
+1429 F T F F F F F
+1430 F T F F F F F
+1431 F T F F F F F
+1432 F T F F F F F
+1433 F T F F F F F
+1434 F T F F F F F
+1435 F T F F F F F
+1436 F T F F F F F
+1437 F T F F F F F
+1438 F T F F F F F
+1439 F T F F F F F
+1440 F T F F F F F
+1441 F T F F F F F
+1442 F T F F F F F
+1443 F T F F F F F
+1444 F T F F F F F
+1445 F T F F F F F
+1446 F T F F F F F
+1447 F T F F F F F
+1448 F T F F F F F
+1449 F T F F F F F
+1450 F T F F F F F
+1451 F T F F F F F
+1452 F T F F F F F
+1453 F T F F F F F
+1454 F T F F F F F
+1455 F T F F F F F
+1456 F T F F F F F
+1457 F T F F F F F
+1458 F T F F F F F
+1459 F T F F F F F
+1460 F T F F F F F
+1461 F T F F F F F
+1462 F T F F F F F
+1463 F T F F F F F
+1464 F T F F F F F
+1465 F T F F F F F
+1466 F T F F F F F
+1467 F T F F F F F
+1468 F T F F F F F
+1469 F T F F F F F
+1470 F T F F F F F
+1471 F T F F F F F
+1472 F T F F F F F
+1473 F T F F F F F
+1474 F T F F F F F
+1475 F T F F F F F
+1476 F T F F F F F
+1477 F T F F F F F
+1478 F T F F F F F
+1479 F T F F F F F
+1480 F F F F F F F
+1481 F F F F F F F
+1482 F F F F F F F
+1483 F F F F F F F
+1484 F F F F F F F
+1485 F F F F F F F
+1486 F F F F F F F
+1487 F F F F F F F
+1488 F T F F F T F
+1489 F T F F F T F
+1490 F T F F F T F
+1491 F T F F F T F
+1492 F T F F F T F
+1493 F T F F F T F
+1494 F T F F F T F
+1495 F T F F F T F
+1496 F T F F F T F
+1497 F T F F F T F
+1498 F T F F F T F
+1499 F T F F F T F
+1500 F T F F F T F
+1501 F T F F F T F
+1502 F T F F F T F
+1503 F T F F F T F
+1504 F T F F F T F
+1505 F T F F F T F
+1506 F T F F F T F
+1507 F T F F F T F
+1508 F T F F F T F
+1509 F T F F F T F
+1510 F T F F F T F
+1511 F T F F F T F
+1512 F T F F F T F
+1513 F T F F F T F
+1514 F T F F F T F
+1515 F F F F F F F
+1516 F F F F F F F
+1517 F F F F F F F
+1518 F F F F F F F
+1519 F F F F F F F
+1520 F T F F F T F
+1521 F T F F F T F
+1522 F T F F F T F
+1523 F T F F F F F
+1524 F T F F F F F
+1525 F F F F F F F
+1526 F F F F F F F
+1527 F F F F F F F
+1528 F F F F F F F
+1529 F F F F F F F
+1530 F F F F F F F
+1531 F F F F F F F
+1532 F F F F F F F
+1533 F F F F F F F
+1534 F F F F F F F
+1535 F F F F F F F
+1536 F F F F F F F
+1537 F F F F F F F
+1538 F F F F F F F
+1539 F F F F F F F
+1540 F F F F F F F
+1541 F F F F F F F
+1542 F T F F F F F
+1543 F T F F F F F
+1544 F T F F F F F
+1545 F T F F F F F
+1546 F T F F F F F
+1547 F T F F F F F
+1548 F T F F F F F
+1549 F T F F F F F
+1550 F T F F F F F
+1551 F T F F F F F
+1552 F T F F F F F
+1553 F T F F F F F
+1554 F T F F F F F
+1555 F T F F F F F
+1556 F T F F F F F
+1557 F T F F F F F
+1558 F T F F F F F
+1559 F T F F F F F
+1560 F T F F F F F
+1561 F T F F F F F
+1562 F T F F F F F
+1563 F T F F F F F
+1564 F F F F F F F
+1565 F F F F F F F
+1566 F T F F F F F
+1567 F T F F F F F
+1568 F T F F F T F
+1569 F T F F F T F
+1570 F T F F F T F
+1571 F T F F F T F
+1572 F T F F F T F
+1573 F T F F F T F
+1574 F T F F F T F
+1575 F T F F F T F
+1576 F T F F F T F
+1577 F T F F F T F
+1578 F T F F F T F
+1579 F T F F F T F
+1580 F T F F F T F
+1581 F T F F F T F
+1582 F T F F F T F
+1583 F T F F F T F
+1584 F T F F F T F
+1585 F T F F F T F
+1586 F T F F F T F
+1587 F T F F F T F
+1588 F T F F F T F
+1589 F T F F F T F
+1590 F T F F F T F
+1591 F T F F F T F
+1592 F T F F F T F
+1593 F T F F F T F
+1594 F T F F F T F
+1595 F T F F F T F
+1596 F T F F F T F
+1597 F T F F F T F
+1598 F T F F F T F
+1599 F T F F F T F
+1600 F T F F F T F
+1601 F T F F F T F
+1602 F T F F F T F
+1603 F T F F F T F
+1604 F T F F F T F
+1605 F T F F F T F
+1606 F T F F F T F
+1607 F T F F F T F
+1608 F T F F F T F
+1609 F T F F F T F
+1610 F T F F F T F
+1611 F T F F F F F
+1612 F T F F F F F
+1613 F T F F F F F
+1614 F T F F F F F
+1615 F T F F F F F
+1616 F T F F F F F
+1617 F T F F F F F
+1618 F T F F F F F
+1619 F T F F F F F
+1620 F T F F F F F
+1621 F T F F F F F
+1622 F T F F F F F
+1623 F T F F F F F
+1624 F T F F F F F
+1625 F T F F F F F
+1626 F T F F F F F
+1627 F T F F F F F
+1628 F T F F F F F
+1629 F T F F F F F
+1630 F T F F F F F
+1631 F T F F F F F
+1632 F T F F F F F
+1633 F T F F F F F
+1634 F T F F F F F
+1635 F T F F F F F
+1636 F T F F F F F
+1637 F T F F F F F
+1638 F T F F F F F
+1639 F T F F F F F
+1640 F T F F F F F
+1641 F T F F F F F
+1642 F T F F F F F
+1643 F T F F F F F
+1644 F T F F F F F
+1645 F T F F F F F
+1646 F T F F F T F
+1647 F T F F F T F
+1648 F T F F F F F
+1649 F T F F F T F
+1650 F T F F F T F
+1651 F T F F F T F
+1652 F T F F F T F
+1653 F T F F F T F
+1654 F T F F F T F
+1655 F T F F F T F
+1656 F T F F F T F
+1657 F T F F F T F
+1658 F T F F F T F
+1659 F T F F F T F
+1660 F T F F F T F
+1661 F T F F F T F
+1662 F T F F F T F
+1663 F T F F F T F
+1664 F T F F F T F
+1665 F T F F F T F
+1666 F T F F F T F
+1667 F T F F F T F
+1668 F T F F F T F
+1669 F T F F F T F
+1670 F T F F F T F
+1671 F T F F F T F
+1672 F T F F F T F
+1673 F T F F F T F
+1674 F T F F F T F
+1675 F T F F F T F
+1676 F T F F F T F
+1677 F T F F F T F
+1678 F T F F F T F
+1679 F T F F F T F
+1680 F T F F F T F
+1681 F T F F F T F
+1682 F T F F F T F
+1683 F T F F F T F
+1684 F T F F F T F
+1685 F T F F F T F
+1686 F T F F F T F
+1687 F T F F F T F
+1688 F T F F F T F
+1689 F T F F F T F
+1690 F T F F F T F
+1691 F T F F F T F
+1692 F T F F F T F
+1693 F T F F F T F
+1694 F T F F F T F
+1695 F T F F F T F
+1696 F T F F F T F
+1697 F T F F F T F
+1698 F T F F F T F
+1699 F T F F F T F
+1700 F T F F F T F
+1701 F T F F F T F
+1702 F T F F F T F
+1703 F T F F F T F
+1704 F T F F F T F
+1705 F T F F F T F
+1706 F T F F F T F
+1707 F T F F F T F
+1708 F T F F F T F
+1709 F T F F F T F
+1710 F T F F F T F
+1711 F T F F F T F
+1712 F T F F F T F
+1713 F T F F F T F
+1714 F T F F F T F
+1715 F T F F F T F
+1716 F T F F F T F
+1717 F T F F F T F
+1718 F T F F F T F
+1719 F T F F F T F
+1720 F T F F F T F
+1721 F T F F F T F
+1722 F T F F F T F
+1723 F T F F F T F
+1724 F T F F F T F
+1725 F T F F F T F
+1726 F T F F F T F
+1727 F T F F F T F
+1728 F T F F F T F
+1729 F T F F F T F
+1730 F T F F F T F
+1731 F T F F F T F
+1732 F T F F F T F
+1733 F T F F F T F
+1734 F T F F F T F
+1735 F T F F F T F
+1736 F T F F F T F
+1737 F T F F F T F
+1738 F T F F F T F
+1739 F T F F F T F
+1740 F T F F F T F
+1741 F T F F F T F
+1742 F T F F F T F
+1743 F T F F F T F
+1744 F T F F F T F
+1745 F T F F F T F
+1746 F T F F F T F
+1747 F T F F F T F
+1748 F T F F F F F
+1749 F T F F F T F
+1750 F T F F F F F
+1751 F T F F F F F
+1752 F T F F F F F
+1753 F T F F F F F
+1754 F T F F F F F
+1755 F T F F F F F
+1756 F T F F F F F
+1757 F F F F F F F
+1758 F T F F F F F
+1759 F T F F F F F
+1760 F T F F F F F
+1761 F T F F F F F
+1762 F T F F F F F
+1763 F T F F F F F
+1764 F T F F F F F
+1765 F T F F F T F
+1766 F T F F F T F
+1767 F T F F F F F
+1768 F T F F F F F
+1769 F T F F F F F
+1770 F T F F F F F
+1771 F T F F F F F
+1772 F T F F F F F
+1773 F T F F F F F
+1774 F T F F F T F
+1775 F T F F F T F
+1776 F T F F F F F
+1777 F T F F F F F
+1778 F T F F F F F
+1779 F T F F F F F
+1780 F T F F F F F
+1781 F T F F F F F
+1782 F T F F F F F
+1783 F T F F F F F
+1784 F T F F F F F
+1785 F T F F F F F
+1786 F T F F F T F
+1787 F T F F F T F
+1788 F T F F F T F
+1789 F T F F F F F
+1790 F T F F F F F
+1791 F T F F F T F
+1792 F T F F F F F
+1793 F T F F F F F
+1794 F T F F F F F
+1795 F T F F F F F
+1796 F T F F F F F
+1797 F T F F F F F
+1798 F T F F F F F
+1799 F T F F F F F
+1800 F T F F F F F
+1801 F T F F F F F
+1802 F T F F F F F
+1803 F T F F F F F
+1804 F T F F F F F
+1805 F T F F F F F
+1806 F F F F F F F
+1807 F F F F F F F
+1808 F T F F F T F
+1809 F T F F F F F
+1810 F T F F F T F
+1811 F T F F F T F
+1812 F T F F F T F
+1813 F T F F F T F
+1814 F T F F F T F
+1815 F T F F F T F
+1816 F T F F F T F
+1817 F T F F F T F
+1818 F T F F F T F
+1819 F T F F F T F
+1820 F T F F F T F
+1821 F T F F F T F
+1822 F T F F F T F
+1823 F T F F F T F
+1824 F T F F F T F
+1825 F T F F F T F
+1826 F T F F F T F
+1827 F T F F F T F
+1828 F T F F F T F
+1829 F T F F F T F
+1830 F T F F F T F
+1831 F T F F F T F
+1832 F T F F F T F
+1833 F T F F F T F
+1834 F T F F F T F
+1835 F T F F F T F
+1836 F T F F F T F
+1837 F T F F F T F
+1838 F T F F F T F
+1839 F T F F F T F
+1840 F T F F F F F
+1841 F T F F F F F
+1842 F T F F F F F
+1843 F T F F F F F
+1844 F T F F F F F
+1845 F T F F F F F
+1846 F T F F F F F
+1847 F T F F F F F
+1848 F T F F F F F
+1849 F T F F F F F
+1850 F T F F F F F
+1851 F T F F F F F
+1852 F T F F F F F
+1853 F T F F F F F
+1854 F T F F F F F
+1855 F T F F F F F
+1856 F T F F F F F
+1857 F T F F F F F
+1858 F T F F F F F
+1859 F T F F F F F
+1860 F T F F F F F
+1861 F T F F F F F
+1862 F T F F F F F
+1863 F T F F F F F
+1864 F T F F F F F
+1865 F T F F F F F
+1866 F T F F F F F
+1867 F F F F F F F
+1868 F F F F F F F
+1869 F T F F F T F
+1870 F T F F F T F
+1871 F T F F F T F
+1872 F T F F F T F
+1873 F T F F F T F
+1874 F T F F F T F
+1875 F T F F F T F
+1876 F T F F F T F
+1877 F T F F F T F
+1878 F T F F F T F
+1879 F T F F F T F
+1880 F T F F F T F
+1881 F T F F F T F
+1882 F T F F F T F
+1883 F T F F F T F
+1884 F T F F F T F
+1885 F T F F F T F
+1886 F T F F F T F
+1887 F T F F F T F
+1888 F T F F F T F
+1889 F T F F F T F
+1890 F T F F F T F
+1891 F T F F F T F
+1892 F T F F F T F
+1893 F T F F F T F
+1894 F T F F F T F
+1895 F T F F F T F
+1896 F T F F F T F
+1897 F T F F F T F
+1898 F T F F F T F
+1899 F T F F F T F
+1900 F T F F F T F
+1901 F T F F F T F
+1902 F T F F F T F
+1903 F T F F F T F
+1904 F T F F F T F
+1905 F T F F F T F
+1906 F T F F F T F
+1907 F T F F F T F
+1908 F T F F F T F
+1909 F T F F F T F
+1910 F T F F F T F
+1911 F T F F F T F
+1912 F T F F F T F
+1913 F T F F F T F
+1914 F T F F F T F
+1915 F T F F F T F
+1916 F T F F F T F
+1917 F T F F F T F
+1918 F T F F F T F
+1919 F T F F F T F
+1920 F T F F F T F
+1921 F T F F F T F
+1922 F T F F F T F
+1923 F T F F F T F
+1924 F T F F F T F
+1925 F T F F F T F
+1926 F T F F F T F
+1927 F T F F F T F
+1928 F T F F F T F
+1929 F T F F F T F
+1930 F T F F F T F
+1931 F T F F F T F
+1932 F T F F F T F
+1933 F T F F F T F
+1934 F T F F F T F
+1935 F T F F F T F
+1936 F T F F F T F
+1937 F T F F F T F
+1938 F T F F F T F
+1939 F T F F F T F
+1940 F T F F F T F
+1941 F T F F F T F
+1942 F T F F F T F
+1943 F T F F F T F
+1944 F T F F F T F
+1945 F T F F F T F
+1946 F T F F F T F
+1947 F T F F F T F
+1948 F T F F F T F
+1949 F T F F F T F
+1950 F T F F F T F
+1951 F T F F F T F
+1952 F T F F F T F
+1953 F T F F F T F
+1954 F T F F F T F
+1955 F T F F F T F
+1956 F T F F F T F
+1957 F T F F F T F
+1958 F T F F F F F
+1959 F T F F F F F
+1960 F T F F F F F
+1961 F T F F F F F
+1962 F T F F F F F
+1963 F T F F F F F
+1964 F T F F F F F
+1965 F T F F F F F
+1966 F T F F F F F
+1967 F T F F F F F
+1968 F T F F F F F
+1969 F T F F F T F
+1970 F F F F F F F
+1971 F F F F F F F
+1972 F F F F F F F
+1973 F F F F F F F
+1974 F F F F F F F
+1975 F F F F F F F
+1976 F F F F F F F
+1977 F F F F F F F
+1978 F F F F F F F
+1979 F F F F F F F
+1980 F F F F F F F
+1981 F F F F F F F
+1982 F F F F F F F
+1983 F F F F F F F
+1984 F T F F F F F
+1985 F T F F F F F
+1986 F T F F F F F
+1987 F T F F F F F
+1988 F T F F F F F
+1989 F T F F F F F
+1990 F T F F F F F
+1991 F T F F F F F
+1992 F T F F F F F
+1993 F T F F F F F
+1994 F T F F F T F
+1995 F T F F F T F
+1996 F T F F F T F
+1997 F T F F F T F
+1998 F T F F F T F
+1999 F T F F F T F
+2000 F T F F F T F
+2001 F T F F F T F
+2002 F T F F F T F
+2003 F T F F F T F
+2004 F T F F F T F
+2005 F T F F F T F
+2006 F T F F F T F
+2007 F T F F F T F
+2008 F T F F F T F
+2009 F T F F F T F
+2010 F T F F F T F
+2011 F T F F F T F
+2012 F T F F F T F
+2013 F T F F F T F
+2014 F T F F F T F
+2015 F T F F F T F
+2016 F T F F F T F
+2017 F T F F F T F
+2018 F T F F F T F
+2019 F T F F F T F
+2020 F T F F F T F
+2021 F T F F F T F
+2022 F T F F F T F
+2023 F T F F F T F
+2024 F T F F F T F
+2025 F T F F F T F
+2026 F T F F F T F
+2027 F T F F F F F
+2028 F T F F F F F
+2029 F T F F F F F
+2030 F T F F F F F
+2031 F T F F F F F
+2032 F T F F F F F
+2033 F T F F F F F
+2034 F T F F F F F
+2035 F T F F F F F
+2036 F T F F F T F
+2037 F T F F F T F
+2038 F T F F F F F
+2039 F T F F F F F
+2040 F T F F F F F
+2041 F T F F F F F
+2042 F T F F F T F
+2043 F F F F F F F
+2044 F F F F F F F
+2045 F F F F F F F
+2046 F F F F F F F
+2047 F F F F F F F
+2048 F T F F F T F
+2049 F T F F F T F
+2050 F T F F F T F
+2051 F T F F F T F
+2052 F T F F F T F
+2053 F T F F F T F
+2054 F T F F F T F
+2055 F T F F F T F
+2056 F T F F F T F
+2057 F T F F F T F
+2058 F T F F F T F
+2059 F T F F F T F
+2060 F T F F F T F
+2061 F T F F F T F
+2062 F T F F F T F
+2063 F T F F F T F
+2064 F T F F F T F
+2065 F T F F F T F
+2066 F T F F F T F
+2067 F T F F F T F
+2068 F T F F F T F
+2069 F T F F F T F
+2070 F T F F F F F
+2071 F T F F F F F
+2072 F T F F F F F
+2073 F T F F F F F
+2074 F T F F F T F
+2075 F T F F F F F
+2076 F T F F F F F
+2077 F T F F F F F
+2078 F T F F F F F
+2079 F T F F F F F
+2080 F T F F F F F
+2081 F T F F F F F
+2082 F T F F F F F
+2083 F T F F F F F
+2084 F T F F F T F
+2085 F T F F F F F
+2086 F T F F F F F
+2087 F T F F F F F
+2088 F T F F F T F
+2089 F T F F F F F
+2090 F T F F F F F
+2091 F T F F F F F
+2092 F T F F F F F
+2093 F T F F F F F
+2094 F F F F F F F
+2095 F F F F F F F
+2096 F T F F F F F
+2097 F T F F F F F
+2098 F T F F F F F
+2099 F T F F F F F
+2100 F T F F F F F
+2101 F T F F F F F
+2102 F T F F F F F
+2103 F T F F F F F
+2104 F T F F F F F
+2105 F T F F F F F
+2106 F T F F F F F
+2107 F T F F F F F
+2108 F T F F F F F
+2109 F T F F F F F
+2110 F T F F F F F
+2111 F F F F F F F
+2112 F T F F F T F
+2113 F T F F F T F
+2114 F T F F F T F
+2115 F T F F F T F
+2116 F T F F F T F
+2117 F T F F F T F
+2118 F T F F F T F
+2119 F T F F F T F
+2120 F T F F F T F
+2121 F T F F F T F
+2122 F T F F F T F
+2123 F T F F F T F
+2124 F T F F F T F
+2125 F T F F F T F
+2126 F T F F F T F
+2127 F T F F F T F
+2128 F T F F F T F
+2129 F T F F F T F
+2130 F T F F F T F
+2131 F T F F F T F
+2132 F T F F F T F
+2133 F T F F F T F
+2134 F T F F F T F
+2135 F T F F F T F
+2136 F T F F F T F
+2137 F T F F F F F
+2138 F T F F F F F
+2139 F T F F F F F
+2140 F F F F F F F
+2141 F F F F F F F
+2142 F T F F F F F
+2143 F F F F F F F
+2144 F F F F F F F
+2145 F F F F F F F
+2146 F F F F F F F
+2147 F F F F F F F
+2148 F F F F F F F
+2149 F F F F F F F
+2150 F F F F F F F
+2151 F F F F F F F
+2152 F F F F F F F
+2153 F F F F F F F
+2154 F F F F F F F
+2155 F F F F F F F
+2156 F F F F F F F
+2157 F F F F F F F
+2158 F F F F F F F
+2159 F F F F F F F
+2160 F F F F F F F
+2161 F F F F F F F
+2162 F F F F F F F
+2163 F F F F F F F
+2164 F F F F F F F
+2165 F F F F F F F
+2166 F F F F F F F
+2167 F F F F F F F
+2168 F F F F F F F
+2169 F F F F F F F
+2170 F F F F F F F
+2171 F F F F F F F
+2172 F F F F F F F
+2173 F F F F F F F
+2174 F F F F F F F
+2175 F F F F F F F
+2176 F F F F F F F
+2177 F F F F F F F
+2178 F F F F F F F
+2179 F F F F F F F
+2180 F F F F F F F
+2181 F F F F F F F
+2182 F F F F F F F
+2183 F F F F F F F
+2184 F F F F F F F
+2185 F F F F F F F
+2186 F F F F F F F
+2187 F F F F F F F
+2188 F F F F F F F
+2189 F F F F F F F
+2190 F F F F F F F
+2191 F F F F F F F
+2192 F F F F F F F
+2193 F F F F F F F
+2194 F F F F F F F
+2195 F F F F F F F
+2196 F F F F F F F
+2197 F F F F F F F
+2198 F F F F F F F
+2199 F F F F F F F
+2200 F F F F F F F
+2201 F F F F F F F
+2202 F F F F F F F
+2203 F F F F F F F
+2204 F F F F F F F
+2205 F F F F F F F
+2206 F F F F F F F
+2207 F F F F F F F
+2208 F F F F F F F
+2209 F F F F F F F
+2210 F F F F F F F
+2211 F F F F F F F
+2212 F F F F F F F
+2213 F F F F F F F
+2214 F F F F F F F
+2215 F F F F F F F
+2216 F F F F F F F
+2217 F F F F F F F
+2218 F F F F F F F
+2219 F F F F F F F
+2220 F F F F F F F
+2221 F F F F F F F
+2222 F F F F F F F
+2223 F F F F F F F
+2224 F F F F F F F
+2225 F F F F F F F
+2226 F F F F F F F
+2227 F F F F F F F
+2228 F F F F F F F
+2229 F F F F F F F
+2230 F F F F F F F
+2231 F F F F F F F
+2232 F F F F F F F
+2233 F F F F F F F
+2234 F F F F F F F
+2235 F F F F F F F
+2236 F F F F F F F
+2237 F F F F F F F
+2238 F F F F F F F
+2239 F F F F F F F
+2240 F F F F F F F
+2241 F F F F F F F
+2242 F F F F F F F
+2243 F F F F F F F
+2244 F F F F F F F
+2245 F F F F F F F
+2246 F F F F F F F
+2247 F F F F F F F
+2248 F F F F F F F
+2249 F F F F F F F
+2250 F F F F F F F
+2251 F F F F F F F
+2252 F F F F F F F
+2253 F F F F F F F
+2254 F F F F F F F
+2255 F F F F F F F
+2256 F F F F F F F
+2257 F F F F F F F
+2258 F F F F F F F
+2259 F F F F F F F
+2260 F F F F F F F
+2261 F F F F F F F
+2262 F F F F F F F
+2263 F F F F F F F
+2264 F F F F F F F
+2265 F F F F F F F
+2266 F F F F F F F
+2267 F F F F F F F
+2268 F F F F F F F
+2269 F F F F F F F
+2270 F F F F F F F
+2271 F F F F F F F
+2272 F F F F F F F
+2273 F F F F F F F
+2274 F F F F F F F
+2275 F F F F F F F
+2276 F F F F F F F
+2277 F F F F F F F
+2278 F F F F F F F
+2279 F F F F F F F
+2280 F F F F F F F
+2281 F F F F F F F
+2282 F F F F F F F
+2283 F F F F F F F
+2284 F F F F F F F
+2285 F F F F F F F
+2286 F F F F F F F
+2287 F F F F F F F
+2288 F F F F F F F
+2289 F F F F F F F
+2290 F F F F F F F
+2291 F F F F F F F
+2292 F F F F F F F
+2293 F F F F F F F
+2294 F F F F F F F
+2295 F F F F F F F
+2296 F F F F F F F
+2297 F F F F F F F
+2298 F F F F F F F
+2299 F F F F F F F
+2300 F F F F F F F
+2301 F F F F F F F
+2302 F F F F F F F
+2303 F F F F F F F
+2304 F T F F F F F
+2305 F T F F F F F
+2306 F T F F F F F
+2307 F T F F F F F
+2308 F T F F F T F
+2309 F T F F F T F
+2310 F T F F F T F
+2311 F T F F F T F
+2312 F T F F F T F
+2313 F T F F F T F
+2314 F T F F F T F
+2315 F T F F F T F
+2316 F T F F F T F
+2317 F T F F F T F
+2318 F T F F F T F
+2319 F T F F F T F
+2320 F T F F F T F
+2321 F T F F F T F
+2322 F T F F F T F
+2323 F T F F F T F
+2324 F T F F F T F
+2325 F T F F F T F
+2326 F T F F F T F
+2327 F T F F F T F
+2328 F T F F F T F
+2329 F T F F F T F
+2330 F T F F F T F
+2331 F T F F F T F
+2332 F T F F F T F
+2333 F T F F F T F
+2334 F T F F F T F
+2335 F T F F F T F
+2336 F T F F F T F
+2337 F T F F F T F
+2338 F T F F F T F
+2339 F T F F F T F
+2340 F T F F F T F
+2341 F T F F F T F
+2342 F T F F F T F
+2343 F T F F F T F
+2344 F T F F F T F
+2345 F T F F F T F
+2346 F T F F F T F
+2347 F T F F F T F
+2348 F T F F F T F
+2349 F T F F F T F
+2350 F T F F F T F
+2351 F T F F F T F
+2352 F T F F F T F
+2353 F T F F F T F
+2354 F T F F F T F
+2355 F T F F F T F
+2356 F T F F F T F
+2357 F T F F F T F
+2358 F T F F F T F
+2359 F T F F F T F
+2360 F T F F F T F
+2361 F T F F F T F
+2362 F T F F F F F
+2363 F T F F F F F
+2364 F T F F F F F
+2365 F T F F F T F
+2366 F T F F F F F
+2367 F T F F F F F
+2368 F T F F F F F
+2369 F T F F F F F
+2370 F T F F F F F
+2371 F T F F F F F
+2372 F T F F F F F
+2373 F T F F F F F
+2374 F T F F F F F
+2375 F T F F F F F
+2376 F T F F F F F
+2377 F T F F F F F
+2378 F T F F F F F
+2379 F T F F F F F
+2380 F T F F F F F
+2381 F T F F F F F
+2382 F T F F F F F
+2383 F T F F F F F
+2384 F T F F F T F
+2385 F T F F F F F
+2386 F T F F F F F
+2387 F T F F F F F
+2388 F T F F F F F
+2389 F T F F F F F
+2390 F T F F F F F
+2391 F T F F F F F
+2392 F T F F F T F
+2393 F T F F F T F
+2394 F T F F F T F
+2395 F T F F F T F
+2396 F T F F F T F
+2397 F T F F F T F
+2398 F T F F F T F
+2399 F T F F F T F
+2400 F T F F F T F
+2401 F T F F F T F
+2402 F T F F F F F
+2403 F T F F F F F
+2404 F T F F F F F
+2405 F T F F F F F
+2406 F T F F F F F
+2407 F T F F F F F
+2408 F T F F F F F
+2409 F T F F F F F
+2410 F T F F F F F
+2411 F T F F F F F
+2412 F T F F F F F
+2413 F T F F F F F
+2414 F T F F F F F
+2415 F T F F F F F
+2416 F T F F F F F
+2417 F T F F F T F
+2418 F T F F F T F
+2419 F T F F F T F
+2420 F T F F F T F
+2421 F T F F F T F
+2422 F T F F F T F
+2423 F T F F F T F
+2424 F F F F F F F
+2425 F T F F F T F
+2426 F T F F F T F
+2427 F T F F F T F
+2428 F T F F F T F
+2429 F T F F F T F
+2430 F T F F F T F
+2431 F T F F F T F
+2432 F F F F F F F
+2433 F T F F F F F
+2434 F T F F F F F
+2435 F T F F F F F
+2436 F F F F F F F
+2437 F T F F F T F
+2438 F T F F F T F
+2439 F T F F F T F
+2440 F T F F F T F
+2441 F T F F F T F
+2442 F T F F F T F
+2443 F T F F F T F
+2444 F T F F F T F
+2445 F F F F F F F
+2446 F F F F F F F
+2447 F T F F F T F
+2448 F T F F F T F
+2449 F F F F F F F
+2450 F F F F F F F
+2451 F T F F F T F
+2452 F T F F F T F
+2453 F T F F F T F
+2454 F T F F F T F
+2455 F T F F F T F
+2456 F T F F F T F
+2457 F T F F F T F
+2458 F T F F F T F
+2459 F T F F F T F
+2460 F T F F F T F
+2461 F T F F F T F
+2462 F T F F F T F
+2463 F T F F F T F
+2464 F T F F F T F
+2465 F T F F F T F
+2466 F T F F F T F
+2467 F T F F F T F
+2468 F T F F F T F
+2469 F T F F F T F
+2470 F T F F F T F
+2471 F T F F F T F
+2472 F T F F F T F
+2473 F F F F F F F
+2474 F T F F F T F
+2475 F T F F F T F
+2476 F T F F F T F
+2477 F T F F F T F
+2478 F T F F F T F
+2479 F T F F F T F
+2480 F T F F F T F
+2481 F F F F F F F
+2482 F T F F F T F
+2483 F F F F F F F
+2484 F F F F F F F
+2485 F F F F F F F
+2486 F T F F F T F
+2487 F T F F F T F
+2488 F T F F F T F
+2489 F T F F F T F
+2490 F F F F F F F
+2491 F F F F F F F
+2492 F T F F F F F
+2493 F T F F F T F
+2494 F T F F F F F
+2495 F T F F F F F
+2496 F T F F F F F
+2497 F T F F F F F
+2498 F T F F F F F
+2499 F T F F F F F
+2500 F T F F F F F
+2501 F F F F F F F
+2502 F F F F F F F
+2503 F T F F F F F
+2504 F T F F F F F
+2505 F F F F F F F
+2506 F F F F F F F
+2507 F T F F F F F
+2508 F T F F F F F
+2509 F T F F F F F
+2510 F T F F F T F
+2511 F F F F F F F
+2512 F F F F F F F
+2513 F F F F F F F
+2514 F F F F F F F
+2515 F F F F F F F
+2516 F F F F F F F
+2517 F F F F F F F
+2518 F F F F F F F
+2519 F T F F F F F
+2520 F F F F F F F
+2521 F F F F F F F
+2522 F F F F F F F
+2523 F F F F F F F
+2524 F T F F F T F
+2525 F T F F F T F
+2526 F F F F F F F
+2527 F T F F F T F
+2528 F T F F F T F
+2529 F T F F F T F
+2530 F T F F F F F
+2531 F T F F F F F
+2532 F F F F F F F
+2533 F F F F F F F
+2534 F T F F F F F
+2535 F T F F F F F
+2536 F T F F F F F
+2537 F T F F F F F
+2538 F T F F F F F
+2539 F T F F F F F
+2540 F T F F F F F
+2541 F T F F F F F
+2542 F T F F F F F
+2543 F T F F F F F
+2544 F T F F F T F
+2545 F T F F F T F
+2546 F T F F F F F
+2547 F T F F F F F
+2548 F T F F F F F
+2549 F T F F F F F
+2550 F T F F F F F
+2551 F T F F F F F
+2552 F T F F F F F
+2553 F T F F F F F
+2554 F T F F F F F
+2555 F T F F F F F
+2556 F F F F F F F
+2557 F F F F F F F
+2558 F F F F F F F
+2559 F F F F F F F
+2560 F F F F F F F
+2561 F T F F F F F
+2562 F T F F F F F
+2563 F T F F F F F
+2564 F F F F F F F
+2565 F T F F F T F
+2566 F T F F F T F
+2567 F T F F F T F
+2568 F T F F F T F
+2569 F T F F F T F
+2570 F T F F F T F
+2571 F F F F F F F
+2572 F F F F F F F
+2573 F F F F F F F
+2574 F F F F F F F
+2575 F T F F F T F
+2576 F T F F F T F
+2577 F F F F F F F
+2578 F F F F F F F
+2579 F T F F F T F
+2580 F T F F F T F
+2581 F T F F F T F
+2582 F T F F F T F
+2583 F T F F F T F
+2584 F T F F F T F
+2585 F T F F F T F
+2586 F T F F F T F
+2587 F T F F F T F
+2588 F T F F F T F
+2589 F T F F F T F
+2590 F T F F F T F
+2591 F T F F F T F
+2592 F T F F F T F
+2593 F T F F F T F
+2594 F T F F F T F
+2595 F T F F F T F
+2596 F T F F F T F
+2597 F T F F F T F
+2598 F T F F F T F
+2599 F T F F F T F
+2600 F T F F F T F
+2601 F F F F F F F
+2602 F T F F F T F
+2603 F T F F F T F
+2604 F T F F F T F
+2605 F T F F F T F
+2606 F T F F F T F
+2607 F T F F F T F
+2608 F T F F F T F
+2609 F F F F F F F
+2610 F T F F F T F
+2611 F T F F F T F
+2612 F F F F F F F
+2613 F T F F F T F
+2614 F T F F F T F
+2615 F F F F F F F
+2616 F T F F F T F
+2617 F T F F F T F
+2618 F F F F F F F
+2619 F F F F F F F
+2620 F T F F F F F
+2621 F F F F F F F
+2622 F T F F F F F
+2623 F T F F F F F
+2624 F T F F F F F
+2625 F T F F F F F
+2626 F T F F F F F
+2627 F F F F F F F
+2628 F F F F F F F
+2629 F F F F F F F
+2630 F F F F F F F
+2631 F T F F F F F
+2632 F T F F F F F
+2633 F F F F F F F
+2634 F F F F F F F
+2635 F T F F F F F
+2636 F T F F F F F
+2637 F T F F F F F
+2638 F F F F F F F
+2639 F F F F F F F
+2640 F F F F F F F
+2641 F T F F F F F
+2642 F F F F F F F
+2643 F F F F F F F
+2644 F F F F F F F
+2645 F F F F F F F
+2646 F F F F F F F
+2647 F F F F F F F
+2648 F F F F F F F
+2649 F T F F F T F
+2650 F T F F F T F
+2651 F T F F F T F
+2652 F T F F F T F
+2653 F F F F F F F
+2654 F T F F F T F
+2655 F F F F F F F
+2656 F F F F F F F
+2657 F F F F F F F
+2658 F F F F F F F
+2659 F F F F F F F
+2660 F F F F F F F
+2661 F F F F F F F
+2662 F T F F F F F
+2663 F T F F F F F
+2664 F T F F F F F
+2665 F T F F F F F
+2666 F T F F F F F
+2667 F T F F F F F
+2668 F T F F F F F
+2669 F T F F F F F
+2670 F T F F F F F
+2671 F T F F F F F
+2672 F T F F F F F
+2673 F T F F F F F
+2674 F T F F F T F
+2675 F T F F F T F
+2676 F T F F F T F
+2677 F T F F F F F
+2678 F F F F F F F
+2679 F F F F F F F
+2680 F F F F F F F
+2681 F F F F F F F
+2682 F F F F F F F
+2683 F F F F F F F
+2684 F F F F F F F
+2685 F F F F F F F
+2686 F F F F F F F
+2687 F F F F F F F
+2688 F F F F F F F
+2689 F T F F F F F
+2690 F T F F F F F
+2691 F T F F F F F
+2692 F F F F F F F
+2693 F T F F F T F
+2694 F T F F F T F
+2695 F T F F F T F
+2696 F T F F F T F
+2697 F T F F F T F
+2698 F T F F F T F
+2699 F T F F F T F
+2700 F T F F F T F
+2701 F T F F F T F
+2702 F F F F F F F
+2703 F T F F F T F
+2704 F T F F F T F
+2705 F T F F F T F
+2706 F F F F F F F
+2707 F T F F F T F
+2708 F T F F F T F
+2709 F T F F F T F
+2710 F T F F F T F
+2711 F T F F F T F
+2712 F T F F F T F
+2713 F T F F F T F
+2714 F T F F F T F
+2715 F T F F F T F
+2716 F T F F F T F
+2717 F T F F F T F
+2718 F T F F F T F
+2719 F T F F F T F
+2720 F T F F F T F
+2721 F T F F F T F
+2722 F T F F F T F
+2723 F T F F F T F
+2724 F T F F F T F
+2725 F T F F F T F
+2726 F T F F F T F
+2727 F T F F F T F
+2728 F T F F F T F
+2729 F F F F F F F
+2730 F T F F F T F
+2731 F T F F F T F
+2732 F T F F F T F
+2733 F T F F F T F
+2734 F T F F F T F
+2735 F T F F F T F
+2736 F T F F F T F
+2737 F F F F F F F
+2738 F T F F F T F
+2739 F T F F F T F
+2740 F F F F F F F
+2741 F T F F F T F
+2742 F T F F F T F
+2743 F T F F F T F
+2744 F T F F F T F
+2745 F T F F F T F
+2746 F F F F F F F
+2747 F F F F F F F
+2748 F T F F F F F
+2749 F T F F F T F
+2750 F T F F F F F
+2751 F T F F F F F
+2752 F T F F F F F
+2753 F T F F F F F
+2754 F T F F F F F
+2755 F T F F F F F
+2756 F T F F F F F
+2757 F T F F F F F
+2758 F F F F F F F
+2759 F T F F F F F
+2760 F T F F F F F
+2761 F T F F F F F
+2762 F F F F F F F
+2763 F T F F F F F
+2764 F T F F F F F
+2765 F T F F F F F
+2766 F F F F F F F
+2767 F F F F F F F
+2768 F T F F F T F
+2769 F F F F F F F
+2770 F F F F F F F
+2771 F F F F F F F
+2772 F F F F F F F
+2773 F F F F F F F
+2774 F F F F F F F
+2775 F F F F F F F
+2776 F F F F F F F
+2777 F F F F F F F
+2778 F F F F F F F
+2779 F F F F F F F
+2780 F F F F F F F
+2781 F F F F F F F
+2782 F F F F F F F
+2783 F F F F F F F
+2784 F T F F F T F
+2785 F T F F F T F
+2786 F T F F F F F
+2787 F T F F F F F
+2788 F F F F F F F
+2789 F F F F F F F
+2790 F T F F F F F
+2791 F T F F F F F
+2792 F T F F F F F
+2793 F T F F F F F
+2794 F T F F F F F
+2795 F T F F F F F
+2796 F T F F F F F
+2797 F T F F F F F
+2798 F T F F F F F
+2799 F T F F F F F
+2800 F F F F F F F
+2801 F T F F F F F
+2802 F F F F F F F
+2803 F F F F F F F
+2804 F F F F F F F
+2805 F F F F F F F
+2806 F F F F F F F
+2807 F F F F F F F
+2808 F F F F F F F
+2809 F F F F F F F
+2810 F F F F F F F
+2811 F F F F F F F
+2812 F F F F F F F
+2813 F F F F F F F
+2814 F F F F F F F
+2815 F F F F F F F
+2816 F F F F F F F
+2817 F T F F F F F
+2818 F T F F F F F
+2819 F T F F F F F
+2820 F F F F F F F
+2821 F T F F F T F
+2822 F T F F F T F
+2823 F T F F F T F
+2824 F T F F F T F
+2825 F T F F F T F
+2826 F T F F F T F
+2827 F T F F F T F
+2828 F T F F F T F
+2829 F F F F F F F
+2830 F F F F F F F
+2831 F T F F F T F
+2832 F T F F F T F
+2833 F F F F F F F
+2834 F F F F F F F
+2835 F T F F F T F
+2836 F T F F F T F
+2837 F T F F F T F
+2838 F T F F F T F
+2839 F T F F F T F
+2840 F T F F F T F
+2841 F T F F F T F
+2842 F T F F F T F
+2843 F T F F F T F
+2844 F T F F F T F
+2845 F T F F F T F
+2846 F T F F F T F
+2847 F T F F F T F
+2848 F T F F F T F
+2849 F T F F F T F
+2850 F T F F F T F
+2851 F T F F F T F
+2852 F T F F F T F
+2853 F T F F F T F
+2854 F T F F F T F
+2855 F T F F F T F
+2856 F T F F F T F
+2857 F F F F F F F
+2858 F T F F F T F
+2859 F T F F F T F
+2860 F T F F F T F
+2861 F T F F F T F
+2862 F T F F F T F
+2863 F T F F F T F
+2864 F T F F F T F
+2865 F F F F F F F
+2866 F T F F F T F
+2867 F T F F F T F
+2868 F F F F F F F
+2869 F T F F F T F
+2870 F T F F F T F
+2871 F T F F F T F
+2872 F T F F F T F
+2873 F T F F F T F
+2874 F F F F F F F
+2875 F F F F F F F
+2876 F T F F F F F
+2877 F T F F F T F
+2878 F T F F F F F
+2879 F T F F F F F
+2880 F T F F F F F
+2881 F T F F F F F
+2882 F T F F F F F
+2883 F T F F F F F
+2884 F T F F F F F
+2885 F F F F F F F
+2886 F F F F F F F
+2887 F T F F F F F
+2888 F T F F F F F
+2889 F F F F F F F
+2890 F F F F F F F
+2891 F T F F F F F
+2892 F T F F F F F
+2893 F T F F F F F
+2894 F F F F F F F
+2895 F F F F F F F
+2896 F F F F F F F
+2897 F F F F F F F
+2898 F F F F F F F
+2899 F F F F F F F
+2900 F F F F F F F
+2901 F F F F F F F
+2902 F T F F F F F
+2903 F T F F F F F
+2904 F F F F F F F
+2905 F F F F F F F
+2906 F F F F F F F
+2907 F F F F F F F
+2908 F T F F F T F
+2909 F T F F F T F
+2910 F F F F F F F
+2911 F T F F F T F
+2912 F T F F F T F
+2913 F T F F F T F
+2914 F T F F F F F
+2915 F T F F F F F
+2916 F F F F F F F
+2917 F F F F F F F
+2918 F T F F F F F
+2919 F T F F F F F
+2920 F T F F F F F
+2921 F T F F F F F
+2922 F T F F F F F
+2923 F T F F F F F
+2924 F T F F F F F
+2925 F T F F F F F
+2926 F T F F F F F
+2927 F T F F F F F
+2928 F T F F F F F
+2929 F T F F F T F
+2930 F T F F F F F
+2931 F T F F F F F
+2932 F T F F F F F
+2933 F T F F F F F
+2934 F T F F F F F
+2935 F T F F F F F
+2936 F F F F F F F
+2937 F F F F F F F
+2938 F F F F F F F
+2939 F F F F F F F
+2940 F F F F F F F
+2941 F F F F F F F
+2942 F F F F F F F
+2943 F F F F F F F
+2944 F F F F F F F
+2945 F F F F F F F
+2946 F T F F F F F
+2947 F T F F F T F
+2948 F F F F F F F
+2949 F T F F F T F
+2950 F T F F F T F
+2951 F T F F F T F
+2952 F T F F F T F
+2953 F T F F F T F
+2954 F T F F F T F
+2955 F F F F F F F
+2956 F F F F F F F
+2957 F F F F F F F
+2958 F T F F F T F
+2959 F T F F F T F
+2960 F T F F F T F
+2961 F F F F F F F
+2962 F T F F F T F
+2963 F T F F F T F
+2964 F T F F F T F
+2965 F T F F F T F
+2966 F F F F F F F
+2967 F F F F F F F
+2968 F F F F F F F
+2969 F T F F F T F
+2970 F T F F F T F
+2971 F F F F F F F
+2972 F T F F F T F
+2973 F F F F F F F
+2974 F T F F F T F
+2975 F T F F F T F
+2976 F F F F F F F
+2977 F F F F F F F
+2978 F F F F F F F
+2979 F T F F F T F
+2980 F T F F F T F
+2981 F F F F F F F
+2982 F F F F F F F
+2983 F F F F F F F
+2984 F T F F F T F
+2985 F T F F F T F
+2986 F T F F F T F
+2987 F F F F F F F
+2988 F F F F F F F
+2989 F F F F F F F
+2990 F T F F F T F
+2991 F T F F F T F
+2992 F T F F F T F
+2993 F T F F F T F
+2994 F T F F F T F
+2995 F T F F F T F
+2996 F T F F F T F
+2997 F T F F F T F
+2998 F T F F F T F
+2999 F T F F F T F
+3000 F T F F F T F
+3001 F T F F F T F
+3002 F F F F F F F
+3003 F F F F F F F
+3004 F F F F F F F
+3005 F F F F F F F
+3006 F T F F F F F
+3007 F T F F F F F
+3008 F T F F F F F
+3009 F T F F F F F
+3010 F T F F F F F
+3011 F F F F F F F
+3012 F F F F F F F
+3013 F F F F F F F
+3014 F T F F F F F
+3015 F T F F F F F
+3016 F T F F F F F
+3017 F F F F F F F
+3018 F T F F F F F
+3019 F T F F F F F
+3020 F T F F F F F
+3021 F T F F F F F
+3022 F F F F F F F
+3023 F F F F F F F
+3024 F T F F F T F
+3025 F F F F F F F
+3026 F F F F F F F
+3027 F F F F F F F
+3028 F F F F F F F
+3029 F F F F F F F
+3030 F F F F F F F
+3031 F T F F F F F
+3032 F F F F F F F
+3033 F F F F F F F
+3034 F F F F F F F
+3035 F F F F F F F
+3036 F F F F F F F
+3037 F F F F F F F
+3038 F F F F F F F
+3039 F F F F F F F
+3040 F F F F F F F
+3041 F F F F F F F
+3042 F F F F F F F
+3043 F F F F F F F
+3044 F F F F F F F
+3045 F F F F F F F
+3046 F T F F F F F
+3047 F T F F F F F
+3048 F T F F F F F
+3049 F T F F F F F
+3050 F T F F F F F
+3051 F T F F F F F
+3052 F T F F F F F
+3053 F T F F F F F
+3054 F T F F F F F
+3055 F T F F F F F
+3056 F T F F F F F
+3057 F T F F F F F
+3058 F T F F F F F
+3059 F T F F F F F
+3060 F T F F F F F
+3061 F T F F F F F
+3062 F T F F F F F
+3063 F T F F F F F
+3064 F T F F F F F
+3065 F T F F F F F
+3066 F T F F F F F
+3067 F F F F F F F
+3068 F F F F F F F
+3069 F F F F F F F
+3070 F F F F F F F
+3071 F F F F F F F
+3072 F F F F F F F
+3073 F T F F F F F
+3074 F T F F F F F
+3075 F T F F F F F
+3076 F F F F F F F
+3077 F T F F F T F
+3078 F T F F F T F
+3079 F T F F F T F
+3080 F T F F F T F
+3081 F T F F F T F
+3082 F T F F F T F
+3083 F T F F F T F
+3084 F T F F F T F
+3085 F F F F F F F
+3086 F T F F F T F
+3087 F T F F F T F
+3088 F T F F F T F
+3089 F F F F F F F
+3090 F T F F F T F
+3091 F T F F F T F
+3092 F T F F F T F
+3093 F T F F F T F
+3094 F T F F F T F
+3095 F T F F F T F
+3096 F T F F F T F
+3097 F T F F F T F
+3098 F T F F F T F
+3099 F T F F F T F
+3100 F T F F F T F
+3101 F T F F F T F
+3102 F T F F F T F
+3103 F T F F F T F
+3104 F T F F F T F
+3105 F T F F F T F
+3106 F T F F F T F
+3107 F T F F F T F
+3108 F T F F F T F
+3109 F T F F F T F
+3110 F T F F F T F
+3111 F T F F F T F
+3112 F T F F F T F
+3113 F F F F F F F
+3114 F T F F F T F
+3115 F T F F F T F
+3116 F T F F F T F
+3117 F T F F F T F
+3118 F T F F F T F
+3119 F T F F F T F
+3120 F T F F F T F
+3121 F T F F F T F
+3122 F T F F F T F
+3123 F T F F F T F
+3124 F F F F F F F
+3125 F T F F F T F
+3126 F T F F F T F
+3127 F T F F F T F
+3128 F T F F F T F
+3129 F T F F F T F
+3130 F F F F F F F
+3131 F F F F F F F
+3132 F F F F F F F
+3133 F T F F F T F
+3134 F T F F F F F
+3135 F T F F F F F
+3136 F T F F F F F
+3137 F T F F F F F
+3138 F T F F F F F
+3139 F T F F F F F
+3140 F T F F F F F
+3141 F F F F F F F
+3142 F T F F F F F
+3143 F T F F F F F
+3144 F T F F F F F
+3145 F F F F F F F
+3146 F T F F F F F
+3147 F T F F F F F
+3148 F T F F F F F
+3149 F T F F F F F
+3150 F F F F F F F
+3151 F F F F F F F
+3152 F F F F F F F
+3153 F F F F F F F
+3154 F F F F F F F
+3155 F F F F F F F
+3156 F F F F F F F
+3157 F T F F F F F
+3158 F T F F F F F
+3159 F F F F F F F
+3160 F T F F F T F
+3161 F T F F F T F
+3162 F F F F F F F
+3163 F F F F F F F
+3164 F F F F F F F
+3165 F F F F F F F
+3166 F F F F F F F
+3167 F F F F F F F
+3168 F T F F F T F
+3169 F T F F F T F
+3170 F T F F F F F
+3171 F T F F F F F
+3172 F F F F F F F
+3173 F F F F F F F
+3174 F T F F F F F
+3175 F T F F F F F
+3176 F T F F F F F
+3177 F T F F F F F
+3178 F T F F F F F
+3179 F T F F F F F
+3180 F T F F F F F
+3181 F T F F F F F
+3182 F T F F F F F
+3183 F T F F F F F
+3184 F F F F F F F
+3185 F F F F F F F
+3186 F F F F F F F
+3187 F F F F F F F
+3188 F F F F F F F
+3189 F F F F F F F
+3190 F F F F F F F
+3191 F F F F F F F
+3192 F T F F F F F
+3193 F T F F F F F
+3194 F T F F F F F
+3195 F T F F F F F
+3196 F T F F F F F
+3197 F T F F F F F
+3198 F T F F F F F
+3199 F T F F F F F
+3200 F F F F F F F
+3201 F F F F F F F
+3202 F T F F F F F
+3203 F T F F F F F
+3204 F F F F F F F
+3205 F T F F F T F
+3206 F T F F F T F
+3207 F T F F F T F
+3208 F T F F F T F
+3209 F T F F F T F
+3210 F T F F F T F
+3211 F T F F F T F
+3212 F T F F F T F
+3213 F F F F F F F
+3214 F T F F F T F
+3215 F T F F F T F
+3216 F T F F F T F
+3217 F F F F F F F
+3218 F T F F F T F
+3219 F T F F F T F
+3220 F T F F F T F
+3221 F T F F F T F
+3222 F T F F F T F
+3223 F T F F F T F
+3224 F T F F F T F
+3225 F T F F F T F
+3226 F T F F F T F
+3227 F T F F F T F
+3228 F T F F F T F
+3229 F T F F F T F
+3230 F T F F F T F
+3231 F T F F F T F
+3232 F T F F F T F
+3233 F T F F F T F
+3234 F T F F F T F
+3235 F T F F F T F
+3236 F T F F F T F
+3237 F T F F F T F
+3238 F T F F F T F
+3239 F T F F F T F
+3240 F T F F F T F
+3241 F F F F F F F
+3242 F T F F F T F
+3243 F T F F F T F
+3244 F T F F F T F
+3245 F T F F F T F
+3246 F T F F F T F
+3247 F T F F F T F
+3248 F T F F F T F
+3249 F T F F F T F
+3250 F T F F F T F
+3251 F T F F F T F
+3252 F F F F F F F
+3253 F T F F F T F
+3254 F T F F F T F
+3255 F T F F F T F
+3256 F T F F F T F
+3257 F T F F F T F
+3258 F F F F F F F
+3259 F F F F F F F
+3260 F T F F F F F
+3261 F T F F F T F
+3262 F T F F F F F
+3263 F T F F F F F
+3264 F T F F F F F
+3265 F T F F F F F
+3266 F T F F F F F
+3267 F T F F F F F
+3268 F T F F F F F
+3269 F F F F F F F
+3270 F T F F F F F
+3271 F T F F F F F
+3272 F T F F F F F
+3273 F F F F F F F
+3274 F T F F F F F
+3275 F T F F F F F
+3276 F T F F F F F
+3277 F T F F F F F
+3278 F F F F F F F
+3279 F F F F F F F
+3280 F F F F F F F
+3281 F F F F F F F
+3282 F F F F F F F
+3283 F F F F F F F
+3284 F F F F F F F
+3285 F T F F F F F
+3286 F T F F F F F
+3287 F F F F F F F
+3288 F F F F F F F
+3289 F F F F F F F
+3290 F F F F F F F
+3291 F F F F F F F
+3292 F F F F F F F
+3293 F F F F F F F
+3294 F T F F F T F
+3295 F F F F F F F
+3296 F T F F F T F
+3297 F T F F F T F
+3298 F T F F F F F
+3299 F T F F F F F
+3300 F F F F F F F
+3301 F F F F F F F
+3302 F T F F F F F
+3303 F T F F F F F
+3304 F T F F F F F
+3305 F T F F F F F
+3306 F T F F F F F
+3307 F T F F F F F
+3308 F T F F F F F
+3309 F T F F F F F
+3310 F T F F F F F
+3311 F T F F F F F
+3312 F F F F F F F
+3313 F T F F F T F
+3314 F T F F F T F
+3315 F F F F F F F
+3316 F F F F F F F
+3317 F F F F F F F
+3318 F F F F F F F
+3319 F F F F F F F
+3320 F F F F F F F
+3321 F F F F F F F
+3322 F F F F F F F
+3323 F F F F F F F
+3324 F F F F F F F
+3325 F F F F F F F
+3326 F F F F F F F
+3327 F F F F F F F
+3328 F F F F F F F
+3329 F F F F F F F
+3330 F T F F F F F
+3331 F T F F F F F
+3332 F F F F F F F
+3333 F T F F F T F
+3334 F T F F F T F
+3335 F T F F F T F
+3336 F T F F F T F
+3337 F T F F F T F
+3338 F T F F F T F
+3339 F T F F F T F
+3340 F T F F F T F
+3341 F F F F F F F
+3342 F T F F F T F
+3343 F T F F F T F
+3344 F T F F F T F
+3345 F F F F F F F
+3346 F T F F F T F
+3347 F T F F F T F
+3348 F T F F F T F
+3349 F T F F F T F
+3350 F T F F F T F
+3351 F T F F F T F
+3352 F T F F F T F
+3353 F T F F F T F
+3354 F T F F F T F
+3355 F T F F F T F
+3356 F T F F F T F
+3357 F T F F F T F
+3358 F T F F F T F
+3359 F T F F F T F
+3360 F T F F F T F
+3361 F T F F F T F
+3362 F T F F F T F
+3363 F T F F F T F
+3364 F T F F F T F
+3365 F T F F F T F
+3366 F T F F F T F
+3367 F T F F F T F
+3368 F T F F F T F
+3369 F T F F F T F
+3370 F T F F F T F
+3371 F T F F F T F
+3372 F T F F F T F
+3373 F T F F F T F
+3374 F T F F F T F
+3375 F T F F F T F
+3376 F T F F F T F
+3377 F T F F F T F
+3378 F T F F F T F
+3379 F T F F F T F
+3380 F T F F F T F
+3381 F T F F F T F
+3382 F T F F F T F
+3383 F T F F F T F
+3384 F T F F F T F
+3385 F T F F F T F
+3386 F T F F F T F
+3387 F F F F F F F
+3388 F F F F F F F
+3389 F T F F F T F
+3390 F T F F F F F
+3391 F T F F F F F
+3392 F T F F F F F
+3393 F T F F F F F
+3394 F T F F F F F
+3395 F T F F F F F
+3396 F T F F F F F
+3397 F F F F F F F
+3398 F T F F F F F
+3399 F T F F F F F
+3400 F T F F F F F
+3401 F F F F F F F
+3402 F T F F F F F
+3403 F T F F F F F
+3404 F T F F F F F
+3405 F T F F F F F
+3406 F T F F F T F
+3407 F F F F F F F
+3408 F F F F F F F
+3409 F F F F F F F
+3410 F F F F F F F
+3411 F F F F F F F
+3412 F F F F F F F
+3413 F F F F F F F
+3414 F F F F F F F
+3415 F T F F F F F
+3416 F F F F F F F
+3417 F F F F F F F
+3418 F F F F F F F
+3419 F F F F F F F
+3420 F F F F F F F
+3421 F F F F F F F
+3422 F F F F F F F
+3423 F F F F F F F
+3424 F T F F F T F
+3425 F T F F F T F
+3426 F T F F F F F
+3427 F T F F F F F
+3428 F F F F F F F
+3429 F F F F F F F
+3430 F T F F F F F
+3431 F T F F F F F
+3432 F T F F F F F
+3433 F T F F F F F
+3434 F T F F F F F
+3435 F T F F F F F
+3436 F T F F F F F
+3437 F T F F F F F
+3438 F T F F F F F
+3439 F T F F F F F
+3440 F T F F F F F
+3441 F T F F F F F
+3442 F T F F F F F
+3443 F T F F F F F
+3444 F T F F F F F
+3445 F T F F F F F
+3446 F F F F F F F
+3447 F F F F F F F
+3448 F F F F F F F
+3449 F T F F F F F
+3450 F T F F F T F
+3451 F T F F F T F
+3452 F T F F F T F
+3453 F T F F F T F
+3454 F T F F F T F
+3455 F T F F F T F
+3456 F F F F F F F
+3457 F F F F F F F
+3458 F T F F F F F
+3459 F T F F F F F
+3460 F F F F F F F
+3461 F T F F F T F
+3462 F T F F F T F
+3463 F T F F F T F
+3464 F T F F F T F
+3465 F T F F F T F
+3466 F T F F F T F
+3467 F T F F F T F
+3468 F T F F F T F
+3469 F T F F F T F
+3470 F T F F F T F
+3471 F T F F F T F
+3472 F T F F F T F
+3473 F T F F F T F
+3474 F T F F F T F
+3475 F T F F F T F
+3476 F T F F F T F
+3477 F T F F F T F
+3478 F T F F F T F
+3479 F F F F F F F
+3480 F F F F F F F
+3481 F F F F F F F
+3482 F T F F F T F
+3483 F T F F F T F
+3484 F T F F F T F
+3485 F T F F F T F
+3486 F T F F F T F
+3487 F T F F F T F
+3488 F T F F F T F
+3489 F T F F F T F
+3490 F T F F F T F
+3491 F T F F F T F
+3492 F T F F F T F
+3493 F T F F F T F
+3494 F T F F F T F
+3495 F T F F F T F
+3496 F T F F F T F
+3497 F T F F F T F
+3498 F T F F F T F
+3499 F T F F F T F
+3500 F T F F F T F
+3501 F T F F F T F
+3502 F T F F F T F
+3503 F T F F F T F
+3504 F T F F F T F
+3505 F T F F F T F
+3506 F F F F F F F
+3507 F T F F F T F
+3508 F T F F F T F
+3509 F T F F F T F
+3510 F T F F F T F
+3511 F T F F F T F
+3512 F T F F F T F
+3513 F T F F F T F
+3514 F T F F F T F
+3515 F T F F F T F
+3516 F F F F F F F
+3517 F T F F F T F
+3518 F F F F F F F
+3519 F F F F F F F
+3520 F T F F F T F
+3521 F T F F F T F
+3522 F T F F F T F
+3523 F T F F F T F
+3524 F T F F F T F
+3525 F T F F F T F
+3526 F T F F F T F
+3527 F F F F F F F
+3528 F F F F F F F
+3529 F F F F F F F
+3530 F T F F F F F
+3531 F F F F F F F
+3532 F F F F F F F
+3533 F F F F F F F
+3534 F F F F F F F
+3535 F T F F F F F
+3536 F T F F F F F
+3537 F T F F F F F
+3538 F T F F F F F
+3539 F T F F F F F
+3540 F T F F F F F
+3541 F F F F F F F
+3542 F T F F F F F
+3543 F F F F F F F
+3544 F T F F F F F
+3545 F T F F F F F
+3546 F T F F F F F
+3547 F T F F F F F
+3548 F T F F F F F
+3549 F T F F F F F
+3550 F T F F F F F
+3551 F T F F F F F
+3552 F F F F F F F
+3553 F F F F F F F
+3554 F F F F F F F
+3555 F F F F F F F
+3556 F F F F F F F
+3557 F F F F F F F
+3558 F F F F F F F
+3559 F F F F F F F
+3560 F F F F F F F
+3561 F F F F F F F
+3562 F F F F F F F
+3563 F F F F F F F
+3564 F F F F F F F
+3565 F F F F F F F
+3566 F F F F F F F
+3567 F F F F F F F
+3568 F F F F F F F
+3569 F F F F F F F
+3570 F T F F F F F
+3571 F T F F F F F
+3572 F T F F F F F
+3573 F F F F F F F
+3574 F F F F F F F
+3575 F F F F F F F
+3576 F F F F F F F
+3577 F F F F F F F
+3578 F F F F F F F
+3579 F F F F F F F
+3580 F F F F F F F
+3581 F F F F F F F
+3582 F F F F F F F
+3583 F F F F F F F
+3584 F F F F F F F
+3585 F T F F F T F
+3586 F T F F F T F
+3587 F T F F F T F
+3588 F T F F F T F
+3589 F T F F F T F
+3590 F T F F F T F
+3591 F T F F F T F
+3592 F T F F F T F
+3593 F T F F F T F
+3594 F T F F F T F
+3595 F T F F F T F
+3596 F T F F F T F
+3597 F T F F F T F
+3598 F T F F F T F
+3599 F T F F F T F
+3600 F T F F F T F
+3601 F T F F F T F
+3602 F T F F F T F
+3603 F T F F F T F
+3604 F T F F F T F
+3605 F T F F F T F
+3606 F T F F F T F
+3607 F T F F F T F
+3608 F T F F F T F
+3609 F T F F F T F
+3610 F T F F F T F
+3611 F T F F F T F
+3612 F T F F F T F
+3613 F T F F F T F
+3614 F T F F F T F
+3615 F T F F F T F
+3616 F T F F F T F
+3617 F T F F F T F
+3618 F T F F F T F
+3619 F T F F F T F
+3620 F T F F F T F
+3621 F T F F F T F
+3622 F T F F F T F
+3623 F T F F F T F
+3624 F T F F F T F
+3625 F T F F F T F
+3626 F T F F F T F
+3627 F T F F F T F
+3628 F T F F F T F
+3629 F T F F F T F
+3630 F T F F F T F
+3631 F T F F F T F
+3632 F T F F F T F
+3633 F T F F F F F
+3634 F T F F F T F
+3635 F T F F F T F
+3636 F T F F F F F
+3637 F T F F F F F
+3638 F T F F F F F
+3639 F T F F F F F
+3640 F T F F F F F
+3641 F T F F F F F
+3642 F T F F F F F
+3643 F F F F F F F
+3644 F F F F F F F
+3645 F F F F F F F
+3646 F F F F F F F
+3647 F T F F F F F
+3648 F T F F F T F
+3649 F T F F F T F
+3650 F T F F F T F
+3651 F T F F F T F
+3652 F T F F F T F
+3653 F T F F F T F
+3654 F T F F F T F
+3655 F T F F F F F
+3656 F T F F F F F
+3657 F T F F F F F
+3658 F T F F F F F
+3659 F T F F F F F
+3660 F T F F F F F
+3661 F T F F F F F
+3662 F T F F F F F
+3663 F T F F F F F
+3664 F T F F F F F
+3665 F T F F F F F
+3666 F T F F F F F
+3667 F T F F F F F
+3668 F T F F F F F
+3669 F T F F F F F
+3670 F T F F F F F
+3671 F T F F F F F
+3672 F T F F F F F
+3673 F T F F F F F
+3674 F T F F F F F
+3675 F T F F F F F
+3676 F F F F F F F
+3677 F F F F F F F
+3678 F F F F F F F
+3679 F F F F F F F
+3680 F F F F F F F
+3681 F F F F F F F
+3682 F F F F F F F
+3683 F F F F F F F
+3684 F F F F F F F
+3685 F F F F F F F
+3686 F F F F F F F
+3687 F F F F F F F
+3688 F F F F F F F
+3689 F F F F F F F
+3690 F F F F F F F
+3691 F F F F F F F
+3692 F F F F F F F
+3693 F F F F F F F
+3694 F F F F F F F
+3695 F F F F F F F
+3696 F F F F F F F
+3697 F F F F F F F
+3698 F F F F F F F
+3699 F F F F F F F
+3700 F F F F F F F
+3701 F F F F F F F
+3702 F F F F F F F
+3703 F F F F F F F
+3704 F F F F F F F
+3705 F F F F F F F
+3706 F F F F F F F
+3707 F F F F F F F
+3708 F F F F F F F
+3709 F F F F F F F
+3710 F F F F F F F
+3711 F F F F F F F
+3712 F F F F F F F
+3713 F T F F F T F
+3714 F T F F F T F
+3715 F F F F F F F
+3716 F T F F F T F
+3717 F F F F F F F
+3718 F F F F F F F
+3719 F T F F F T F
+3720 F T F F F T F
+3721 F F F F F F F
+3722 F T F F F T F
+3723 F F F F F F F
+3724 F F F F F F F
+3725 F T F F F T F
+3726 F F F F F F F
+3727 F F F F F F F
+3728 F F F F F F F
+3729 F F F F F F F
+3730 F F F F F F F
+3731 F F F F F F F
+3732 F T F F F T F
+3733 F T F F F T F
+3734 F T F F F T F
+3735 F T F F F T F
+3736 F F F F F F F
+3737 F T F F F T F
+3738 F T F F F T F
+3739 F T F F F T F
+3740 F T F F F T F
+3741 F T F F F T F
+3742 F T F F F T F
+3743 F T F F F T F
+3744 F F F F F F F
+3745 F T F F F T F
+3746 F T F F F T F
+3747 F T F F F T F
+3748 F F F F F F F
+3749 F T F F F T F
+3750 F F F F F F F
+3751 F T F F F T F
+3752 F F F F F F F
+3753 F F F F F F F
+3754 F T F F F T F
+3755 F T F F F T F
+3756 F F F F F F F
+3757 F T F F F T F
+3758 F T F F F T F
+3759 F T F F F T F
+3760 F T F F F T F
+3761 F T F F F F F
+3762 F T F F F T F
+3763 F T F F F T F
+3764 F T F F F F F
+3765 F T F F F F F
+3766 F T F F F F F
+3767 F T F F F F F
+3768 F T F F F F F
+3769 F T F F F F F
+3770 F F F F F F F
+3771 F T F F F F F
+3772 F T F F F F F
+3773 F T F F F T F
+3774 F F F F F F F
+3775 F F F F F F F
+3776 F T F F F T F
+3777 F T F F F T F
+3778 F T F F F T F
+3779 F T F F F T F
+3780 F T F F F T F
+3781 F F F F F F F
+3782 F T F F F T F
+3783 F F F F F F F
+3784 F T F F F F F
+3785 F T F F F F F
+3786 F T F F F F F
+3787 F T F F F F F
+3788 F T F F F F F
+3789 F T F F F F F
+3790 F F F F F F F
+3791 F F F F F F F
+3792 F T F F F F F
+3793 F T F F F F F
+3794 F T F F F F F
+3795 F T F F F F F
+3796 F T F F F F F
+3797 F T F F F F F
+3798 F T F F F F F
+3799 F T F F F F F
+3800 F T F F F F F
+3801 F T F F F F F
+3802 F F F F F F F
+3803 F F F F F F F
+3804 F T F F F T F
+3805 F T F F F T F
+3806 F F F F F F F
+3807 F F F F F F F
+3808 F F F F F F F
+3809 F F F F F F F
+3810 F F F F F F F
+3811 F F F F F F F
+3812 F F F F F F F
+3813 F F F F F F F
+3814 F F F F F F F
+3815 F F F F F F F
+3816 F F F F F F F
+3817 F F F F F F F
+3818 F F F F F F F
+3819 F F F F F F F
+3820 F F F F F F F
+3821 F F F F F F F
+3822 F F F F F F F
+3823 F F F F F F F
+3824 F F F F F F F
+3825 F F F F F F F
+3826 F F F F F F F
+3827 F F F F F F F
+3828 F F F F F F F
+3829 F F F F F F F
+3830 F F F F F F F
+3831 F F F F F F F
+3832 F F F F F F F
+3833 F F F F F F F
+3834 F F F F F F F
+3835 F F F F F F F
+3836 F F F F F F F
+3837 F F F F F F F
+3838 F F F F F F F
+3839 F F F F F F F
+3840 F T F F F T F
+3841 F T F F F F F
+3842 F T F F F F F
+3843 F T F F F F F
+3844 F T F F F F F
+3845 F T F F F F F
+3846 F T F F F F F
+3847 F T F F F F F
+3848 F T F F F F F
+3849 F T F F F F F
+3850 F T F F F F F
+3851 F T F F F F F
+3852 F T F F F F F
+3853 F T F F F F F
+3854 F T F F F F F
+3855 F T F F F F F
+3856 F T F F F F F
+3857 F T F F F F F
+3858 F T F F F F F
+3859 F T F F F F F
+3860 F T F F F F F
+3861 F T F F F F F
+3862 F T F F F F F
+3863 F T F F F F F
+3864 F T F F F F F
+3865 F T F F F F F
+3866 F T F F F F F
+3867 F T F F F F F
+3868 F T F F F F F
+3869 F T F F F F F
+3870 F T F F F F F
+3871 F T F F F F F
+3872 F T F F F F F
+3873 F T F F F F F
+3874 F T F F F F F
+3875 F T F F F F F
+3876 F T F F F F F
+3877 F T F F F F F
+3878 F T F F F F F
+3879 F T F F F F F
+3880 F T F F F F F
+3881 F T F F F F F
+3882 F T F F F F F
+3883 F T F F F F F
+3884 F T F F F F F
+3885 F T F F F F F
+3886 F T F F F F F
+3887 F T F F F F F
+3888 F T F F F F F
+3889 F T F F F F F
+3890 F T F F F F F
+3891 F T F F F F F
+3892 F T F F F F F
+3893 F T F F F F F
+3894 F T F F F F F
+3895 F T F F F F F
+3896 F T F F F F F
+3897 F T F F F F F
+3898 F T F F F F F
+3899 F T F F F F F
+3900 F T F F F F F
+3901 F T F F F F F
+3902 F T F F F F F
+3903 F T F F F F F
+3904 F T F F F T F
+3905 F T F F F T F
+3906 F T F F F T F
+3907 F T F F F T F
+3908 F T F F F T F
+3909 F T F F F T F
+3910 F T F F F T F
+3911 F T F F F T F
+3912 F F F F F F F
+3913 F T F F F T F
+3914 F T F F F T F
+3915 F T F F F T F
+3916 F T F F F T F
+3917 F T F F F T F
+3918 F T F F F T F
+3919 F T F F F T F
+3920 F T F F F T F
+3921 F T F F F T F
+3922 F T F F F T F
+3923 F T F F F T F
+3924 F T F F F T F
+3925 F T F F F T F
+3926 F T F F F T F
+3927 F T F F F T F
+3928 F T F F F T F
+3929 F T F F F T F
+3930 F T F F F T F
+3931 F T F F F T F
+3932 F T F F F T F
+3933 F T F F F T F
+3934 F T F F F T F
+3935 F T F F F T F
+3936 F T F F F T F
+3937 F T F F F T F
+3938 F T F F F T F
+3939 F T F F F T F
+3940 F T F F F T F
+3941 F T F F F T F
+3942 F T F F F T F
+3943 F T F F F T F
+3944 F T F F F T F
+3945 F T F F F T F
+3946 F T F F F T F
+3947 F T F F F T F
+3948 F T F F F T F
+3949 F F F F F F F
+3950 F F F F F F F
+3951 F F F F F F F
+3952 F F F F F F F
+3953 F T F F F F F
+3954 F T F F F F F
+3955 F T F F F F F
+3956 F T F F F F F
+3957 F T F F F F F
+3958 F T F F F F F
+3959 F T F F F F F
+3960 F T F F F F F
+3961 F T F F F F F
+3962 F T F F F F F
+3963 F T F F F F F
+3964 F T F F F F F
+3965 F T F F F F F
+3966 F T F F F F F
+3967 F T F F F F F
+3968 F T F F F F F
+3969 F T F F F F F
+3970 F T F F F F F
+3971 F T F F F F F
+3972 F T F F F F F
+3973 F T F F F F F
+3974 F T F F F F F
+3975 F T F F F F F
+3976 F T F F F T F
+3977 F T F F F T F
+3978 F T F F F T F
+3979 F T F F F T F
+3980 F T F F F T F
+3981 F T F F F F F
+3982 F T F F F F F
+3983 F T F F F F F
+3984 F T F F F F F
+3985 F T F F F F F
+3986 F T F F F F F
+3987 F T F F F F F
+3988 F T F F F F F
+3989 F T F F F F F
+3990 F T F F F F F
+3991 F T F F F F F
+3992 F F F F F F F
+3993 F T F F F F F
+3994 F T F F F F F
+3995 F T F F F F F
+3996 F T F F F F F
+3997 F T F F F F F
+3998 F T F F F F F
+3999 F T F F F F F
+4000 F T F F F F F
+4001 F T F F F F F
+4002 F T F F F F F
+4003 F T F F F F F
+4004 F T F F F F F
+4005 F T F F F F F
+4006 F T F F F F F
+4007 F T F F F F F
+4008 F T F F F F F
+4009 F T F F F F F
+4010 F T F F F F F
+4011 F T F F F F F
+4012 F T F F F F F
+4013 F T F F F F F
+4014 F T F F F F F
+4015 F T F F F F F
+4016 F T F F F F F
+4017 F T F F F F F
+4018 F T F F F F F
+4019 F T F F F F F
+4020 F T F F F F F
+4021 F T F F F F F
+4022 F T F F F F F
+4023 F T F F F F F
+4024 F T F F F F F
+4025 F T F F F F F
+4026 F T F F F F F
+4027 F T F F F F F
+4028 F T F F F F F
+4029 F F F F F F F
+4030 F T F F F F F
+4031 F T F F F F F
+4032 F T F F F F F
+4033 F T F F F F F
+4034 F T F F F F F
+4035 F T F F F F F
+4036 F T F F F F F
+4037 F T F F F F F
+4038 F T F F F F F
+4039 F T F F F F F
+4040 F T F F F F F
+4041 F T F F F F F
+4042 F T F F F F F
+4043 F T F F F F F
+4044 F T F F F F F
+4045 F F F F F F F
+4046 F T F F F F F
+4047 F T F F F F F
+4048 F T F F F F F
+4049 F T F F F F F
+4050 F T F F F F F
+4051 F T F F F F F
+4052 F T F F F F F
+4053 F T F F F F F
+4054 F T F F F F F
+4055 F T F F F F F
+4056 F T F F F F F
+4057 F T F F F F F
+4058 F T F F F F F
+4059 F F F F F F F
+4060 F F F F F F F
+4061 F F F F F F F
+4062 F F F F F F F
+4063 F F F F F F F
+4064 F F F F F F F
+4065 F F F F F F F
+4066 F F F F F F F
+4067 F F F F F F F
+4068 F F F F F F F
+4069 F F F F F F F
+4070 F F F F F F F
+4071 F F F F F F F
+4072 F F F F F F F
+4073 F F F F F F F
+4074 F F F F F F F
+4075 F F F F F F F
+4076 F F F F F F F
+4077 F F F F F F F
+4078 F F F F F F F
+4079 F F F F F F F
+4080 F F F F F F F
+4081 F F F F F F F
+4082 F F F F F F F
+4083 F F F F F F F
+4084 F F F F F F F
+4085 F F F F F F F
+4086 F F F F F F F
+4087 F F F F F F F
+4088 F F F F F F F
+4089 F F F F F F F
+4090 F F F F F F F
+4091 F F F F F F F
+4092 F F F F F F F
+4093 F F F F F F F
+4094 F F F F F F F
+4095 F F F F F F F
+4096 F T F F F T F
+4097 F T F F F T F
+4098 F T F F F T F
+4099 F T F F F T F
+4100 F T F F F T F
+4101 F T F F F T F
+4102 F T F F F T F
+4103 F T F F F T F
+4104 F T F F F T F
+4105 F T F F F T F
+4106 F T F F F T F
+4107 F T F F F T F
+4108 F T F F F T F
+4109 F T F F F T F
+4110 F T F F F T F
+4111 F T F F F T F
+4112 F T F F F T F
+4113 F T F F F T F
+4114 F T F F F T F
+4115 F T F F F T F
+4116 F T F F F T F
+4117 F T F F F T F
+4118 F T F F F T F
+4119 F T F F F T F
+4120 F T F F F T F
+4121 F T F F F T F
+4122 F T F F F T F
+4123 F T F F F T F
+4124 F T F F F T F
+4125 F T F F F T F
+4126 F T F F F T F
+4127 F T F F F T F
+4128 F T F F F T F
+4129 F T F F F T F
+4130 F T F F F T F
+4131 F T F F F T F
+4132 F T F F F T F
+4133 F T F F F T F
+4134 F T F F F T F
+4135 F T F F F T F
+4136 F T F F F T F
+4137 F T F F F T F
+4138 F T F F F T F
+4139 F T F F F F F
+4140 F T F F F F F
+4141 F T F F F F F
+4142 F T F F F F F
+4143 F T F F F F F
+4144 F T F F F F F
+4145 F T F F F F F
+4146 F T F F F F F
+4147 F T F F F F F
+4148 F T F F F F F
+4149 F T F F F F F
+4150 F T F F F F F
+4151 F T F F F F F
+4152 F T F F F F F
+4153 F T F F F F F
+4154 F T F F F F F
+4155 F T F F F F F
+4156 F T F F F F F
+4157 F T F F F F F
+4158 F T F F F F F
+4159 F T F F F T F
+4160 F T F F F F F
+4161 F T F F F F F
+4162 F T F F F F F
+4163 F T F F F F F
+4164 F T F F F F F
+4165 F T F F F F F
+4166 F T F F F F F
+4167 F T F F F F F
+4168 F T F F F F F
+4169 F T F F F F F
+4170 F T F F F F F
+4171 F T F F F F F
+4172 F T F F F F F
+4173 F T F F F F F
+4174 F T F F F F F
+4175 F T F F F F F
+4176 F T F F F T F
+4177 F T F F F T F
+4178 F T F F F T F
+4179 F T F F F T F
+4180 F T F F F T F
+4181 F T F F F T F
+4182 F T F F F F F
+4183 F T F F F F F
+4184 F T F F F F F
+4185 F T F F F F F
+4186 F T F F F T F
+4187 F T F F F T F
+4188 F T F F F T F
+4189 F T F F F T F
+4190 F T F F F F F
+4191 F T F F F F F
+4192 F T F F F F F
+4193 F T F F F T F
+4194 F T F F F F F
+4195 F T F F F F F
+4196 F T F F F F F
+4197 F T F F F T F
+4198 F T F F F T F
+4199 F T F F F F F
+4200 F T F F F F F
+4201 F T F F F F F
+4202 F T F F F F F
+4203 F T F F F F F
+4204 F T F F F F F
+4205 F T F F F F F
+4206 F T F F F T F
+4207 F T F F F T F
+4208 F T F F F T F
+4209 F T F F F F F
+4210 F T F F F F F
+4211 F T F F F F F
+4212 F T F F F F F
+4213 F T F F F T F
+4214 F T F F F T F
+4215 F T F F F T F
+4216 F T F F F T F
+4217 F T F F F T F
+4218 F T F F F T F
+4219 F T F F F T F
+4220 F T F F F T F
+4221 F T F F F T F
+4222 F T F F F T F
+4223 F T F F F T F
+4224 F T F F F T F
+4225 F T F F F T F
+4226 F T F F F F F
+4227 F T F F F F F
+4228 F T F F F F F
+4229 F T F F F F F
+4230 F T F F F F F
+4231 F T F F F F F
+4232 F T F F F F F
+4233 F T F F F F F
+4234 F T F F F F F
+4235 F T F F F F F
+4236 F T F F F F F
+4237 F T F F F F F
+4238 F T F F F T F
+4239 F T F F F F F
+4240 F T F F F F F
+4241 F T F F F F F
+4242 F T F F F F F
+4243 F T F F F F F
+4244 F T F F F F F
+4245 F T F F F F F
+4246 F T F F F F F
+4247 F T F F F F F
+4248 F T F F F F F
+4249 F T F F F F F
+4250 F T F F F F F
+4251 F T F F F F F
+4252 F T F F F F F
+4253 F T F F F F F
+4254 F T F F F F F
+4255 F T F F F F F
+4256 F T F T F T F
+4257 F T F T F T F
+4258 F T F T F T F
+4259 F T F T F T F
+4260 F T F T F T F
+4261 F T F T F T F
+4262 F T F T F T F
+4263 F T F T F T F
+4264 F T F T F T F
+4265 F T F T F T F
+4266 F T F T F T F
+4267 F T F T F T F
+4268 F T F T F T F
+4269 F T F T F T F
+4270 F T F T F T F
+4271 F T F T F T F
+4272 F T F T F T F
+4273 F T F T F T F
+4274 F T F T F T F
+4275 F T F T F T F
+4276 F T F T F T F
+4277 F T F T F T F
+4278 F T F T F T F
+4279 F T F T F T F
+4280 F T F T F T F
+4281 F T F T F T F
+4282 F T F T F T F
+4283 F T F T F T F
+4284 F T F T F T F
+4285 F T F T F T F
+4286 F T F T F T F
+4287 F T F T F T F
+4288 F T F T F T F
+4289 F T F T F T F
+4290 F T F T F T F
+4291 F T F T F T F
+4292 F T F T F T F
+4293 F T F T F T F
+4294 F F F F F F F
+4295 F F F F F F F
+4296 F F F F F F F
+4297 F F F F F F F
+4298 F F F F F F F
+4299 F F F F F F F
+4300 F F F F F F F
+4301 F F F F F F F
+4302 F F F F F F F
+4303 F F F F F F F
+4304 F T F F F T F
+4305 F T F F F T F
+4306 F T F F F T F
+4307 F T F F F T F
+4308 F T F F F T F
+4309 F T F F F T F
+4310 F T F F F T F
+4311 F T F F F T F
+4312 F T F F F T F
+4313 F T F F F T F
+4314 F T F F F T F
+4315 F T F F F T F
+4316 F T F F F T F
+4317 F T F F F T F
+4318 F T F F F T F
+4319 F T F F F T F
+4320 F T F F F T F
+4321 F T F F F T F
+4322 F T F F F T F
+4323 F T F F F T F
+4324 F T F F F T F
+4325 F T F F F T F
+4326 F T F F F T F
+4327 F T F F F T F
+4328 F T F F F T F
+4329 F T F F F T F
+4330 F T F F F T F
+4331 F T F F F T F
+4332 F T F F F T F
+4333 F T F F F T F
+4334 F T F F F T F
+4335 F T F F F T F
+4336 F T F F F T F
+4337 F T F F F T F
+4338 F T F F F T F
+4339 F T F F F T F
+4340 F T F F F T F
+4341 F T F F F T F
+4342 F T F F F T F
+4343 F T F F F T F
+4344 F T F F F T F
+4345 F T F F F T F
+4346 F T F F F T F
+4347 F T F F F F F
+4348 F T F F F T F
+4349 F F F F F F F
+4350 F F F F F F F
+4351 F F F F F F F
+4352 F T F F F T F
+4353 F T F F F T F
+4354 F T F F F T F
+4355 F T F F F T F
+4356 F T F F F T F
+4357 F T F F F T F
+4358 F T F F F T F
+4359 F T F F F T F
+4360 F T F F F T F
+4361 F T F F F T F
+4362 F T F F F T F
+4363 F T F F F T F
+4364 F T F F F T F
+4365 F T F F F T F
+4366 F T F F F T F
+4367 F T F F F T F
+4368 F T F F F T F
+4369 F T F F F T F
+4370 F T F F F T F
+4371 F T F F F T F
+4372 F T F F F T F
+4373 F T F F F T F
+4374 F T F F F T F
+4375 F T F F F T F
+4376 F T F F F T F
+4377 F T F F F T F
+4378 F T F F F T F
+4379 F T F F F T F
+4380 F T F F F T F
+4381 F T F F F T F
+4382 F T F F F T F
+4383 F T F F F T F
+4384 F T F F F T F
+4385 F T F F F T F
+4386 F T F F F T F
+4387 F T F F F T F
+4388 F T F F F T F
+4389 F T F F F T F
+4390 F T F F F T F
+4391 F T F F F T F
+4392 F T F F F T F
+4393 F T F F F T F
+4394 F T F F F T F
+4395 F T F F F T F
+4396 F T F F F T F
+4397 F T F F F T F
+4398 F T F F F T F
+4399 F T F F F T F
+4400 F T F F F T F
+4401 F T F F F T F
+4402 F T F F F T F
+4403 F T F F F T F
+4404 F T F F F T F
+4405 F T F F F T F
+4406 F T F F F T F
+4407 F T F F F T F
+4408 F T F F F T F
+4409 F T F F F T F
+4410 F T F F F T F
+4411 F T F F F T F
+4412 F T F F F T F
+4413 F T F F F T F
+4414 F T F F F T F
+4415 F T F F F T F
+4416 F T F F F T F
+4417 F T F F F T F
+4418 F T F F F T F
+4419 F T F F F T F
+4420 F T F F F T F
+4421 F T F F F T F
+4422 F T F F F T F
+4423 F T F F F T F
+4424 F T F F F T F
+4425 F T F F F T F
+4426 F T F F F T F
+4427 F T F F F T F
+4428 F T F F F T F
+4429 F T F F F T F
+4430 F T F F F T F
+4431 F T F F F T F
+4432 F T F F F T F
+4433 F T F F F T F
+4434 F T F F F T F
+4435 F T F F F T F
+4436 F T F F F T F
+4437 F T F F F T F
+4438 F T F F F T F
+4439 F T F F F T F
+4440 F T F F F T F
+4441 F T F F F T F
+4442 F T F F F T F
+4443 F T F F F T F
+4444 F T F F F T F
+4445 F T F F F T F
+4446 F T F F F T F
+4447 F T F F F T F
+4448 F T F F F T F
+4449 F T F F F T F
+4450 F T F F F T F
+4451 F T F F F T F
+4452 F T F F F T F
+4453 F T F F F T F
+4454 F T F F F T F
+4455 F T F F F T F
+4456 F T F F F T F
+4457 F T F F F T F
+4458 F T F F F T F
+4459 F T F F F T F
+4460 F T F F F T F
+4461 F T F F F T F
+4462 F T F F F T F
+4463 F T F F F T F
+4464 F T F F F T F
+4465 F T F F F T F
+4466 F T F F F T F
+4467 F T F F F T F
+4468 F T F F F T F
+4469 F T F F F T F
+4470 F T F F F T F
+4471 F T F F F T F
+4472 F T F F F T F
+4473 F T F F F T F
+4474 F T F F F T F
+4475 F T F F F T F
+4476 F T F F F T F
+4477 F T F F F T F
+4478 F T F F F T F
+4479 F T F F F T F
+4480 F T F F F T F
+4481 F T F F F T F
+4482 F T F F F T F
+4483 F T F F F T F
+4484 F T F F F T F
+4485 F T F F F T F
+4486 F T F F F T F
+4487 F T F F F T F
+4488 F T F F F T F
+4489 F T F F F T F
+4490 F T F F F T F
+4491 F T F F F T F
+4492 F T F F F T F
+4493 F T F F F T F
+4494 F T F F F T F
+4495 F T F F F T F
+4496 F T F F F T F
+4497 F T F F F T F
+4498 F T F F F T F
+4499 F T F F F T F
+4500 F T F F F T F
+4501 F T F F F T F
+4502 F T F F F T F
+4503 F T F F F T F
+4504 F T F F F T F
+4505 F T F F F T F
+4506 F T F F F T F
+4507 F T F F F T F
+4508 F T F F F T F
+4509 F T F F F T F
+4510 F T F F F T F
+4511 F T F F F T F
+4512 F T F F F T F
+4513 F T F F F T F
+4514 F T F F F T F
+4515 F T F F F T F
+4516 F T F F F T F
+4517 F T F F F T F
+4518 F T F F F T F
+4519 F T F F F T F
+4520 F T F F F T F
+4521 F T F F F T F
+4522 F T F F F T F
+4523 F T F F F T F
+4524 F T F F F T F
+4525 F T F F F T F
+4526 F T F F F T F
+4527 F T F F F T F
+4528 F T F F F T F
+4529 F T F F F T F
+4530 F T F F F T F
+4531 F T F F F T F
+4532 F T F F F T F
+4533 F T F F F T F
+4534 F T F F F T F
+4535 F T F F F T F
+4536 F T F F F T F
+4537 F T F F F T F
+4538 F T F F F T F
+4539 F T F F F T F
+4540 F T F F F T F
+4541 F T F F F T F
+4542 F T F F F T F
+4543 F T F F F T F
+4544 F T F F F T F
+4545 F T F F F T F
+4546 F T F F F T F
+4547 F T F F F T F
+4548 F T F F F T F
+4549 F T F F F T F
+4550 F T F F F T F
+4551 F T F F F T F
+4552 F T F F F T F
+4553 F T F F F T F
+4554 F T F F F T F
+4555 F T F F F T F
+4556 F T F F F T F
+4557 F T F F F T F
+4558 F T F F F T F
+4559 F T F F F T F
+4560 F T F F F T F
+4561 F T F F F T F
+4562 F T F F F T F
+4563 F T F F F T F
+4564 F T F F F T F
+4565 F T F F F T F
+4566 F T F F F T F
+4567 F T F F F T F
+4568 F T F F F T F
+4569 F T F F F T F
+4570 F T F F F T F
+4571 F T F F F T F
+4572 F T F F F T F
+4573 F T F F F T F
+4574 F T F F F T F
+4575 F T F F F T F
+4576 F T F F F T F
+4577 F T F F F T F
+4578 F T F F F T F
+4579 F T F F F T F
+4580 F T F F F T F
+4581 F T F F F T F
+4582 F T F F F T F
+4583 F T F F F T F
+4584 F T F F F T F
+4585 F T F F F T F
+4586 F T F F F T F
+4587 F T F F F T F
+4588 F T F F F T F
+4589 F T F F F T F
+4590 F T F F F T F
+4591 F T F F F T F
+4592 F T F F F T F
+4593 F T F F F T F
+4594 F T F F F T F
+4595 F T F F F T F
+4596 F T F F F T F
+4597 F T F F F T F
+4598 F T F F F T F
+4599 F T F F F T F
+4600 F T F F F T F
+4601 F T F F F T F
+4602 F T F F F T F
+4603 F T F F F T F
+4604 F T F F F T F
+4605 F T F F F T F
+4606 F T F F F T F
+4607 F T F F F T F
+4608 F T F F F T F
+4609 F T F F F T F
+4610 F T F F F T F
+4611 F T F F F T F
+4612 F T F F F T F
+4613 F T F F F T F
+4614 F T F F F T F
+4615 F T F F F T F
+4616 F T F F F T F
+4617 F T F F F T F
+4618 F T F F F T F
+4619 F T F F F T F
+4620 F T F F F T F
+4621 F T F F F T F
+4622 F T F F F T F
+4623 F T F F F T F
+4624 F T F F F T F
+4625 F T F F F T F
+4626 F T F F F T F
+4627 F T F F F T F
+4628 F T F F F T F
+4629 F T F F F T F
+4630 F T F F F T F
+4631 F T F F F T F
+4632 F T F F F T F
+4633 F T F F F T F
+4634 F T F F F T F
+4635 F T F F F T F
+4636 F T F F F T F
+4637 F T F F F T F
+4638 F T F F F T F
+4639 F T F F F T F
+4640 F T F F F T F
+4641 F T F F F T F
+4642 F T F F F T F
+4643 F T F F F T F
+4644 F T F F F T F
+4645 F T F F F T F
+4646 F T F F F T F
+4647 F T F F F T F
+4648 F T F F F T F
+4649 F T F F F T F
+4650 F T F F F T F
+4651 F T F F F T F
+4652 F T F F F T F
+4653 F T F F F T F
+4654 F T F F F T F
+4655 F T F F F T F
+4656 F T F F F T F
+4657 F T F F F T F
+4658 F T F F F T F
+4659 F T F F F T F
+4660 F T F F F T F
+4661 F T F F F T F
+4662 F T F F F T F
+4663 F T F F F T F
+4664 F T F F F T F
+4665 F T F F F T F
+4666 F T F F F T F
+4667 F T F F F T F
+4668 F T F F F T F
+4669 F T F F F T F
+4670 F T F F F T F
+4671 F T F F F T F
+4672 F T F F F T F
+4673 F T F F F T F
+4674 F T F F F T F
+4675 F T F F F T F
+4676 F T F F F T F
+4677 F T F F F T F
+4678 F T F F F T F
+4679 F T F F F T F
+4680 F T F F F T F
+4681 F F F F F F F
+4682 F T F F F T F
+4683 F T F F F T F
+4684 F T F F F T F
+4685 F T F F F T F
+4686 F F F F F F F
+4687 F F F F F F F
+4688 F T F F F T F
+4689 F T F F F T F
+4690 F T F F F T F
+4691 F T F F F T F
+4692 F T F F F T F
+4693 F T F F F T F
+4694 F T F F F T F
+4695 F F F F F F F
+4696 F T F F F T F
+4697 F F F F F F F
+4698 F T F F F T F
+4699 F T F F F T F
+4700 F T F F F T F
+4701 F T F F F T F
+4702 F F F F F F F
+4703 F F F F F F F
+4704 F T F F F T F
+4705 F T F F F T F
+4706 F T F F F T F
+4707 F T F F F T F
+4708 F T F F F T F
+4709 F T F F F T F
+4710 F T F F F T F
+4711 F T F F F T F
+4712 F T F F F T F
+4713 F T F F F T F
+4714 F T F F F T F
+4715 F T F F F T F
+4716 F T F F F T F
+4717 F T F F F T F
+4718 F T F F F T F
+4719 F T F F F T F
+4720 F T F F F T F
+4721 F T F F F T F
+4722 F T F F F T F
+4723 F T F F F T F
+4724 F T F F F T F
+4725 F T F F F T F
+4726 F T F F F T F
+4727 F T F F F T F
+4728 F T F F F T F
+4729 F T F F F T F
+4730 F T F F F T F
+4731 F T F F F T F
+4732 F T F F F T F
+4733 F T F F F T F
+4734 F T F F F T F
+4735 F T F F F T F
+4736 F T F F F T F
+4737 F T F F F T F
+4738 F T F F F T F
+4739 F T F F F T F
+4740 F T F F F T F
+4741 F T F F F T F
+4742 F T F F F T F
+4743 F T F F F T F
+4744 F T F F F T F
+4745 F F F F F F F
+4746 F T F F F T F
+4747 F T F F F T F
+4748 F T F F F T F
+4749 F T F F F T F
+4750 F F F F F F F
+4751 F F F F F F F
+4752 F T F F F T F
+4753 F T F F F T F
+4754 F T F F F T F
+4755 F T F F F T F
+4756 F T F F F T F
+4757 F T F F F T F
+4758 F T F F F T F
+4759 F T F F F T F
+4760 F T F F F T F
+4761 F T F F F T F
+4762 F T F F F T F
+4763 F T F F F T F
+4764 F T F F F T F
+4765 F T F F F T F
+4766 F T F F F T F
+4767 F T F F F T F
+4768 F T F F F T F
+4769 F T F F F T F
+4770 F T F F F T F
+4771 F T F F F T F
+4772 F T F F F T F
+4773 F T F F F T F
+4774 F T F F F T F
+4775 F T F F F T F
+4776 F T F F F T F
+4777 F T F F F T F
+4778 F T F F F T F
+4779 F T F F F T F
+4780 F T F F F T F
+4781 F T F F F T F
+4782 F T F F F T F
+4783 F T F F F T F
+4784 F T F F F T F
+4785 F F F F F F F
+4786 F T F F F T F
+4787 F T F F F T F
+4788 F T F F F T F
+4789 F T F F F T F
+4790 F F F F F F F
+4791 F F F F F F F
+4792 F T F F F T F
+4793 F T F F F T F
+4794 F T F F F T F
+4795 F T F F F T F
+4796 F T F F F T F
+4797 F T F F F T F
+4798 F T F F F T F
+4799 F F F F F F F
+4800 F T F F F T F
+4801 F F F F F F F
+4802 F T F F F T F
+4803 F T F F F T F
+4804 F T F F F T F
+4805 F T F F F T F
+4806 F F F F F F F
+4807 F F F F F F F
+4808 F T F F F T F
+4809 F T F F F T F
+4810 F T F F F T F
+4811 F T F F F T F
+4812 F T F F F T F
+4813 F T F F F T F
+4814 F T F F F T F
+4815 F T F F F T F
+4816 F T F F F T F
+4817 F T F F F T F
+4818 F T F F F T F
+4819 F T F F F T F
+4820 F T F F F T F
+4821 F T F F F T F
+4822 F T F F F T F
+4823 F F F F F F F
+4824 F T F F F T F
+4825 F T F F F T F
+4826 F T F F F T F
+4827 F T F F F T F
+4828 F T F F F T F
+4829 F T F F F T F
+4830 F T F F F T F
+4831 F T F F F T F
+4832 F T F F F T F
+4833 F T F F F T F
+4834 F T F F F T F
+4835 F T F F F T F
+4836 F T F F F T F
+4837 F T F F F T F
+4838 F T F F F T F
+4839 F T F F F T F
+4840 F T F F F T F
+4841 F T F F F T F
+4842 F T F F F T F
+4843 F T F F F T F
+4844 F T F F F T F
+4845 F T F F F T F
+4846 F T F F F T F
+4847 F T F F F T F
+4848 F T F F F T F
+4849 F T F F F T F
+4850 F T F F F T F
+4851 F T F F F T F
+4852 F T F F F T F
+4853 F T F F F T F
+4854 F T F F F T F
+4855 F T F F F T F
+4856 F T F F F T F
+4857 F T F F F T F
+4858 F T F F F T F
+4859 F T F F F T F
+4860 F T F F F T F
+4861 F T F F F T F
+4862 F T F F F T F
+4863 F T F F F T F
+4864 F T F F F T F
+4865 F T F F F T F
+4866 F T F F F T F
+4867 F T F F F T F
+4868 F T F F F T F
+4869 F T F F F T F
+4870 F T F F F T F
+4871 F T F F F T F
+4872 F T F F F T F
+4873 F T F F F T F
+4874 F T F F F T F
+4875 F T F F F T F
+4876 F T F F F T F
+4877 F T F F F T F
+4878 F T F F F T F
+4879 F T F F F T F
+4880 F T F F F T F
+4881 F F F F F F F
+4882 F T F F F T F
+4883 F T F F F T F
+4884 F T F F F T F
+4885 F T F F F T F
+4886 F F F F F F F
+4887 F F F F F F F
+4888 F T F F F T F
+4889 F T F F F T F
+4890 F T F F F T F
+4891 F T F F F T F
+4892 F T F F F T F
+4893 F T F F F T F
+4894 F T F F F T F
+4895 F T F F F T F
+4896 F T F F F T F
+4897 F T F F F T F
+4898 F T F F F T F
+4899 F T F F F T F
+4900 F T F F F T F
+4901 F T F F F T F
+4902 F T F F F T F
+4903 F T F F F T F
+4904 F T F F F T F
+4905 F T F F F T F
+4906 F T F F F T F
+4907 F T F F F T F
+4908 F T F F F T F
+4909 F T F F F T F
+4910 F T F F F T F
+4911 F T F F F T F
+4912 F T F F F T F
+4913 F T F F F T F
+4914 F T F F F T F
+4915 F T F F F T F
+4916 F T F F F T F
+4917 F T F F F T F
+4918 F T F F F T F
+4919 F T F F F T F
+4920 F T F F F T F
+4921 F T F F F T F
+4922 F T F F F T F
+4923 F T F F F T F
+4924 F T F F F T F
+4925 F T F F F T F
+4926 F T F F F T F
+4927 F T F F F T F
+4928 F T F F F T F
+4929 F T F F F T F
+4930 F T F F F T F
+4931 F T F F F T F
+4932 F T F F F T F
+4933 F T F F F T F
+4934 F T F F F T F
+4935 F T F F F T F
+4936 F T F F F T F
+4937 F T F F F T F
+4938 F T F F F T F
+4939 F T F F F T F
+4940 F T F F F T F
+4941 F T F F F T F
+4942 F T F F F T F
+4943 F T F F F T F
+4944 F T F F F T F
+4945 F T F F F T F
+4946 F T F F F T F
+4947 F T F F F T F
+4948 F T F F F T F
+4949 F T F F F T F
+4950 F T F F F T F
+4951 F T F F F T F
+4952 F T F F F T F
+4953 F T F F F T F
+4954 F T F F F T F
+4955 F F F F F F F
+4956 F F F F F F F
+4957 F T F F F F F
+4958 F T F F F F F
+4959 F T F F F F F
+4960 F T F F F F F
+4961 F T F F F F F
+4962 F T F F F F F
+4963 F T F F F F F
+4964 F T F F F F F
+4965 F T F F F F F
+4966 F T F F F F F
+4967 F T F F F F F
+4968 F T F F F F F
+4969 F T F F F F F
+4970 F T F F F F F
+4971 F T F F F F F
+4972 F T F F F F F
+4973 F T F F F F F
+4974 F T F F F F F
+4975 F T F F F F F
+4976 F T F F F F F
+4977 F T F F F F F
+4978 F T F F F F F
+4979 F T F F F F F
+4980 F T F F F F F
+4981 F T F F F F F
+4982 F T F F F F F
+4983 F T F F F F F
+4984 F T F F F F F
+4985 F T F F F F F
+4986 F T F F F F F
+4987 F T F F F F F
+4988 F T F F F F F
+4989 F F F F F F F
+4990 F F F F F F F
+4991 F F F F F F F
+4992 F T F F F T F
+4993 F T F F F T F
+4994 F T F F F T F
+4995 F T F F F T F
+4996 F T F F F T F
+4997 F T F F F T F
+4998 F T F F F T F
+4999 F T F F F T F
+5000 F T F F F T F
+5001 F T F F F T F
+5002 F T F F F T F
+5003 F T F F F T F
+5004 F T F F F T F
+5005 F T F F F T F
+5006 F T F F F T F
+5007 F T F F F T F
+5008 F T F F F F F
+5009 F T F F F F F
+5010 F T F F F F F
+5011 F T F F F F F
+5012 F T F F F F F
+5013 F T F F F F F
+5014 F T F F F F F
+5015 F T F F F F F
+5016 F T F F F F F
+5017 F T F F F F F
+5018 F F F F F F F
+5019 F F F F F F F
+5020 F F F F F F F
+5021 F F F F F F F
+5022 F F F F F F F
+5023 F F F F F F F
+5024 F T F F F T F
+5025 F T F F F T F
+5026 F T F F F T F
+5027 F T F F F T F
+5028 F T F F F T F
+5029 F T F F F T F
+5030 F T F F F T F
+5031 F T F F F T F
+5032 F T F F F T F
+5033 F T F F F T F
+5034 F T F F F T F
+5035 F T F F F T F
+5036 F T F F F T F
+5037 F T F F F T F
+5038 F T F F F T F
+5039 F T F F F T F
+5040 F T F F F T F
+5041 F T F F F T F
+5042 F T F F F T F
+5043 F T F F F T F
+5044 F T F F F T F
+5045 F T F F F T F
+5046 F T F F F T F
+5047 F T F F F T F
+5048 F T F F F T F
+5049 F T F F F T F
+5050 F T F F F T F
+5051 F T F F F T F
+5052 F T F F F T F
+5053 F T F F F T F
+5054 F T F F F T F
+5055 F T F F F T F
+5056 F T F F F T F
+5057 F T F F F T F
+5058 F T F F F T F
+5059 F T F F F T F
+5060 F T F F F T F
+5061 F T F F F T F
+5062 F T F F F T F
+5063 F T F F F T F
+5064 F T F F F T F
+5065 F T F F F T F
+5066 F T F F F T F
+5067 F T F F F T F
+5068 F T F F F T F
+5069 F T F F F T F
+5070 F T F F F T F
+5071 F T F F F T F
+5072 F T F F F T F
+5073 F T F F F T F
+5074 F T F F F T F
+5075 F T F F F T F
+5076 F T F F F T F
+5077 F T F F F T F
+5078 F T F F F T F
+5079 F T F F F T F
+5080 F T F F F T F
+5081 F T F F F T F
+5082 F T F F F T F
+5083 F T F F F T F
+5084 F T F F F T F
+5085 F T F F F T F
+5086 F T F F F T F
+5087 F T F F F T F
+5088 F T F F F T F
+5089 F T F F F T F
+5090 F T F F F T F
+5091 F T F F F T F
+5092 F T F F F T F
+5093 F T F F F T F
+5094 F T F F F T F
+5095 F T F F F T F
+5096 F T F F F T F
+5097 F T F F F T F
+5098 F T F F F T F
+5099 F T F F F T F
+5100 F T F F F T F
+5101 F T F F F T F
+5102 F T F F F T F
+5103 F T F F F T F
+5104 F T F F F T F
+5105 F T F F F T F
+5106 F T F F F T F
+5107 F T F F F T F
+5108 F T F F F T F
+5109 F F F F F F F
+5110 F F F F F F F
+5111 F F F F F F F
+5112 F F F F F F F
+5113 F F F F F F F
+5114 F F F F F F F
+5115 F F F F F F F
+5116 F F F F F F F
+5117 F F F F F F F
+5118 F F F F F F F
+5119 F F F F F F F
+5120 F T F F F F F
+5121 F T F F F T F
+5122 F T F F F T F
+5123 F T F F F T F
+5124 F T F F F T F
+5125 F T F F F T F
+5126 F T F F F T F
+5127 F T F F F T F
+5128 F T F F F T F
+5129 F T F F F T F
+5130 F T F F F T F
+5131 F T F F F T F
+5132 F T F F F T F
+5133 F T F F F T F
+5134 F T F F F T F
+5135 F T F F F T F
+5136 F T F F F T F
+5137 F T F F F T F
+5138 F T F F F T F
+5139 F T F F F T F
+5140 F T F F F T F
+5141 F T F F F T F
+5142 F T F F F T F
+5143 F T F F F T F
+5144 F T F F F T F
+5145 F T F F F T F
+5146 F T F F F T F
+5147 F T F F F T F
+5148 F T F F F T F
+5149 F T F F F T F
+5150 F T F F F T F
+5151 F T F F F T F
+5152 F T F F F T F
+5153 F T F F F T F
+5154 F T F F F T F
+5155 F T F F F T F
+5156 F T F F F T F
+5157 F T F F F T F
+5158 F T F F F T F
+5159 F T F F F T F
+5160 F T F F F T F
+5161 F T F F F T F
+5162 F T F F F T F
+5163 F T F F F T F
+5164 F T F F F T F
+5165 F T F F F T F
+5166 F T F F F T F
+5167 F T F F F T F
+5168 F T F F F T F
+5169 F T F F F T F
+5170 F T F F F T F
+5171 F T F F F T F
+5172 F T F F F T F
+5173 F T F F F T F
+5174 F T F F F T F
+5175 F T F F F T F
+5176 F T F F F T F
+5177 F T F F F T F
+5178 F T F F F T F
+5179 F T F F F T F
+5180 F T F F F T F
+5181 F T F F F T F
+5182 F T F F F T F
+5183 F T F F F T F
+5184 F T F F F T F
+5185 F T F F F T F
+5186 F T F F F T F
+5187 F T F F F T F
+5188 F T F F F T F
+5189 F T F F F T F
+5190 F T F F F T F
+5191 F T F F F T F
+5192 F T F F F T F
+5193 F T F F F T F
+5194 F T F F F T F
+5195 F T F F F T F
+5196 F T F F F T F
+5197 F T F F F T F
+5198 F T F F F T F
+5199 F T F F F T F
+5200 F T F F F T F
+5201 F T F F F T F
+5202 F T F F F T F
+5203 F T F F F T F
+5204 F T F F F T F
+5205 F T F F F T F
+5206 F T F F F T F
+5207 F T F F F T F
+5208 F T F F F T F
+5209 F T F F F T F
+5210 F T F F F T F
+5211 F T F F F T F
+5212 F T F F F T F
+5213 F T F F F T F
+5214 F T F F F T F
+5215 F T F F F T F
+5216 F T F F F T F
+5217 F T F F F T F
+5218 F T F F F T F
+5219 F T F F F T F
+5220 F T F F F T F
+5221 F T F F F T F
+5222 F T F F F T F
+5223 F T F F F T F
+5224 F T F F F T F
+5225 F T F F F T F
+5226 F T F F F T F
+5227 F T F F F T F
+5228 F T F F F T F
+5229 F T F F F T F
+5230 F T F F F T F
+5231 F T F F F T F
+5232 F T F F F T F
+5233 F T F F F T F
+5234 F T F F F T F
+5235 F T F F F T F
+5236 F T F F F T F
+5237 F T F F F T F
+5238 F T F F F T F
+5239 F T F F F T F
+5240 F T F F F T F
+5241 F T F F F T F
+5242 F T F F F T F
+5243 F T F F F T F
+5244 F T F F F T F
+5245 F T F F F T F
+5246 F T F F F T F
+5247 F T F F F T F
+5248 F T F F F T F
+5249 F T F F F T F
+5250 F T F F F T F
+5251 F T F F F T F
+5252 F T F F F T F
+5253 F T F F F T F
+5254 F T F F F T F
+5255 F T F F F T F
+5256 F T F F F T F
+5257 F T F F F T F
+5258 F T F F F T F
+5259 F T F F F T F
+5260 F T F F F T F
+5261 F T F F F T F
+5262 F T F F F T F
+5263 F T F F F T F
+5264 F T F F F T F
+5265 F T F F F T F
+5266 F T F F F T F
+5267 F T F F F T F
+5268 F T F F F T F
+5269 F T F F F T F
+5270 F T F F F T F
+5271 F T F F F T F
+5272 F T F F F T F
+5273 F T F F F T F
+5274 F T F F F T F
+5275 F T F F F T F
+5276 F T F F F T F
+5277 F T F F F T F
+5278 F T F F F T F
+5279 F T F F F T F
+5280 F T F F F T F
+5281 F T F F F T F
+5282 F T F F F T F
+5283 F T F F F T F
+5284 F T F F F T F
+5285 F T F F F T F
+5286 F T F F F T F
+5287 F T F F F T F
+5288 F T F F F T F
+5289 F T F F F T F
+5290 F T F F F T F
+5291 F T F F F T F
+5292 F T F F F T F
+5293 F T F F F T F
+5294 F T F F F T F
+5295 F T F F F T F
+5296 F T F F F T F
+5297 F T F F F T F
+5298 F T F F F T F
+5299 F T F F F T F
+5300 F T F F F T F
+5301 F T F F F T F
+5302 F T F F F T F
+5303 F T F F F T F
+5304 F T F F F T F
+5305 F T F F F T F
+5306 F T F F F T F
+5307 F T F F F T F
+5308 F T F F F T F
+5309 F T F F F T F
+5310 F T F F F T F
+5311 F T F F F T F
+5312 F T F F F T F
+5313 F T F F F T F
+5314 F T F F F T F
+5315 F T F F F T F
+5316 F T F F F T F
+5317 F T F F F T F
+5318 F T F F F T F
+5319 F T F F F T F
+5320 F T F F F T F
+5321 F T F F F T F
+5322 F T F F F T F
+5323 F T F F F T F
+5324 F T F F F T F
+5325 F T F F F T F
+5326 F T F F F T F
+5327 F T F F F T F
+5328 F T F F F T F
+5329 F T F F F T F
+5330 F T F F F T F
+5331 F T F F F T F
+5332 F T F F F T F
+5333 F T F F F T F
+5334 F T F F F T F
+5335 F T F F F T F
+5336 F T F F F T F
+5337 F T F F F T F
+5338 F T F F F T F
+5339 F T F F F T F
+5340 F T F F F T F
+5341 F T F F F T F
+5342 F T F F F T F
+5343 F T F F F T F
+5344 F T F F F T F
+5345 F T F F F T F
+5346 F T F F F T F
+5347 F T F F F T F
+5348 F T F F F T F
+5349 F T F F F T F
+5350 F T F F F T F
+5351 F T F F F T F
+5352 F T F F F T F
+5353 F T F F F T F
+5354 F T F F F T F
+5355 F T F F F T F
+5356 F T F F F T F
+5357 F T F F F T F
+5358 F T F F F T F
+5359 F T F F F T F
+5360 F T F F F T F
+5361 F T F F F T F
+5362 F T F F F T F
+5363 F T F F F T F
+5364 F T F F F T F
+5365 F T F F F T F
+5366 F T F F F T F
+5367 F T F F F T F
+5368 F T F F F T F
+5369 F T F F F T F
+5370 F T F F F T F
+5371 F T F F F T F
+5372 F T F F F T F
+5373 F T F F F T F
+5374 F T F F F T F
+5375 F T F F F T F
+5376 F T F F F T F
+5377 F T F F F T F
+5378 F T F F F T F
+5379 F T F F F T F
+5380 F T F F F T F
+5381 F T F F F T F
+5382 F T F F F T F
+5383 F T F F F T F
+5384 F T F F F T F
+5385 F T F F F T F
+5386 F T F F F T F
+5387 F T F F F T F
+5388 F T F F F T F
+5389 F T F F F T F
+5390 F T F F F T F
+5391 F T F F F T F
+5392 F T F F F T F
+5393 F T F F F T F
+5394 F T F F F T F
+5395 F T F F F T F
+5396 F T F F F T F
+5397 F T F F F T F
+5398 F T F F F T F
+5399 F T F F F T F
+5400 F T F F F T F
+5401 F T F F F T F
+5402 F T F F F T F
+5403 F T F F F T F
+5404 F T F F F T F
+5405 F T F F F T F
+5406 F T F F F T F
+5407 F T F F F T F
+5408 F T F F F T F
+5409 F T F F F T F
+5410 F T F F F T F
+5411 F T F F F T F
+5412 F T F F F T F
+5413 F T F F F T F
+5414 F T F F F T F
+5415 F T F F F T F
+5416 F T F F F T F
+5417 F T F F F T F
+5418 F T F F F T F
+5419 F T F F F T F
+5420 F T F F F T F
+5421 F T F F F T F
+5422 F T F F F T F
+5423 F T F F F T F
+5424 F T F F F T F
+5425 F T F F F T F
+5426 F T F F F T F
+5427 F T F F F T F
+5428 F T F F F T F
+5429 F T F F F T F
+5430 F T F F F T F
+5431 F T F F F T F
+5432 F T F F F T F
+5433 F T F F F T F
+5434 F T F F F T F
+5435 F T F F F T F
+5436 F T F F F T F
+5437 F T F F F T F
+5438 F T F F F T F
+5439 F T F F F T F
+5440 F T F F F T F
+5441 F T F F F T F
+5442 F T F F F T F
+5443 F T F F F T F
+5444 F T F F F T F
+5445 F T F F F T F
+5446 F T F F F T F
+5447 F T F F F T F
+5448 F T F F F T F
+5449 F T F F F T F
+5450 F T F F F T F
+5451 F T F F F T F
+5452 F T F F F T F
+5453 F T F F F T F
+5454 F T F F F T F
+5455 F T F F F T F
+5456 F T F F F T F
+5457 F T F F F T F
+5458 F T F F F T F
+5459 F T F F F T F
+5460 F T F F F T F
+5461 F T F F F T F
+5462 F T F F F T F
+5463 F T F F F T F
+5464 F T F F F T F
+5465 F T F F F T F
+5466 F T F F F T F
+5467 F T F F F T F
+5468 F T F F F T F
+5469 F T F F F T F
+5470 F T F F F T F
+5471 F T F F F T F
+5472 F T F F F T F
+5473 F T F F F T F
+5474 F T F F F T F
+5475 F T F F F T F
+5476 F T F F F T F
+5477 F T F F F T F
+5478 F T F F F T F
+5479 F T F F F T F
+5480 F T F F F T F
+5481 F T F F F T F
+5482 F T F F F T F
+5483 F T F F F T F
+5484 F T F F F T F
+5485 F T F F F T F
+5486 F T F F F T F
+5487 F T F F F T F
+5488 F T F F F T F
+5489 F T F F F T F
+5490 F T F F F T F
+5491 F T F F F T F
+5492 F T F F F T F
+5493 F T F F F T F
+5494 F T F F F T F
+5495 F T F F F T F
+5496 F T F F F T F
+5497 F T F F F T F
+5498 F T F F F T F
+5499 F T F F F T F
+5500 F T F F F T F
+5501 F T F F F T F
+5502 F T F F F T F
+5503 F T F F F T F
+5504 F T F F F T F
+5505 F T F F F T F
+5506 F T F F F T F
+5507 F T F F F T F
+5508 F T F F F T F
+5509 F T F F F T F
+5510 F T F F F T F
+5511 F T F F F T F
+5512 F T F F F T F
+5513 F T F F F T F
+5514 F T F F F T F
+5515 F T F F F T F
+5516 F T F F F T F
+5517 F T F F F T F
+5518 F T F F F T F
+5519 F T F F F T F
+5520 F T F F F T F
+5521 F T F F F T F
+5522 F T F F F T F
+5523 F T F F F T F
+5524 F T F F F T F
+5525 F T F F F T F
+5526 F T F F F T F
+5527 F T F F F T F
+5528 F T F F F T F
+5529 F T F F F T F
+5530 F T F F F T F
+5531 F T F F F T F
+5532 F T F F F T F
+5533 F T F F F T F
+5534 F T F F F T F
+5535 F T F F F T F
+5536 F T F F F T F
+5537 F T F F F T F
+5538 F T F F F T F
+5539 F T F F F T F
+5540 F T F F F T F
+5541 F T F F F T F
+5542 F T F F F T F
+5543 F T F F F T F
+5544 F T F F F T F
+5545 F T F F F T F
+5546 F T F F F T F
+5547 F T F F F T F
+5548 F T F F F T F
+5549 F T F F F T F
+5550 F T F F F T F
+5551 F T F F F T F
+5552 F T F F F T F
+5553 F T F F F T F
+5554 F T F F F T F
+5555 F T F F F T F
+5556 F T F F F T F
+5557 F T F F F T F
+5558 F T F F F T F
+5559 F T F F F T F
+5560 F T F F F T F
+5561 F T F F F T F
+5562 F T F F F T F
+5563 F T F F F T F
+5564 F T F F F T F
+5565 F T F F F T F
+5566 F T F F F T F
+5567 F T F F F T F
+5568 F T F F F T F
+5569 F T F F F T F
+5570 F T F F F T F
+5571 F T F F F T F
+5572 F T F F F T F
+5573 F T F F F T F
+5574 F T F F F T F
+5575 F T F F F T F
+5576 F T F F F T F
+5577 F T F F F T F
+5578 F T F F F T F
+5579 F T F F F T F
+5580 F T F F F T F
+5581 F T F F F T F
+5582 F T F F F T F
+5583 F T F F F T F
+5584 F T F F F T F
+5585 F T F F F T F
+5586 F T F F F T F
+5587 F T F F F T F
+5588 F T F F F T F
+5589 F T F F F T F
+5590 F T F F F T F
+5591 F T F F F T F
+5592 F T F F F T F
+5593 F T F F F T F
+5594 F T F F F T F
+5595 F T F F F T F
+5596 F T F F F T F
+5597 F T F F F T F
+5598 F T F F F T F
+5599 F T F F F T F
+5600 F T F F F T F
+5601 F T F F F T F
+5602 F T F F F T F
+5603 F T F F F T F
+5604 F T F F F T F
+5605 F T F F F T F
+5606 F T F F F T F
+5607 F T F F F T F
+5608 F T F F F T F
+5609 F T F F F T F
+5610 F T F F F T F
+5611 F T F F F T F
+5612 F T F F F T F
+5613 F T F F F T F
+5614 F T F F F T F
+5615 F T F F F T F
+5616 F T F F F T F
+5617 F T F F F T F
+5618 F T F F F T F
+5619 F T F F F T F
+5620 F T F F F T F
+5621 F T F F F T F
+5622 F T F F F T F
+5623 F T F F F T F
+5624 F T F F F T F
+5625 F T F F F T F
+5626 F T F F F T F
+5627 F T F F F T F
+5628 F T F F F T F
+5629 F T F F F T F
+5630 F T F F F T F
+5631 F T F F F T F
+5632 F T F F F T F
+5633 F T F F F T F
+5634 F T F F F T F
+5635 F T F F F T F
+5636 F T F F F T F
+5637 F T F F F T F
+5638 F T F F F T F
+5639 F T F F F T F
+5640 F T F F F T F
+5641 F T F F F T F
+5642 F T F F F T F
+5643 F T F F F T F
+5644 F T F F F T F
+5645 F T F F F T F
+5646 F T F F F T F
+5647 F T F F F T F
+5648 F T F F F T F
+5649 F T F F F T F
+5650 F T F F F T F
+5651 F T F F F T F
+5652 F T F F F T F
+5653 F T F F F T F
+5654 F T F F F T F
+5655 F T F F F T F
+5656 F T F F F T F
+5657 F T F F F T F
+5658 F T F F F T F
+5659 F T F F F T F
+5660 F T F F F T F
+5661 F T F F F T F
+5662 F T F F F T F
+5663 F T F F F T F
+5664 F T F F F T F
+5665 F T F F F T F
+5666 F T F F F T F
+5667 F T F F F T F
+5668 F T F F F T F
+5669 F T F F F T F
+5670 F T F F F T F
+5671 F T F F F T F
+5672 F T F F F T F
+5673 F T F F F T F
+5674 F T F F F T F
+5675 F T F F F T F
+5676 F T F F F T F
+5677 F T F F F T F
+5678 F T F F F T F
+5679 F T F F F T F
+5680 F T F F F T F
+5681 F T F F F T F
+5682 F T F F F T F
+5683 F T F F F T F
+5684 F T F F F T F
+5685 F T F F F T F
+5686 F T F F F T F
+5687 F T F F F T F
+5688 F T F F F T F
+5689 F T F F F T F
+5690 F T F F F T F
+5691 F T F F F T F
+5692 F T F F F T F
+5693 F T F F F T F
+5694 F T F F F T F
+5695 F T F F F T F
+5696 F T F F F T F
+5697 F T F F F T F
+5698 F T F F F T F
+5699 F T F F F T F
+5700 F T F F F T F
+5701 F T F F F T F
+5702 F T F F F T F
+5703 F T F F F T F
+5704 F T F F F T F
+5705 F T F F F T F
+5706 F T F F F T F
+5707 F T F F F T F
+5708 F T F F F T F
+5709 F T F F F T F
+5710 F T F F F T F
+5711 F T F F F T F
+5712 F T F F F T F
+5713 F T F F F T F
+5714 F T F F F T F
+5715 F T F F F T F
+5716 F T F F F T F
+5717 F T F F F T F
+5718 F T F F F T F
+5719 F T F F F T F
+5720 F T F F F T F
+5721 F T F F F T F
+5722 F T F F F T F
+5723 F T F F F T F
+5724 F T F F F T F
+5725 F T F F F T F
+5726 F T F F F T F
+5727 F T F F F T F
+5728 F T F F F T F
+5729 F T F F F T F
+5730 F T F F F T F
+5731 F T F F F T F
+5732 F T F F F T F
+5733 F T F F F T F
+5734 F T F F F T F
+5735 F T F F F T F
+5736 F T F F F T F
+5737 F T F F F T F
+5738 F T F F F T F
+5739 F T F F F T F
+5740 F T F F F T F
+5741 F T F F F F F
+5742 F T F F F F F
+5743 F T F F F T F
+5744 F T F F F T F
+5745 F T F F F T F
+5746 F T F F F T F
+5747 F T F F F T F
+5748 F T F F F T F
+5749 F T F F F T F
+5750 F T F F F T F
+5751 F T F F F T F
+5752 F T F F F T F
+5753 F T F F F T F
+5754 F T F F F T F
+5755 F T F F F T F
+5756 F T F F F T F
+5757 F T F F F T F
+5758 F T F F F T F
+5759 F T F F F T F
+5760 F T T F F F F
+5761 F T F F F T F
+5762 F T F F F T F
+5763 F T F F F T F
+5764 F T F F F T F
+5765 F T F F F T F
+5766 F T F F F T F
+5767 F T F F F T F
+5768 F T F F F T F
+5769 F T F F F T F
+5770 F T F F F T F
+5771 F T F F F T F
+5772 F T F F F T F
+5773 F T F F F T F
+5774 F T F F F T F
+5775 F T F F F T F
+5776 F T F F F T F
+5777 F T F F F T F
+5778 F T F F F T F
+5779 F T F F F T F
+5780 F T F F F T F
+5781 F T F F F T F
+5782 F T F F F T F
+5783 F T F F F T F
+5784 F T F F F T F
+5785 F T F F F T F
+5786 F T F F F T F
+5787 F T F F F F F
+5788 F T F F F F F
+5789 F F F F F F F
+5790 F F F F F F F
+5791 F F F F F F F
+5792 F T F F F T F
+5793 F T F F F T F
+5794 F T F F F T F
+5795 F T F F F T F
+5796 F T F F F T F
+5797 F T F F F T F
+5798 F T F F F T F
+5799 F T F F F T F
+5800 F T F F F T F
+5801 F T F F F T F
+5802 F T F F F T F
+5803 F T F F F T F
+5804 F T F F F T F
+5805 F T F F F T F
+5806 F T F F F T F
+5807 F T F F F T F
+5808 F T F F F T F
+5809 F T F F F T F
+5810 F T F F F T F
+5811 F T F F F T F
+5812 F T F F F T F
+5813 F T F F F T F
+5814 F T F F F T F
+5815 F T F F F T F
+5816 F T F F F T F
+5817 F T F F F T F
+5818 F T F F F T F
+5819 F T F F F T F
+5820 F T F F F T F
+5821 F T F F F T F
+5822 F T F F F T F
+5823 F T F F F T F
+5824 F T F F F T F
+5825 F T F F F T F
+5826 F T F F F T F
+5827 F T F F F T F
+5828 F T F F F T F
+5829 F T F F F T F
+5830 F T F F F T F
+5831 F T F F F T F
+5832 F T F F F T F
+5833 F T F F F T F
+5834 F T F F F T F
+5835 F T F F F T F
+5836 F T F F F T F
+5837 F T F F F T F
+5838 F T F F F T F
+5839 F T F F F T F
+5840 F T F F F T F
+5841 F T F F F T F
+5842 F T F F F T F
+5843 F T F F F T F
+5844 F T F F F T F
+5845 F T F F F T F
+5846 F T F F F T F
+5847 F T F F F T F
+5848 F T F F F T F
+5849 F T F F F T F
+5850 F T F F F T F
+5851 F T F F F T F
+5852 F T F F F T F
+5853 F T F F F T F
+5854 F T F F F T F
+5855 F T F F F T F
+5856 F T F F F T F
+5857 F T F F F T F
+5858 F T F F F T F
+5859 F T F F F T F
+5860 F T F F F T F
+5861 F T F F F T F
+5862 F T F F F T F
+5863 F T F F F T F
+5864 F T F F F T F
+5865 F T F F F T F
+5866 F T F F F T F
+5867 F T F F F F F
+5868 F T F F F F F
+5869 F T F F F F F
+5870 F T F F F F F
+5871 F T F F F F F
+5872 F T F F F F F
+5873 F F F F F F F
+5874 F F F F F F F
+5875 F F F F F F F
+5876 F F F F F F F
+5877 F F F F F F F
+5878 F F F F F F F
+5879 F F F F F F F
+5880 F F F F F F F
+5881 F F F F F F F
+5882 F F F F F F F
+5883 F F F F F F F
+5884 F F F F F F F
+5885 F F F F F F F
+5886 F F F F F F F
+5887 F F F F F F F
+5888 F T F F F T F
+5889 F T F F F T F
+5890 F T F F F T F
+5891 F T F F F T F
+5892 F T F F F T F
+5893 F T F F F T F
+5894 F T F F F T F
+5895 F T F F F T F
+5896 F T F F F T F
+5897 F T F F F T F
+5898 F T F F F T F
+5899 F T F F F T F
+5900 F T F F F T F
+5901 F F F F F F F
+5902 F T F F F T F
+5903 F T F F F T F
+5904 F T F F F T F
+5905 F T F F F T F
+5906 F T F F F F F
+5907 F T F F F F F
+5908 F T F F F F F
+5909 F F F F F F F
+5910 F F F F F F F
+5911 F F F F F F F
+5912 F F F F F F F
+5913 F F F F F F F
+5914 F F F F F F F
+5915 F F F F F F F
+5916 F F F F F F F
+5917 F F F F F F F
+5918 F F F F F F F
+5919 F F F F F F F
+5920 F T F F F T F
+5921 F T F F F T F
+5922 F T F F F T F
+5923 F T F F F T F
+5924 F T F F F T F
+5925 F T F F F T F
+5926 F T F F F T F
+5927 F T F F F T F
+5928 F T F F F T F
+5929 F T F F F T F
+5930 F T F F F T F
+5931 F T F F F T F
+5932 F T F F F T F
+5933 F T F F F T F
+5934 F T F F F T F
+5935 F T F F F T F
+5936 F T F F F T F
+5937 F T F F F T F
+5938 F T F F F F F
+5939 F T F F F F F
+5940 F T F F F F F
+5941 F T F F F F F
+5942 F T F F F F F
+5943 F F F F F F F
+5944 F F F F F F F
+5945 F F F F F F F
+5946 F F F F F F F
+5947 F F F F F F F
+5948 F F F F F F F
+5949 F F F F F F F
+5950 F F F F F F F
+5951 F F F F F F F
+5952 F T F F F T F
+5953 F T F F F T F
+5954 F T F F F T F
+5955 F T F F F T F
+5956 F T F F F T F
+5957 F T F F F T F
+5958 F T F F F T F
+5959 F T F F F T F
+5960 F T F F F T F
+5961 F T F F F T F
+5962 F T F F F T F
+5963 F T F F F T F
+5964 F T F F F T F
+5965 F T F F F T F
+5966 F T F F F T F
+5967 F T F F F T F
+5968 F T F F F T F
+5969 F T F F F T F
+5970 F T F F F F F
+5971 F T F F F F F
+5972 F F F F F F F
+5973 F F F F F F F
+5974 F F F F F F F
+5975 F F F F F F F
+5976 F F F F F F F
+5977 F F F F F F F
+5978 F F F F F F F
+5979 F F F F F F F
+5980 F F F F F F F
+5981 F F F F F F F
+5982 F F F F F F F
+5983 F F F F F F F
+5984 F T F F F T F
+5985 F T F F F T F
+5986 F T F F F T F
+5987 F T F F F T F
+5988 F T F F F T F
+5989 F T F F F T F
+5990 F T F F F T F
+5991 F T F F F T F
+5992 F T F F F T F
+5993 F T F F F T F
+5994 F T F F F T F
+5995 F T F F F T F
+5996 F T F F F T F
+5997 F F F F F F F
+5998 F T F F F T F
+5999 F T F F F T F
+6000 F T F F F T F
+6001 F F F F F F F
+6002 F T F F F F F
+6003 F T F F F F F
+6004 F F F F F F F
+6005 F F F F F F F
+6006 F F F F F F F
+6007 F F F F F F F
+6008 F F F F F F F
+6009 F F F F F F F
+6010 F F F F F F F
+6011 F F F F F F F
+6012 F F F F F F F
+6013 F F F F F F F
+6014 F F F F F F F
+6015 F F F F F F F
+6016 F T F F F T F
+6017 F T F F F T F
+6018 F T F F F T F
+6019 F T F F F T F
+6020 F T F F F T F
+6021 F T F F F T F
+6022 F T F F F T F
+6023 F T F F F T F
+6024 F T F F F T F
+6025 F T F F F T F
+6026 F T F F F T F
+6027 F T F F F T F
+6028 F T F F F T F
+6029 F T F F F T F
+6030 F T F F F T F
+6031 F T F F F T F
+6032 F T F F F T F
+6033 F T F F F T F
+6034 F T F F F T F
+6035 F T F F F T F
+6036 F T F F F T F
+6037 F T F F F T F
+6038 F T F F F T F
+6039 F T F F F T F
+6040 F T F F F T F
+6041 F T F F F T F
+6042 F T F F F T F
+6043 F T F F F T F
+6044 F T F F F T F
+6045 F T F F F T F
+6046 F T F F F T F
+6047 F T F F F T F
+6048 F T F F F T F
+6049 F T F F F T F
+6050 F T F F F T F
+6051 F T F F F T F
+6052 F T F F F T F
+6053 F T F F F T F
+6054 F T F F F T F
+6055 F T F F F T F
+6056 F T F F F T F
+6057 F T F F F T F
+6058 F T F F F T F
+6059 F T F F F T F
+6060 F T F F F T F
+6061 F T F F F T F
+6062 F T F F F T F
+6063 F T F F F T F
+6064 F T F F F T F
+6065 F T F F F T F
+6066 F T F F F T F
+6067 F T F F F T F
+6068 F F F F F F F
+6069 F F F F F F F
+6070 F T F F F F F
+6071 F T F F F F F
+6072 F T F F F F F
+6073 F T F F F F F
+6074 F T F F F F F
+6075 F T F F F F F
+6076 F T F F F F F
+6077 F T F F F F F
+6078 F T F F F F F
+6079 F T F F F F F
+6080 F T F F F F F
+6081 F T F F F F F
+6082 F T F F F F F
+6083 F T F F F F F
+6084 F T F F F F F
+6085 F T F F F F F
+6086 F T F F F F F
+6087 F T F F F F F
+6088 F T F F F F F
+6089 F T F F F F F
+6090 F T F F F F F
+6091 F T F F F F F
+6092 F T F F F F F
+6093 F T F F F F F
+6094 F T F F F F F
+6095 F T F F F F F
+6096 F T F F F F F
+6097 F T F F F F F
+6098 F T F F F F F
+6099 F T F F F F F
+6100 F T F F F F F
+6101 F T F F F F F
+6102 F T F F F F F
+6103 F T F F F T F
+6104 F T F F F F F
+6105 F T F F F F F
+6106 F T F F F F F
+6107 F T F F F F F
+6108 F T F F F T F
+6109 F T F F F F F
+6110 F F F F F F F
+6111 F F F F F F F
+6112 F T F F F F F
+6113 F T F F F F F
+6114 F T F F F F F
+6115 F T F F F F F
+6116 F T F F F F F
+6117 F T F F F F F
+6118 F T F F F F F
+6119 F T F F F F F
+6120 F T F F F F F
+6121 F T F F F F F
+6122 F F F F F F F
+6123 F F F F F F F
+6124 F F F F F F F
+6125 F F F F F F F
+6126 F F F F F F F
+6127 F F F F F F F
+6128 F T F F F F F
+6129 F T F F F F F
+6130 F T F F F F F
+6131 F T F F F F F
+6132 F T F F F F F
+6133 F T F F F F F
+6134 F T F F F F F
+6135 F T F F F F F
+6136 F T F F F F F
+6137 F T F F F F F
+6138 F F F F F F F
+6139 F F F F F F F
+6140 F F F F F F F
+6141 F F F F F F F
+6142 F F F F F F F
+6143 F F F F F F F
+6144 F T F F F F F
+6145 F T F F F F F
+6146 F T F F F F F
+6147 F T F F F F F
+6148 F T F F F F F
+6149 F T F F F F F
+6150 F T F F F F F
+6151 F T F F F F F
+6152 F T F F F F F
+6153 F T F F F F F
+6154 F T F F F F F
+6155 F T F F F F F
+6156 F T F F F F F
+6157 F T F F F F F
+6158 F T T F F F F
+6159 F F F F F F F
+6160 F T F F F F F
+6161 F T F F F F F
+6162 F T F F F F F
+6163 F T F F F F F
+6164 F T F F F F F
+6165 F T F F F F F
+6166 F T F F F F F
+6167 F T F F F F F
+6168 F T F F F F F
+6169 F T F F F F F
+6170 F F F F F F F
+6171 F F F F F F F
+6172 F F F F F F F
+6173 F F F F F F F
+6174 F F F F F F F
+6175 F F F F F F F
+6176 F T F F F T F
+6177 F T F F F T F
+6178 F T F F F T F
+6179 F T F F F T F
+6180 F T F F F T F
+6181 F T F F F T F
+6182 F T F F F T F
+6183 F T F F F T F
+6184 F T F F F T F
+6185 F T F F F T F
+6186 F T F F F T F
+6187 F T F F F T F
+6188 F T F F F T F
+6189 F T F F F T F
+6190 F T F F F T F
+6191 F T F F F T F
+6192 F T F F F T F
+6193 F T F F F T F
+6194 F T F F F T F
+6195 F T F F F T F
+6196 F T F F F T F
+6197 F T F F F T F
+6198 F T F F F T F
+6199 F T F F F T F
+6200 F T F F F T F
+6201 F T F F F T F
+6202 F T F F F T F
+6203 F T F F F T F
+6204 F T F F F T F
+6205 F T F F F T F
+6206 F T F F F T F
+6207 F T F F F T F
+6208 F T F F F T F
+6209 F T F F F T F
+6210 F T F F F T F
+6211 F T F F F T F
+6212 F T F F F T F
+6213 F T F F F T F
+6214 F T F F F T F
+6215 F T F F F T F
+6216 F T F F F T F
+6217 F T F F F T F
+6218 F T F F F T F
+6219 F T F F F T F
+6220 F T F F F T F
+6221 F T F F F T F
+6222 F T F F F T F
+6223 F T F F F T F
+6224 F T F F F T F
+6225 F T F F F T F
+6226 F T F F F T F
+6227 F T F F F T F
+6228 F T F F F T F
+6229 F T F F F T F
+6230 F T F F F T F
+6231 F T F F F T F
+6232 F T F F F T F
+6233 F T F F F T F
+6234 F T F F F T F
+6235 F T F F F T F
+6236 F T F F F T F
+6237 F T F F F T F
+6238 F T F F F T F
+6239 F T F F F T F
+6240 F T F F F T F
+6241 F T F F F T F
+6242 F T F F F T F
+6243 F T F F F T F
+6244 F T F F F T F
+6245 F T F F F T F
+6246 F T F F F T F
+6247 F T F F F T F
+6248 F T F F F T F
+6249 F T F F F T F
+6250 F T F F F T F
+6251 F T F F F T F
+6252 F T F F F T F
+6253 F T F F F T F
+6254 F T F F F T F
+6255 F T F F F T F
+6256 F T F F F T F
+6257 F T F F F T F
+6258 F T F F F T F
+6259 F T F F F T F
+6260 F T F F F T F
+6261 F T F F F T F
+6262 F T F F F T F
+6263 F T F F F T F
+6264 F F F F F F F
+6265 F F F F F F F
+6266 F F F F F F F
+6267 F F F F F F F
+6268 F F F F F F F
+6269 F F F F F F F
+6270 F F F F F F F
+6271 F F F F F F F
+6272 F T F F F T F
+6273 F T F F F T F
+6274 F T F F F T F
+6275 F T F F F T F
+6276 F T F F F T F
+6277 F T F F F T F
+6278 F T F F F T F
+6279 F T F F F T F
+6280 F T F F F T F
+6281 F T F F F T F
+6282 F T F F F T F
+6283 F T F F F T F
+6284 F T F F F T F
+6285 F T F F F T F
+6286 F T F F F T F
+6287 F T F F F T F
+6288 F T F F F T F
+6289 F T F F F T F
+6290 F T F F F T F
+6291 F T F F F T F
+6292 F T F F F T F
+6293 F T F F F T F
+6294 F T F F F T F
+6295 F T F F F T F
+6296 F T F F F T F
+6297 F T F F F T F
+6298 F T F F F T F
+6299 F T F F F T F
+6300 F T F F F T F
+6301 F T F F F T F
+6302 F T F F F T F
+6303 F T F F F T F
+6304 F T F F F T F
+6305 F T F F F T F
+6306 F T F F F T F
+6307 F T F F F T F
+6308 F T F F F T F
+6309 F T F F F T F
+6310 F T F F F T F
+6311 F T F F F T F
+6312 F T F F F T F
+6313 F T F F F F F
+6314 F T F F F T F
+6315 F F F F F F F
+6316 F F F F F F F
+6317 F F F F F F F
+6318 F F F F F F F
+6319 F F F F F F F
+6320 F T F F F T F
+6321 F T F F F T F
+6322 F T F F F T F
+6323 F T F F F T F
+6324 F T F F F T F
+6325 F T F F F T F
+6326 F T F F F T F
+6327 F T F F F T F
+6328 F T F F F T F
+6329 F T F F F T F
+6330 F T F F F T F
+6331 F T F F F T F
+6332 F T F F F T F
+6333 F T F F F T F
+6334 F T F F F T F
+6335 F T F F F T F
+6336 F T F F F T F
+6337 F T F F F T F
+6338 F T F F F T F
+6339 F T F F F T F
+6340 F T F F F T F
+6341 F T F F F T F
+6342 F T F F F T F
+6343 F T F F F T F
+6344 F T F F F T F
+6345 F T F F F T F
+6346 F T F F F T F
+6347 F T F F F T F
+6348 F T F F F T F
+6349 F T F F F T F
+6350 F T F F F T F
+6351 F T F F F T F
+6352 F T F F F T F
+6353 F T F F F T F
+6354 F T F F F T F
+6355 F T F F F T F
+6356 F T F F F T F
+6357 F T F F F T F
+6358 F T F F F T F
+6359 F T F F F T F
+6360 F T F F F T F
+6361 F T F F F T F
+6362 F T F F F T F
+6363 F T F F F T F
+6364 F T F F F T F
+6365 F T F F F T F
+6366 F T F F F T F
+6367 F T F F F T F
+6368 F T F F F T F
+6369 F T F F F T F
+6370 F T F F F T F
+6371 F T F F F T F
+6372 F T F F F T F
+6373 F T F F F T F
+6374 F T F F F T F
+6375 F T F F F T F
+6376 F T F F F T F
+6377 F T F F F T F
+6378 F T F F F T F
+6379 F T F F F T F
+6380 F T F F F T F
+6381 F T F F F T F
+6382 F T F F F T F
+6383 F T F F F T F
+6384 F T F F F T F
+6385 F T F F F T F
+6386 F T F F F T F
+6387 F T F F F T F
+6388 F T F F F T F
+6389 F T F F F T F
+6390 F F F F F F F
+6391 F F F F F F F
+6392 F F F F F F F
+6393 F F F F F F F
+6394 F F F F F F F
+6395 F F F F F F F
+6396 F F F F F F F
+6397 F F F F F F F
+6398 F F F F F F F
+6399 F F F F F F F
+6400 F T F F F T F
+6401 F T F F F T F
+6402 F T F F F T F
+6403 F T F F F T F
+6404 F T F F F T F
+6405 F T F F F T F
+6406 F T F F F T F
+6407 F T F F F T F
+6408 F T F F F T F
+6409 F T F F F T F
+6410 F T F F F T F
+6411 F T F F F T F
+6412 F T F F F T F
+6413 F T F F F T F
+6414 F T F F F T F
+6415 F T F F F T F
+6416 F T F F F T F
+6417 F T F F F T F
+6418 F T F F F T F
+6419 F T F F F T F
+6420 F T F F F T F
+6421 F T F F F T F
+6422 F T F F F T F
+6423 F T F F F T F
+6424 F T F F F T F
+6425 F T F F F T F
+6426 F T F F F T F
+6427 F T F F F T F
+6428 F T F F F T F
+6429 F F F F F F F
+6430 F F F F F F F
+6431 F F F F F F F
+6432 F T F F F F F
+6433 F T F F F F F
+6434 F T F F F F F
+6435 F T F F F F F
+6436 F T F F F F F
+6437 F T F F F F F
+6438 F T F F F F F
+6439 F T F F F F F
+6440 F T F F F F F
+6441 F T F F F F F
+6442 F T F F F F F
+6443 F T F F F F F
+6444 F F F F F F F
+6445 F F F F F F F
+6446 F F F F F F F
+6447 F F F F F F F
+6448 F T F F F F F
+6449 F T F F F F F
+6450 F T F F F F F
+6451 F T F F F F F
+6452 F T F F F F F
+6453 F T F F F F F
+6454 F T F F F F F
+6455 F T F F F F F
+6456 F T F F F F F
+6457 F T F F F F F
+6458 F T F F F F F
+6459 F T F F F F F
+6460 F F F F F F F
+6461 F F F F F F F
+6462 F F F F F F F
+6463 F F F F F F F
+6464 F T F F F F F
+6465 F F F F F F F
+6466 F F F F F F F
+6467 F F F F F F F
+6468 F T F F F F F
+6469 F T F F F F F
+6470 F T F F F F F
+6471 F T F F F F F
+6472 F T F F F F F
+6473 F T F F F F F
+6474 F T F F F F F
+6475 F T F F F F F
+6476 F T F F F F F
+6477 F T F F F F F
+6478 F T F F F F F
+6479 F T F F F F F
+6480 F T F F F T F
+6481 F T F F F T F
+6482 F T F F F T F
+6483 F T F F F T F
+6484 F T F F F T F
+6485 F T F F F T F
+6486 F T F F F T F
+6487 F T F F F T F
+6488 F T F F F T F
+6489 F T F F F T F
+6490 F T F F F T F
+6491 F T F F F T F
+6492 F T F F F T F
+6493 F T F F F T F
+6494 F T F F F T F
+6495 F T F F F T F
+6496 F T F F F T F
+6497 F T F F F T F
+6498 F T F F F T F
+6499 F T F F F T F
+6500 F T F F F T F
+6501 F T F F F T F
+6502 F T F F F T F
+6503 F T F F F T F
+6504 F T F F F T F
+6505 F T F F F T F
+6506 F T F F F T F
+6507 F T F F F T F
+6508 F T F F F T F
+6509 F T F F F T F
+6510 F F F F F F F
+6511 F F F F F F F
+6512 F T F F F T F
+6513 F T F F F T F
+6514 F T F F F T F
+6515 F T F F F T F
+6516 F T F F F T F
+6517 F F F F F F F
+6518 F F F F F F F
+6519 F F F F F F F
+6520 F F F F F F F
+6521 F F F F F F F
+6522 F F F F F F F
+6523 F F F F F F F
+6524 F F F F F F F
+6525 F F F F F F F
+6526 F F F F F F F
+6527 F F F F F F F
+6528 F T F F F T F
+6529 F T F F F T F
+6530 F T F F F T F
+6531 F T F F F T F
+6532 F T F F F T F
+6533 F T F F F T F
+6534 F T F F F T F
+6535 F T F F F T F
+6536 F T F F F T F
+6537 F T F F F T F
+6538 F T F F F T F
+6539 F T F F F T F
+6540 F T F F F T F
+6541 F T F F F T F
+6542 F T F F F T F
+6543 F T F F F T F
+6544 F T F F F T F
+6545 F T F F F T F
+6546 F T F F F T F
+6547 F T F F F T F
+6548 F T F F F T F
+6549 F T F F F T F
+6550 F T F F F T F
+6551 F T F F F T F
+6552 F T F F F T F
+6553 F T F F F T F
diff --git a/testsuite/tests/lib/Concurrent/4876.hs b/testsuite/tests/lib/Concurrent/4876.hs
new file mode 100644
index 0000000000..68c2a871b8
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/4876.hs
@@ -0,0 +1,19 @@
+import System.Random
+import Control.Concurrent.SampleVar
+import Control.Concurrent
+import Control.Monad
+
+produce, consume :: SampleVar Int -> IO ()
+produce svar = do
+ b <- isEmptySampleVar svar
+ if b then writeSampleVar svar 3 else return ()
+
+consume svar = readSampleVar svar >>= print
+
+main = do
+ svar <- newEmptySampleVar
+ m <- newEmptyMVar
+ forkIO $ consume svar >> putMVar m ()
+ threadDelay 100000 -- 100 ms
+ produce svar
+ takeMVar m -- deadlocked before the fix in #4876
diff --git a/testsuite/tests/lib/Concurrent/4876.stdout b/testsuite/tests/lib/Concurrent/4876.stdout
new file mode 100644
index 0000000000..00750edc07
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/4876.stdout
@@ -0,0 +1 @@
+3
diff --git a/testsuite/tests/lib/Concurrent/Chan001.hs b/testsuite/tests/lib/Concurrent/Chan001.hs
new file mode 100644
index 0000000000..e4b668ac48
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/Chan001.hs
@@ -0,0 +1,109 @@
+import Debug.QuickCheck
+import System.IO.Unsafe
+import Control.Concurrent.Chan
+import Control.Concurrent
+import Control.Monad
+
+data Action = NewChan | ReadChan | WriteChan Int | IsEmptyChan | ReturnInt Int
+ | ReturnBool Bool
+ deriving (Eq,Show)
+
+
+main = do
+ t <- myThreadId
+ forkIO (threadDelay 1000000 >> killThread t)
+ -- just in case we deadlock
+ testChan
+
+testChan :: IO ()
+testChan = do
+ quickCheck prop_NewIs_NewRet
+ quickCheck prop_NewWriteIs_NewRet
+ quickCheck prop_NewWriteRead_NewRet
+
+
+prop_NewIs_NewRet =
+ [NewChan,IsEmptyChan] =^ [NewChan,ReturnBool True]
+
+prop_NewWriteIs_NewRet n =
+ [NewChan,WriteChan n,IsEmptyChan] =^ [NewChan,WriteChan n,ReturnBool False]
+
+prop_NewWriteRead_NewRet n =
+ [NewChan,WriteChan n,ReadChan] =^ [NewChan,ReturnInt n]
+
+
+perform :: [Action] -> IO ([Bool],[Int])
+perform [] = return ([],[])
+
+perform (a:as) =
+ case a of
+ ReturnInt v -> liftM (\(b,l) -> (b,v:l)) (perform as)
+ ReturnBool v -> liftM (\(b,l) -> (v:b,l)) (perform as)
+ NewChan -> newChan >>= \chan -> perform' chan as
+ _ -> error $ "Please use NewChan as first action"
+
+
+perform' :: Chan Int -> [Action] -> IO ([Bool],[Int])
+perform' _ [] = return ([],[])
+
+perform' chan (a:as) =
+ case a of
+ ReturnInt v -> liftM (\(b,l) -> (b,v:l)) (perform' chan as)
+ ReturnBool v -> liftM (\(b,l) -> (v:b,l)) (perform' chan as)
+ ReadChan -> liftM2 (\v (b,l) -> (b,v:l)) (readChan chan)
+ (perform' chan as)
+ WriteChan n -> writeChan chan n >> perform' chan as
+ IsEmptyChan -> liftM2 (\v (b,l) -> (v:b,l)) (isEmptyChan chan)
+ (perform' chan as)
+ _ -> error $ "If you want to use " ++ show a
+ ++ " please use the =^ operator"
+
+
+actions :: Gen [Action]
+actions =
+ liftM (NewChan:) (actions' 0)
+
+
+actions' :: Int -> Gen [Action]
+actions' contents =
+ oneof ([return [],
+ liftM (IsEmptyChan:) (actions' contents),
+ liftM2 (:) (liftM WriteChan arbitrary) (actions' (contents+1))]
+ ++
+ if contents==0
+ then []
+ else [liftM (ReadChan:) (actions' (contents-1))])
+
+
+(=^) :: [Action] -> [Action] -> Property
+c =^ c' =
+ forAll (actions' (delta 0 c))
+ (\suff -> observe c suff == observe c' suff)
+ where observe x suff = unsafePerformIO (perform (x++suff))
+
+
+(^=^) :: [Action] -> [Action] -> Property
+c ^=^ c' =
+ forAll actions
+ (\pref -> forAll (actions' (delta 0 (pref++c)))
+ (\suff -> observe c pref suff ==
+ observe c' pref suff))
+ where observe x pref suff = unsafePerformIO (perform (pref++x++suff))
+
+
+delta :: Int -> [Action] -> Int
+delta i [] = i
+
+delta i (ReturnInt _:as) = delta i as
+
+delta i (ReturnBool _:as) = delta i as
+
+delta _ (NewChan:as) = delta 0 as
+
+delta i (WriteChan _:as) = delta (i+1) as
+
+delta i (ReadChan:as) = delta (if i==0
+ then error "read on empty Chan"
+ else i-1) as
+
+delta i (IsEmptyChan:as) = delta i as
diff --git a/testsuite/tests/lib/Concurrent/Chan001.stdout b/testsuite/tests/lib/Concurrent/Chan001.stdout
new file mode 100644
index 0000000000..53bfa8a381
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/Chan001.stdout
@@ -0,0 +1,3 @@
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
diff --git a/testsuite/tests/lib/Concurrent/MVar001.hs b/testsuite/tests/lib/Concurrent/MVar001.hs
new file mode 100644
index 0000000000..f787470c51
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/MVar001.hs
@@ -0,0 +1,148 @@
+import Debug.QuickCheck
+import System.IO.Unsafe
+import Control.Concurrent.MVar
+import Control.Concurrent
+import Control.Monad
+
+
+data Action = NewEmptyMVar | NewMVar Int | TakeMVar | ReadMVar | PutMVar Int
+ | SwapMVar Int | IsEmptyMVar | ReturnInt Int | ReturnBool Bool
+ deriving (Eq,Show)
+
+main = do
+ t <- myThreadId
+ forkIO (threadDelay 1000000 >> killThread t)
+ -- just in case we deadlock
+ testMVar
+
+testMVar :: IO ()
+testMVar = do
+ quickCheck prop_NewEIs_NewERet
+ quickCheck prop_NewIs_NewRet
+ quickCheck prop_NewTake_NewRet
+ quickCheck prop_NewEPutTake_NewERet
+ quickCheck prop_NewRead_NewRet
+ quickCheck prop_NewSwap_New
+
+
+prop_NewEIs_NewERet =
+ [NewEmptyMVar,IsEmptyMVar] =^ [NewEmptyMVar,ReturnBool True]
+
+prop_NewIs_NewRet n =
+ [NewMVar n,IsEmptyMVar] =^ [NewMVar n,ReturnBool False]
+
+prop_NewTake_NewRet n =
+ [NewMVar n,TakeMVar] =^ [NewEmptyMVar,ReturnInt n]
+
+prop_NewEPutTake_NewERet n =
+ [NewEmptyMVar,PutMVar n,TakeMVar] =^
+ [NewEmptyMVar,ReturnInt n]
+
+prop_NewRead_NewRet n =
+ [NewMVar n,ReadMVar] =^ [NewMVar n,ReturnInt n]
+
+prop_NewSwap_New m n =
+ [NewMVar m,SwapMVar n] =^ [NewMVar n]
+
+
+perform :: [Action] -> IO ([Bool],[Int])
+perform [] = return ([],[])
+
+perform (a:as) =
+ case a of
+ ReturnInt v -> liftM (\(b,l) -> (b,v:l)) (perform as)
+ ReturnBool v -> liftM (\(b,l) -> (v:b,l)) (perform as)
+ NewEmptyMVar -> newEmptyMVar >>= \mv -> perform' mv as
+ NewMVar n -> newMVar n >>= \mv -> perform' mv as
+ _ -> error $ "Please use NewMVar or NewEmptyMVar as first "
+ ++ "action"
+
+
+perform' :: MVar Int -> [Action] -> IO ([Bool],[Int])
+perform' _ [] = return ([],[])
+
+perform' mv (a:as) =
+ case a of
+ ReturnInt v -> liftM (\(b,l) -> (b,v:l)) (perform' mv as)
+ ReturnBool v -> liftM (\(b,l) -> (v:b,l)) (perform' mv as)
+ TakeMVar -> liftM2 (\v (b,l) -> (b,v:l)) (takeMVar mv)
+ (perform' mv as)
+ ReadMVar -> liftM2 (\v (b,l) -> (b,v:l)) (readMVar mv)
+ (perform' mv as)
+ PutMVar n -> putMVar mv n >> perform' mv as
+ SwapMVar n -> swapMVar mv n >> perform' mv as
+ IsEmptyMVar -> liftM2 (\v (b,l) -> (v:b,l)) (isEmptyMVar mv)
+ (perform' mv as)
+ _ -> error $ "If you want to use " ++ show a
+ ++ " please use the =^ operator"
+
+
+actions :: Gen [Action]
+actions = do
+ oneof [liftM (NewEmptyMVar:) (actions' True),
+ liftM2 (:) (liftM NewMVar arbitrary) (actions' False)]
+
+
+actions' :: Bool -> Gen [Action]
+actions' empty =
+ oneof ([return [],
+ liftM (IsEmptyMVar:) (actions' empty)] ++
+ if empty
+ then [liftM2 (:) (liftM PutMVar arbitrary) (actions' False)]
+ else []
+ ++
+ if empty
+ then []
+ else [liftM (TakeMVar:) (actions' True)]
+ ++
+ if empty
+ then []
+ else [liftM (ReadMVar:) (actions' False)]
+ ++
+ if empty
+ then []
+ else [liftM2 (:) (liftM SwapMVar arbitrary) (actions' False)] )
+
+
+(=^) :: [Action] -> [Action] -> Property
+c =^ c' =
+ forAll (actions' (delta True c))
+ (\suff -> observe c suff == observe c' suff)
+ where observe x suff = unsafePerformIO (perform (x++suff))
+
+
+(^=^) :: [Action] -> [Action] -> Property
+c ^=^ c' =
+ forAll actions
+ (\pref -> forAll (actions' (delta True (pref++c)))
+ (\suff -> observe c pref suff ==
+ observe c' pref suff))
+ where observe x pref suff = unsafePerformIO (perform (pref++x++suff))
+
+
+delta :: Bool -> [Action] -> Bool
+delta b [] = b
+
+delta b (ReturnInt _:as) = delta b as
+
+delta b (ReturnBool _:as) = delta b as
+
+delta _ (NewEmptyMVar:as) = delta True as
+
+delta _ (NewMVar _:as) = delta False as
+
+delta b (TakeMVar:as) = delta (if b
+ then error "take on empty MVar"
+ else True) as
+
+delta b (ReadMVar:as) = delta (if b
+ then error "read on empty MVar"
+ else False) as
+
+delta _ (PutMVar _:as) = delta False as
+
+delta b (SwapMVar _:as) = delta (if b
+ then error "swap on empty MVar"
+ else False) as
+
+delta b (IsEmptyMVar:as) = delta b as
diff --git a/testsuite/tests/lib/Concurrent/MVar001.stdout b/testsuite/tests/lib/Concurrent/MVar001.stdout
new file mode 100644
index 0000000000..65be56c733
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/MVar001.stdout
@@ -0,0 +1,6 @@
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
diff --git a/testsuite/tests/lib/Concurrent/Makefile b/testsuite/tests/lib/Concurrent/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Concurrent/QSem001.hs b/testsuite/tests/lib/Concurrent/QSem001.hs
new file mode 100644
index 0000000000..1f255997e7
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/QSem001.hs
@@ -0,0 +1,93 @@
+import Debug.QuickCheck
+import System.IO.Unsafe
+import Control.Concurrent.QSem
+import Control.Concurrent
+import Control.Monad
+
+
+main = do
+ t <- myThreadId
+ forkIO (threadDelay 1000000 >> killThread t)
+ -- just in case we deadlock
+ testQSem
+
+data Action = NewQSem Int | SignalQSem | WaitQSem
+ deriving (Eq,Show)
+
+
+testQSem :: IO ()
+testQSem = do
+ quietCheck prop_SignalWait
+ quietCheck prop_WaitSignal
+
+quietCheck = check defaultConfig{configEvery = \n args -> ""}
+
+prop_SignalWait n =
+ n>=0 ==> [NewQSem n,SignalQSem,WaitQSem] =^ [NewQSem n]
+
+prop_WaitSignal n =
+ n>=1 ==> [NewQSem n,WaitQSem,SignalQSem] =^ [NewQSem n]
+
+
+perform :: [Action] -> IO ()
+perform [] = return ()
+
+perform (a:as) =
+ case a of
+ NewQSem n -> newQSem n >>= \qs -> perform' qs as
+ _ -> error $ "Please use NewQSem as first action" ++ show a
+
+
+perform' :: QSem -> [Action] -> IO ()
+perform' _ [] = return ()
+
+perform' qs (a:as) =
+ case a of
+ SignalQSem -> signalQSem qs >> perform' qs as
+ WaitQSem -> waitQSem qs >> perform' qs as
+ _ -> error $ "If you want to use " ++ show a
+ ++ " please use the =^ operator"
+
+
+actions :: Gen [Action]
+actions = do
+ i <- arbitrary
+ liftM (NewQSem i:) (actions' i)
+
+
+actions' :: Int -> Gen [Action]
+actions' quantity =
+ oneof ([return [],
+ liftM (SignalQSem:) (actions' (quantity+1))] ++
+ if quantity<=0
+ then []
+ else [liftM (WaitQSem:) (actions' (quantity-1))])
+
+
+(=^) :: [Action] -> [Action] -> Property
+c =^ c' =
+ forAll (actions' (delta 0 c))
+ (\suff -> observe c suff == observe c' suff)
+ where observe x suff = unsafePerformIO (perform (x++suff))
+
+
+(^=^) :: [Action] -> [Action] -> Property
+c ^=^ c' =
+ forAll actions
+ (\pref -> forAll (actions' (delta 0 (pref++c)))
+ (\suff -> observe c pref suff ==
+ observe c' pref suff))
+ where observe x pref suff = unsafePerformIO (perform (pref++x++suff))
+
+
+delta :: Int -> [Action] -> Int
+delta i [] = i
+
+delta _ (NewQSem i:as) = delta i as
+
+delta i (SignalQSem:as) = delta (i+1) as
+
+delta i (WaitQSem:as) = delta (if i<=0
+ then error "wait on 'empty' QSem"
+ else i-1) as
+
diff --git a/testsuite/tests/lib/Concurrent/QSem001.stdout b/testsuite/tests/lib/Concurrent/QSem001.stdout
new file mode 100644
index 0000000000..7288d19270
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/QSem001.stdout
@@ -0,0 +1,2 @@
+OK, passed 100 tests.
+OK, passed 100 tests.
diff --git a/testsuite/tests/lib/Concurrent/QSemN001.hs b/testsuite/tests/lib/Concurrent/QSemN001.hs
new file mode 100644
index 0000000000..c31d6a6964
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/QSemN001.hs
@@ -0,0 +1,96 @@
+import Debug.QuickCheck
+import System.IO.Unsafe
+import Control.Concurrent.QSemN
+import Control.Concurrent
+import Control.Monad
+
+
+main = do
+ t <- myThreadId
+ forkIO (threadDelay 1000000 >> killThread t)
+ -- just in case we deadlock
+ testQSemN
+
+data Action = NewQSemN Int | SignalQSemN Int | WaitQSemN Int
+ deriving (Eq,Show)
+
+
+testQSemN :: IO ()
+testQSemN = do
+ quietCheck prop_SignalWait
+ quietCheck prop_WaitSignal
+
+quietCheck = check defaultConfig{configEvery = \n args -> ""}
+
+
+prop_SignalWait l m n = l+m>=n ==>
+ [NewQSemN l,SignalQSemN m,WaitQSemN n] =^ [NewQSemN (l+m-n)]
+
+prop_WaitSignal l m n = l>=m ==>
+ [NewQSemN l,WaitQSemN m,SignalQSemN n] =^ [NewQSemN (l-m+n)]
+
+
+perform :: [Action] -> IO [Int]
+perform [] = return []
+
+perform (a:as) =
+ case a of
+ NewQSemN n -> newQSemN n >>= \qs -> perform' qs as
+ _ -> error $ "Please use NewQSemN as first action" ++ show a
+
+
+perform' :: QSemN -> [Action] -> IO [Int]
+perform' _ [] = return []
+
+perform' qs (a:as) =
+ case a of
+ SignalQSemN n -> signalQSemN qs n >> perform' qs as
+ WaitQSemN n -> waitQSemN qs n >> perform' qs as
+ _ -> error $ "If you want to use " ++ show a
+ ++ " please use the =^ operator"
+
+
+actions :: Gen [Action]
+actions = do
+ i <- arbitrary
+ liftM (NewQSemN i:) (actions' i)
+
+
+actions' :: Int -> Gen [Action]
+actions' quantity =
+ oneof ([return [],
+ do i<- choose (0,maxBound)
+ liftM (SignalQSemN i:) (actions' (quantity+i))] ++
+ if quantity<=0
+ then []
+ else [do i<- choose (0,quantity)
+ liftM (WaitQSemN i:) (actions' (quantity-i))])
+
+
+(=^) :: [Action] -> [Action] -> Property
+c =^ c' =
+ forAll (actions' (delta 0 c))
+ (\suff -> observe c suff == observe c' suff)
+ where observe x suff = unsafePerformIO (perform (x++suff))
+
+
+(^=^) :: [Action] -> [Action] -> Property
+c ^=^ c' =
+ forAll actions
+ (\pref -> forAll (actions' (delta 0 (pref++c)))
+ (\suff -> observe c pref suff ==
+ observe c' pref suff))
+ where observe x pref suff = unsafePerformIO (perform (pref++x++suff))
+
+
+delta :: Int -> [Action] -> Int
+delta i [] = i
+
+delta _ (NewQSemN i:as) = delta i as
+
+delta i (SignalQSemN n:as) = delta (i+n) as
+
+delta i (WaitQSemN n:as) = delta (if i<n
+ then error "wait on 'empty' QSemN"
+ else i-n) as
+
diff --git a/testsuite/tests/lib/Concurrent/QSemN001.stdout b/testsuite/tests/lib/Concurrent/QSemN001.stdout
new file mode 100644
index 0000000000..7288d19270
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/QSemN001.stdout
@@ -0,0 +1,2 @@
+OK, passed 100 tests.
+OK, passed 100 tests.
diff --git a/testsuite/tests/lib/Concurrent/SampleVar001.hs b/testsuite/tests/lib/Concurrent/SampleVar001.hs
new file mode 100644
index 0000000000..def86c5d54
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/SampleVar001.hs
@@ -0,0 +1,132 @@
+-------------------------------------------------------------------------------
+-- Module : SampleVarTest
+-------------------------------------------------------------------------------
+
+import Debug.QuickCheck
+import System.IO.Unsafe
+import Control.Concurrent
+import Control.Concurrent.SampleVar
+import Control.Monad
+
+
+data Action = NewEmptySampleVar | NewSampleVar Int | EmptySampleVar
+ | ReadSampleVar | WriteSampleVar Int | IsEmptySampleVar
+ | ReturnInt Int | ReturnBool Bool
+ deriving (Eq,Show)
+
+
+main = do
+ t <- myThreadId
+ forkIO (threadDelay 1000000 >> killThread t)
+ -- just in case we deadlock
+ testSampleVar
+
+testSampleVar :: IO ()
+testSampleVar = do
+ quickCheck prop_NewEIs_NewERet
+ quickCheck prop_NewIs_NewRet
+ quickCheck prop_NewRead_NewRet
+ quickCheck prop_NewEWriteRead_NewERet
+ quickCheck prop_WriteEmpty_Empty
+ quickCheck prop_WriteRead_Ret
+
+
+
+perform :: [Action] -> IO ([Bool],[Int])
+perform [] = return ([],[])
+
+perform (a:as) =
+ case a of
+ ReturnInt v -> liftM (\(b,l) -> (b,v:l)) (perform as)
+ ReturnBool v -> liftM (\(b,l) -> (v:b,l)) (perform as)
+ NewEmptySampleVar -> newEmptySampleVar >>= \sv -> perform' sv as
+ NewSampleVar n -> newSampleVar n >>= \sv -> perform' sv as
+
+
+perform' :: SampleVar Int -> [Action] -> IO ([Bool],[Int])
+perform' _ [] = return ([],[])
+
+perform' sv (a:as) =
+ case a of
+ ReturnInt v -> liftM (\(b,l) -> (b,v:l)) (perform' sv as)
+ ReturnBool v -> liftM (\(b,l) -> (v:b,l)) (perform' sv as)
+ EmptySampleVar -> emptySampleVar sv >> perform' sv as
+ ReadSampleVar -> liftM2 (\v (b,l) -> (b,v:l)) (readSampleVar sv)
+ (perform' sv as)
+ WriteSampleVar n -> writeSampleVar sv n >> perform' sv as
+ IsEmptySampleVar -> liftM2 (\v (b,l) -> (v:b,l)) (isEmptySampleVar sv)
+ (perform' sv as)
+
+
+actions :: Gen [Action]
+actions = do
+ oneof [liftM (NewEmptySampleVar:) (actions' True),
+ liftM2 (:) (liftM NewSampleVar arbitrary) (actions' False)]
+
+
+actions' :: Bool -> Gen [Action]
+actions' empty =
+ oneof ([return [],
+ liftM (IsEmptySampleVar:) (actions' empty),
+ liftM (EmptySampleVar:) (actions' True),
+ liftM2 (:) (liftM WriteSampleVar arbitrary) (actions' False)] ++
+ if empty
+ then []
+ else [liftM (ReadSampleVar:) (actions' True)])
+
+
+(=^) :: [Action] -> [Action] -> Property
+c =^ c' =
+ forAll (actions' (delta True c))
+ (\suff -> observe c suff == observe c' suff)
+ where observe x suff = unsafePerformIO (perform (x++suff))
+
+
+(^=^) :: [Action] -> [Action] -> Property
+c ^=^ c' =
+ forAll actions
+ (\pref -> forAll (actions' (delta True (pref++c)))
+ (\suff -> observe c pref suff ==
+ observe c' pref suff))
+ where observe x pref suff = unsafePerformIO (perform (pref++x++suff))
+
+
+delta :: Bool -> [Action] -> Bool
+delta b [] = b
+
+delta b (ReturnInt _:as) = delta b as
+
+delta b (ReturnBool _:as) = delta b as
+
+delta _ (NewEmptySampleVar:as) = delta True as
+
+delta _ (NewSampleVar _:as) = delta False as
+
+delta _ (EmptySampleVar:as) = delta True as
+
+delta b (ReadSampleVar:as) = delta (if b
+ then error "read on empty SampleVar"
+ else True) as
+delta _ (WriteSampleVar _:as) = delta False as
+
+delta b (IsEmptySampleVar:as) = delta b as
+
+
+prop_NewEIs_NewERet =
+ [NewEmptySampleVar,IsEmptySampleVar] =^ [NewEmptySampleVar,ReturnBool True]
+
+prop_NewIs_NewRet n =
+ [NewSampleVar n,IsEmptySampleVar] =^ [NewSampleVar n,ReturnBool False]
+
+prop_NewRead_NewRet n =
+ [NewSampleVar n,ReadSampleVar] =^ [NewEmptySampleVar,ReturnInt n]
+
+prop_NewEWriteRead_NewERet n =
+ [NewEmptySampleVar,WriteSampleVar n,ReadSampleVar] =^
+ [NewEmptySampleVar,ReturnInt n]
+
+prop_WriteEmpty_Empty n =
+ [WriteSampleVar n,EmptySampleVar] ^=^ [EmptySampleVar]
+
+prop_WriteRead_Ret n =
+ [WriteSampleVar n,ReadSampleVar] ^=^ [EmptySampleVar,ReturnInt n]
diff --git a/testsuite/tests/lib/Concurrent/SampleVar001.stdout b/testsuite/tests/lib/Concurrent/SampleVar001.stdout
new file mode 100644
index 0000000000..65be56c733
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/SampleVar001.stdout
@@ -0,0 +1,6 @@
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
+0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, passed 100 tests.
diff --git a/testsuite/tests/lib/Concurrent/ThreadDelay001.hs b/testsuite/tests/lib/Concurrent/ThreadDelay001.hs
new file mode 100644
index 0000000000..c60f997039
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/ThreadDelay001.hs
@@ -0,0 +1,26 @@
+
+-- Test that threadDelay actually sleeps for (at least) as long as we
+-- ask it
+
+module Main (main) where
+
+import Control.Concurrent
+import Control.Monad
+import System.Time
+
+main = mapM_ delay (0 : take 11 (iterate (*5) 1))
+
+delay n = do
+ tS <- getClockTime
+ threadDelay n
+ tE <- getClockTime
+
+ let req = fromIntegral n * 10 ^ (6 :: Int)
+ obs = case normalizeTimeDiff (diffClockTimes tE tS) of
+ TimeDiff 0 0 0 0 0 s ps -> 10^12 * fromIntegral s + ps
+ diff = obs - req
+ diff' :: Double
+ diff' = fromIntegral diff / 10^(12 :: Int)
+
+ when (obs < req) $ print (tS, tE, req, obs, diff, diff')
+
diff --git a/testsuite/tests/lib/Concurrent/all.T b/testsuite/tests/lib/Concurrent/all.T
new file mode 100644
index 0000000000..004c6a1226
--- /dev/null
+++ b/testsuite/tests/lib/Concurrent/all.T
@@ -0,0 +1,10 @@
+setTestOpts(only_compiler_types(['ghc']))
+
+test('SampleVar001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
+test('4876', reqlib('random'), compile_and_run, ['']) # another SampleVar test
+
+test('Chan001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
+test('MVar001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
+test('QSemN001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
+test('QSem001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
+test('ThreadDelay001', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Data.ByteString/Makefile b/testsuite/tests/lib/Data.ByteString/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Data.ByteString/all.T b/testsuite/tests/lib/Data.ByteString/all.T
new file mode 100644
index 0000000000..75c5574302
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/all.T
@@ -0,0 +1,18 @@
+test('bytestring001',
+ [skip, # This is designed for an earlier version of bytestring
+ reqlib('QuickCheck')],
+ compile_and_run,
+ ['-package bytestring -package QuickCheck'])
+test('bytestring002', normal, compile_and_run, ['-package bytestring'])
+test('bytestring003', normal, compile_and_run, ['-package bytestring'])
+test('bytestring004',
+ [skip, # This is designed for an earlier version of bytestring
+ reqlib('QuickCheck')],
+ compile_and_run,
+ ['-package bytestring -package QuickCheck'])
+test('bytestring005',
+ [skip, # This is designed for an earlier version of bytestring
+ reqlib('QuickCheck')],
+ compile_and_run,
+ ['-package bytestring -package QuickCheck'])
+test('bytestring006', normal, compile_and_run, ['-package bytestring'])
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring001.hs b/testsuite/tests/lib/Data.ByteString/bytestring001.hs
new file mode 100644
index 0000000000..00cfcb3763
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring001.hs
@@ -0,0 +1,948 @@
+#!/usr/bin/env runhaskell
+--
+-- Uses multi-param type classes
+--
+
+import Test.QuickCheck.Batch
+import Test.QuickCheck
+import Text.Show.Functions
+
+import Data.Char
+import Data.Int
+import Data.List
+import Data.Maybe
+import Data.Word
+
+import System.IO
+import System.Environment
+import System.IO.Unsafe
+import System.Random
+
+import Control.Monad ( liftM2 )
+import Control.Monad.Instances ()
+
+import Text.Printf
+import Debug.Trace
+
+import Foreign.Ptr
+
+import Data.ByteString.Lazy (ByteString(..), pack , unpack)
+import qualified Data.ByteString.Lazy as L
+
+import Data.ByteString.Fusion
+import qualified Data.ByteString as P
+import qualified Data.ByteString.Lazy as L
+import qualified Data.ByteString.Lazy.Internal as L
+
+import qualified Data.ByteString.Char8 as PC
+import qualified Data.ByteString.Lazy.Char8 as LC
+import qualified Data.ByteString as P
+import qualified Data.ByteString.Internal as P
+import qualified Data.ByteString.Char8 as C
+import qualified Data.ByteString.Lazy.Char8 as D
+import Data.ByteString.Fusion
+
+import Prelude hiding (abs)
+
+-- Enable this to get verbose test output. Including the actual tests.
+debug = False
+
+mytest :: Testable a => a -> Int -> IO ()
+mytest a n = mycheck defaultConfig
+ { configMaxTest=n
+ , configEvery= \n args -> if debug then show n ++ ":\n" ++ unlines args else [] } a
+
+mycheck :: Testable a => Config -> a -> IO ()
+mycheck config a =
+ do let rnd = mkStdGen 99
+ mytests config (evaluate a) rnd 0 0 []
+
+mytests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> IO ()
+mytests config gen rnd0 ntest nfail stamps
+ | ntest == configMaxTest config = do done "OK," ntest stamps
+ | nfail == configMaxFail config = do done "Arguments exhausted after" ntest stamps
+ | otherwise =
+ do putStr (configEvery config ntest (arguments result)) >> hFlush stdout
+ case ok result of
+ Nothing ->
+ mytests config gen rnd1 ntest (nfail+1) stamps
+ Just True ->
+ mytests config gen rnd1 (ntest+1) nfail (stamp result:stamps)
+ Just False ->
+ putStr ( "Falsifiable after "
+ ++ show ntest
+ ++ " tests:\n"
+ ++ unlines (arguments result)
+ ) >> hFlush stdout
+ where
+ result = generate (configSize config ntest) rnd2 gen
+ (rnd1,rnd2) = split rnd0
+
+done :: String -> Int -> [[String]] -> IO ()
+done mesg ntest stamps =
+ do putStr ( mesg ++ " " ++ show ntest ++ " tests" ++ table )
+ where
+ table = display
+ . map entry
+ . reverse
+ . sort
+ . map pairLength
+ . group
+ . sort
+ . filter (not . null)
+ $ stamps
+
+ display [] = ".\n"
+ display [x] = " (" ++ x ++ ").\n"
+ display xs = ".\n" ++ unlines (map (++ ".") xs)
+
+ pairLength xss@(xs:_) = (length xss, xs)
+ entry (n, xs) = percentage n ntest
+ ++ " "
+ ++ concat (intersperse ", " xs)
+
+ percentage n m = show ((100 * n) `div` m) ++ "%"
+
+------------------------------------------------------------------------
+
+instance Arbitrary Char where
+ arbitrary = choose ('a', 'i')
+ coarbitrary c = variant (ord c `rem` 4)
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (PairS a b) where
+ arbitrary = liftM2 (:*:) arbitrary arbitrary
+ coarbitrary (a :*: b) = coarbitrary a . coarbitrary b
+
+instance Arbitrary Word8 where
+ arbitrary = choose (97, 105)
+ coarbitrary c = variant (fromIntegral ((fromIntegral c) `rem` 4))
+
+instance Arbitrary Int64 where
+ arbitrary = sized $ \n -> choose (-fromIntegral n,fromIntegral n)
+ coarbitrary n = variant (fromIntegral (if n >= 0 then 2*n else 2*(-n) + 1))
+
+instance Arbitrary a => Arbitrary (MaybeS a) where
+ arbitrary = do a <- arbitrary ; elements [NothingS, JustS a]
+ coarbitrary NothingS = variant 0
+ coarbitrary _ = variant 1 -- ok?
+
+{-
+instance Arbitrary Char where
+ arbitrary = choose ('\0', '\255') -- since we have to test words, unlines too
+ coarbitrary c = variant (ord c `rem` 16)
+
+instance Arbitrary Word8 where
+ arbitrary = choose (minBound, maxBound)
+ coarbitrary c = variant (fromIntegral ((fromIntegral c) `rem` 16))
+-}
+
+instance Random Word8 where
+ randomR = integralRandomR
+ random = randomR (minBound,maxBound)
+
+instance Random Int64 where
+ randomR = integralRandomR
+ random = randomR (minBound,maxBound)
+
+integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)
+integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer,
+ fromIntegral b :: Integer) g of
+ (x,g) -> (fromIntegral x, g)
+
+instance Arbitrary L.ByteString where
+ arbitrary = arbitrary >>= return . L.fromChunks . filter (not. P.null) -- maintain the invariant.
+ coarbitrary s = coarbitrary (L.unpack s)
+
+instance Arbitrary P.ByteString where
+ arbitrary = P.pack `fmap` arbitrary
+ coarbitrary s = coarbitrary (P.unpack s)
+
+------------------------------------------------------------------------
+--
+-- We're doing two forms of testing here. Firstly, model based testing.
+-- For our Lazy and strict bytestring types, we have model types:
+--
+-- i.e. Lazy == Byte
+-- \\ //
+-- List
+--
+-- That is, the Lazy type can be modeled by functions in both the Byte
+-- and List type. For each of the 3 models, we have a set of tests that
+-- check those types match.
+--
+-- The Model class connects a type and its model type, via a conversion
+-- function.
+--
+--
+class Model a b where
+ model :: a -> b -- get the abstract vale from a concrete value
+
+--
+-- Connecting our Lazy and Strict types to their models. We also check
+-- the data invariant on Lazy types.
+--
+-- These instances represent the arrows in the above diagram
+--
+instance Model B P where model = abstr . checkInvariant
+instance Model P [W] where model = P.unpack
+instance Model P [Char] where model = PC.unpack
+instance Model B [W] where model = L.unpack . checkInvariant
+instance Model B [Char] where model = LC.unpack . checkInvariant
+
+-- Types are trivially modeled by themselves
+instance Model Bool Bool where model = id
+instance Model Int Int where model = id
+instance Model Int64 Int64 where model = id
+instance Model Int64 Int where model = fromIntegral
+instance Model Word8 Word8 where model = id
+instance Model Ordering Ordering where model = id
+
+-- More structured types are modeled recursively, using the NatTrans class from Gofer.
+class (Functor f, Functor g) => NatTrans f g where
+ eta :: f a -> g a
+
+-- The transformation of the same type is identity
+instance NatTrans [] [] where eta = id
+instance NatTrans Maybe Maybe where eta = id
+instance NatTrans ((->) X) ((->) X) where eta = id
+instance NatTrans ((->) W) ((->) W) where eta = id
+
+-- We have a transformation of pairs, if the pairs are in Model
+instance Model f g => NatTrans ((,) f) ((,) g) where eta (f,a) = (model f, a)
+
+-- And finally, we can take any (m a) to (n b), if we can Model m n, and a b
+instance (NatTrans m n, Model a b) => Model (m a) (n b) where model x = fmap model (eta x)
+
+------------------------------------------------------------------------
+
+-- In a form more useful for QC testing (and it's lazy)
+checkInvariant :: L.ByteString -> L.ByteString
+checkInvariant cs0 = check cs0
+ where check L.Empty = L.Empty
+ check (L.Chunk c cs)
+ | P.null c = error ("invariant violation: " ++ show cs0)
+ | otherwise = L.Chunk c (check cs)
+
+abstr :: L.ByteString -> P.ByteString
+abstr = P.concat . L.toChunks
+
+
+-- Some short hand.
+type X = Int
+type W = Word8
+type P = P.ByteString
+type B = L.ByteString
+
+------------------------------------------------------------------------
+--
+-- These comparison functions handle wrapping and equality.
+--
+-- A single class for these would be nice, but note that they differe in
+-- the number of arguments, and those argument types, so we'd need HList
+-- tricks. See here: http://okmij.org/ftp/Haskell/vararg-fn.lhs
+--
+
+eq1 f g = \a ->
+ model (f a) == g (model a)
+eq2 f g = \a b ->
+ model (f a b) == g (model a) (model b)
+eq3 f g = \a b c ->
+ model (f a b c) == g (model a) (model b) (model c)
+eq4 f g = \a b c d ->
+ model (f a b c d) == g (model a) (model b) (model c) (model d)
+eq5 f g = \a b c d e ->
+ model (f a b c d e) == g (model a) (model b) (model c) (model d) (model e)
+
+--
+-- And for functions that take non-null input
+--
+eqnotnull1 f g = \x -> (not (isNull x)) ==> eq1 f g x
+eqnotnull2 f g = \x y -> (not (isNull y)) ==> eq2 f g x y
+eqnotnull3 f g = \x y z -> (not (isNull z)) ==> eq3 f g x y z
+
+class IsNull t where isNull :: t -> Bool
+instance IsNull L.ByteString where isNull = L.null
+instance IsNull P.ByteString where isNull = P.null
+
+------------------------------------------------------------------------
+
+
+--
+-- ByteString.Lazy <=> ByteString
+--
+
+prop_concatBP = L.concat `eq1` P.concat
+prop_nullBP = L.null `eq1` P.null
+prop_reverseBP = L.reverse `eq1` P.reverse
+prop_transposeBP = L.transpose `eq1` P.transpose
+prop_groupBP = L.group `eq1` P.group
+prop_initsBP = L.inits `eq1` P.inits
+prop_tailsBP = L.tails `eq1` P.tails
+prop_allBP = L.all `eq2` P.all
+prop_anyBP = L.any `eq2` P.any
+prop_appendBP = L.append `eq2` P.append
+prop_breakBP = L.break `eq2` P.break
+-- prop_concatMapBP = L.concatMap `eq2` P.concatMap
+prop_consBP = L.cons `eq2` P.cons
+prop_countBP = L.count `eq2` P.count
+prop_dropBP = L.drop `eq2` P.drop
+prop_dropWhileBP = L.dropWhile `eq2` P.dropWhile
+prop_filterBP = L.filter `eq2` P.filter
+prop_findBP = L.find `eq2` P.find
+prop_findIndexBP = L.findIndex `eq2` P.findIndex
+prop_findIndicesBP = L.findIndices `eq2` P.findIndices
+prop_isPrefixOfBP = L.isPrefixOf `eq2` P.isPrefixOf
+prop_mapBP = L.map `eq2` P.map
+prop_replicateBP = L.replicate `eq2` P.replicate
+prop_snocBP = L.snoc `eq2` P.snoc
+prop_spanBP = L.span `eq2` P.span
+prop_splitBP = L.split `eq2` P.split
+prop_splitAtBP = L.splitAt `eq2` P.splitAt
+prop_takeBP = L.take `eq2` P.take
+prop_takeWhileBP = L.takeWhile `eq2` P.takeWhile
+prop_elemBP = L.elem `eq2` P.elem
+prop_notElemBP = L.notElem `eq2` P.notElem
+prop_elemIndexBP = L.elemIndex `eq2` P.elemIndex
+prop_elemIndicesBP = L.elemIndices `eq2` P.elemIndices
+prop_lengthBP = L.length `eq1` (fromIntegral . P.length :: P.ByteString -> Int64)
+prop_readIntBP = D.readInt `eq1` C.readInt
+prop_linesBP = D.lines `eq1` C.lines
+
+prop_headBP = L.head `eqnotnull1` P.head
+prop_initBP = L.init `eqnotnull1` P.init
+prop_lastBP = L.last `eqnotnull1` P.last
+prop_maximumBP = L.maximum `eqnotnull1` P.maximum
+prop_minimumBP = L.minimum `eqnotnull1` P.minimum
+prop_tailBP = L.tail `eqnotnull1` P.tail
+prop_foldl1BP = L.foldl1 `eqnotnull2` P.foldl1
+prop_foldl1BP' = L.foldl1' `eqnotnull2` P.foldl1'
+prop_foldr1BP = L.foldr1 `eqnotnull2` P.foldr1
+prop_scanlBP = L.scanl `eqnotnull3` P.scanl
+
+prop_eqBP = eq2
+ ((==) :: B -> B -> Bool)
+ ((==) :: P -> P -> Bool)
+prop_compareBP = eq2
+ ((compare) :: B -> B -> Ordering)
+ ((compare) :: P -> P -> Ordering)
+prop_foldlBP = eq3
+ (L.foldl :: (X -> W -> X) -> X -> B -> X)
+ (P.foldl :: (X -> W -> X) -> X -> P -> X)
+prop_foldlBP' = eq3
+ (L.foldl' :: (X -> W -> X) -> X -> B -> X)
+ (P.foldl' :: (X -> W -> X) -> X -> P -> X)
+prop_foldrBP = eq3
+ (L.foldr :: (W -> X -> X) -> X -> B -> X)
+ (P.foldr :: (W -> X -> X) -> X -> P -> X)
+prop_mapAccumLBP = eq3
+ (L.mapAccumL :: (X -> W -> (X,W)) -> X -> B -> (X, B))
+ (P.mapAccumL :: (X -> W -> (X,W)) -> X -> P -> (X, P))
+
+prop_unfoldrBP = eq3
+ ((\n f a -> L.take (fromIntegral n) $
+ L.unfoldr f a) :: Int -> (X -> Maybe (W,X)) -> X -> B)
+ ((\n f a -> fst $
+ P.unfoldrN n f a) :: Int -> (X -> Maybe (W,X)) -> X -> P)
+
+--
+-- properties comparing ByteString.Lazy `eq1` List
+--
+
+prop_concatBL = L.concat `eq1` (concat :: [[W]] -> [W])
+prop_lengthBL = L.length `eq1` (length :: [W] -> Int)
+prop_nullBL = L.null `eq1` (null :: [W] -> Bool)
+prop_reverseBL = L.reverse `eq1` (reverse :: [W] -> [W])
+prop_transposeBL = L.transpose `eq1` (transpose :: [[W]] -> [[W]])
+prop_groupBL = L.group `eq1` (group :: [W] -> [[W]])
+prop_initsBL = L.inits `eq1` (inits :: [W] -> [[W]])
+prop_tailsBL = L.tails `eq1` (tails :: [W] -> [[W]])
+prop_allBL = L.all `eq2` (all :: (W -> Bool) -> [W] -> Bool)
+prop_anyBL = L.any `eq2` (any :: (W -> Bool) -> [W] -> Bool)
+prop_appendBL = L.append `eq2` ((++) :: [W] -> [W] -> [W])
+prop_breakBL = L.break `eq2` (break :: (W -> Bool) -> [W] -> ([W],[W]))
+-- prop_concatMapBL = L.concatMap `eq2` (concatMap :: (W -> [W]) -> [W] -> [W])
+prop_consBL = L.cons `eq2` ((:) :: W -> [W] -> [W])
+prop_dropBL = L.drop `eq2` (drop :: Int -> [W] -> [W])
+prop_dropWhileBL = L.dropWhile `eq2` (dropWhile :: (W -> Bool) -> [W] -> [W])
+prop_filterBL = L.filter `eq2` (filter :: (W -> Bool ) -> [W] -> [W])
+prop_findBL = L.find `eq2` (find :: (W -> Bool) -> [W] -> Maybe W)
+prop_findIndicesBL = L.findIndices `eq2` (findIndices:: (W -> Bool) -> [W] -> [Int])
+prop_findIndexBL = L.findIndex `eq2` (findIndex :: (W -> Bool) -> [W] -> Maybe Int)
+prop_isPrefixOfBL = L.isPrefixOf `eq2` (isPrefixOf:: [W] -> [W] -> Bool)
+prop_mapBL = L.map `eq2` (map :: (W -> W) -> [W] -> [W])
+prop_replicateBL = L.replicate `eq2` (replicate :: Int -> W -> [W])
+prop_snocBL = L.snoc `eq2` ((\xs x -> xs ++ [x]) :: [W] -> W -> [W])
+prop_spanBL = L.span `eq2` (span :: (W -> Bool) -> [W] -> ([W],[W]))
+prop_splitAtBL = L.splitAt `eq2` (splitAt :: Int -> [W] -> ([W],[W]))
+prop_takeBL = L.take `eq2` (take :: Int -> [W] -> [W])
+prop_takeWhileBL = L.takeWhile `eq2` (takeWhile :: (W -> Bool) -> [W] -> [W])
+prop_elemBL = L.elem `eq2` (elem :: W -> [W] -> Bool)
+prop_notElemBL = L.notElem `eq2` (notElem :: W -> [W] -> Bool)
+prop_elemIndexBL = L.elemIndex `eq2` (elemIndex :: W -> [W] -> Maybe Int)
+prop_elemIndicesBL = L.elemIndices `eq2` (elemIndices:: W -> [W] -> [Int])
+prop_linesBL = D.lines `eq1` (lines :: String -> [String])
+
+prop_foldl1BL = L.foldl1 `eqnotnull2` (foldl1 :: (W -> W -> W) -> [W] -> W)
+prop_foldl1BL' = L.foldl1' `eqnotnull2` (foldl1' :: (W -> W -> W) -> [W] -> W)
+prop_foldr1BL = L.foldr1 `eqnotnull2` (foldr1 :: (W -> W -> W) -> [W] -> W)
+prop_headBL = L.head `eqnotnull1` (head :: [W] -> W)
+prop_initBL = L.init `eqnotnull1` (init :: [W] -> [W])
+prop_lastBL = L.last `eqnotnull1` (last :: [W] -> W)
+prop_maximumBL = L.maximum `eqnotnull1` (maximum :: [W] -> W)
+prop_minimumBL = L.minimum `eqnotnull1` (minimum :: [W] -> W)
+prop_tailBL = L.tail `eqnotnull1` (tail :: [W] -> [W])
+
+prop_eqBL = eq2
+ ((==) :: B -> B -> Bool)
+ ((==) :: [W] -> [W] -> Bool)
+prop_compareBL = eq2
+ ((compare) :: B -> B -> Ordering)
+ ((compare) :: [W] -> [W] -> Ordering)
+prop_foldlBL = eq3
+ (L.foldl :: (X -> W -> X) -> X -> B -> X)
+ ( foldl :: (X -> W -> X) -> X -> [W] -> X)
+prop_foldlBL' = eq3
+ (L.foldl' :: (X -> W -> X) -> X -> B -> X)
+ ( foldl' :: (X -> W -> X) -> X -> [W] -> X)
+prop_foldrBL = eq3
+ (L.foldr :: (W -> X -> X) -> X -> B -> X)
+ ( foldr :: (W -> X -> X) -> X -> [W] -> X)
+prop_mapAccumLBL = eq3
+ (L.mapAccumL :: (X -> W -> (X,W)) -> X -> B -> (X, B))
+ ( mapAccumL :: (X -> W -> (X,W)) -> X -> [W] -> (X, [W]))
+prop_unfoldrBL = eq3
+ ((\n f a -> L.take (fromIntegral n) $
+ L.unfoldr f a) :: Int -> (X -> Maybe (W,X)) -> X -> B)
+ ((\n f a -> take n $
+ unfoldr f a) :: Int -> (X -> Maybe (W,X)) -> X -> [W])
+
+--
+-- And finally, check correspondance between Data.ByteString and List
+--
+
+prop_lengthPL = (fromIntegral.P.length :: P -> Int) `eq1` (length :: [W] -> Int)
+prop_nullPL = P.null `eq1` (null :: [W] -> Bool)
+prop_reversePL = P.reverse `eq1` (reverse :: [W] -> [W])
+prop_transposePL = P.transpose `eq1` (transpose :: [[W]] -> [[W]])
+prop_groupPL = P.group `eq1` (group :: [W] -> [[W]])
+prop_initsPL = P.inits `eq1` (inits :: [W] -> [[W]])
+prop_tailsPL = P.tails `eq1` (tails :: [W] -> [[W]])
+prop_concatPL = P.concat `eq1` (concat :: [[W]] -> [W])
+prop_allPL = P.all `eq2` (all :: (W -> Bool) -> [W] -> Bool)
+prop_anyPL = P.any `eq2` (any :: (W -> Bool) -> [W] -> Bool)
+prop_appendPL = P.append `eq2` ((++) :: [W] -> [W] -> [W])
+prop_breakPL = P.break `eq2` (break :: (W -> Bool) -> [W] -> ([W],[W]))
+-- prop_concatMapPL = P.concatMap `eq2` (concatMap :: (W -> [W]) -> [W] -> [W])
+prop_consPL = P.cons `eq2` ((:) :: W -> [W] -> [W])
+prop_dropPL = P.drop `eq2` (drop :: Int -> [W] -> [W])
+prop_dropWhilePL = P.dropWhile `eq2` (dropWhile :: (W -> Bool) -> [W] -> [W])
+prop_filterPL = P.filter `eq2` (filter :: (W -> Bool ) -> [W] -> [W])
+prop_findPL = P.find `eq2` (find :: (W -> Bool) -> [W] -> Maybe W)
+prop_findIndexPL = P.findIndex `eq2` (findIndex :: (W -> Bool) -> [W] -> Maybe Int)
+prop_isPrefixOfPL = P.isPrefixOf`eq2` (isPrefixOf:: [W] -> [W] -> Bool)
+prop_mapPL = P.map `eq2` (map :: (W -> W) -> [W] -> [W])
+prop_replicatePL = P.replicate `eq2` (replicate :: Int -> W -> [W])
+prop_snocPL = P.snoc `eq2` ((\xs x -> xs ++ [x]) :: [W] -> W -> [W])
+prop_spanPL = P.span `eq2` (span :: (W -> Bool) -> [W] -> ([W],[W]))
+prop_splitAtPL = P.splitAt `eq2` (splitAt :: Int -> [W] -> ([W],[W]))
+prop_takePL = P.take `eq2` (take :: Int -> [W] -> [W])
+prop_takeWhilePL = P.takeWhile `eq2` (takeWhile :: (W -> Bool) -> [W] -> [W])
+prop_elemPL = P.elem `eq2` (elem :: W -> [W] -> Bool)
+prop_notElemPL = P.notElem `eq2` (notElem :: W -> [W] -> Bool)
+prop_elemIndexPL = P.elemIndex `eq2` (elemIndex :: W -> [W] -> Maybe Int)
+prop_linesPL = C.lines `eq1` (lines :: String -> [String])
+prop_findIndicesPL= P.findIndices`eq2` (findIndices:: (W -> Bool) -> [W] -> [Int])
+prop_elemIndicesPL= P.elemIndices`eq2` (elemIndices:: W -> [W] -> [Int])
+
+prop_foldl1PL = P.foldl1 `eqnotnull2` (foldl1 :: (W -> W -> W) -> [W] -> W)
+prop_foldl1PL' = P.foldl1' `eqnotnull2` (foldl1' :: (W -> W -> W) -> [W] -> W)
+prop_foldr1PL = P.foldr1 `eqnotnull2` (foldr1 :: (W -> W -> W) -> [W] -> W)
+prop_scanlPL = P.scanl `eqnotnull3` (scanl :: (W -> W -> W) -> W -> [W] -> [W])
+prop_scanl1PL = P.scanl1 `eqnotnull2` (scanl1 :: (W -> W -> W) -> [W] -> [W])
+prop_scanrPL = P.scanr `eqnotnull3` (scanr :: (W -> W -> W) -> W -> [W] -> [W])
+prop_scanr1PL = P.scanr1 `eqnotnull2` (scanr1 :: (W -> W -> W) -> [W] -> [W])
+prop_headPL = P.head `eqnotnull1` (head :: [W] -> W)
+prop_initPL = P.init `eqnotnull1` (init :: [W] -> [W])
+prop_lastPL = P.last `eqnotnull1` (last :: [W] -> W)
+prop_maximumPL = P.maximum `eqnotnull1` (maximum :: [W] -> W)
+prop_minimumPL = P.minimum `eqnotnull1` (minimum :: [W] -> W)
+prop_tailPL = P.tail `eqnotnull1` (tail :: [W] -> [W])
+
+prop_eqPL = eq2
+ ((==) :: P -> P -> Bool)
+ ((==) :: [W] -> [W] -> Bool)
+prop_comparePL = eq2
+ ((compare) :: P -> P -> Ordering)
+ ((compare) :: [W] -> [W] -> Ordering)
+prop_foldlPL = eq3
+ (P.foldl :: (X -> W -> X) -> X -> P -> X)
+ ( foldl :: (X -> W -> X) -> X -> [W] -> X)
+prop_foldlPL' = eq3
+ (P.foldl' :: (X -> W -> X) -> X -> P -> X)
+ ( foldl' :: (X -> W -> X) -> X -> [W] -> X)
+prop_foldrPL = eq3
+ (P.foldr :: (W -> X -> X) -> X -> P -> X)
+ ( foldr :: (W -> X -> X) -> X -> [W] -> X)
+prop_mapAccumLPL= eq3
+ (P.mapAccumL :: (X -> W -> (X,W)) -> X -> P -> (X, P))
+ ( mapAccumL :: (X -> W -> (X,W)) -> X -> [W] -> (X, [W]))
+prop_mapAccumRPL= eq3
+ (P.mapAccumR :: (X -> W -> (X,W)) -> X -> P -> (X, P))
+ ( mapAccumR :: (X -> W -> (X,W)) -> X -> [W] -> (X, [W]))
+prop_unfoldrPL = eq3
+ ((\n f a -> fst $
+ P.unfoldrN n f a) :: Int -> (X -> Maybe (W,X)) -> X -> P)
+ ((\n f a -> take n $
+ unfoldr f a) :: Int -> (X -> Maybe (W,X)) -> X -> [W])
+
+------------------------------------------------------------------------
+--
+-- And check fusion RULES.
+--
+
+prop_lazylooploop em1 em2 start1 start2 arr =
+ loopL em2 start2 (loopArr (loopL em1 start1 arr)) ==
+ loopSndAcc (loopL (em1 `fuseEFL` em2) (start1 :*: start2) arr)
+ where
+ _ = start1 :: Int
+ _ = start2 :: Int
+
+prop_looploop em1 em2 start1 start2 arr =
+ loopU em2 start2 (loopArr (loopU em1 start1 arr)) ==
+ loopSndAcc (loopU (em1 `fuseEFL` em2) (start1 :*: start2) arr)
+ where
+ _ = start1 :: Int
+ _ = start2 :: Int
+
+------------------------------------------------------------------------
+
+-- check associativity of sequence loops
+prop_sequenceloops_assoc n m o x y z a1 a2 a3 xs =
+
+ k ((f * g) * h) == k (f * (g * h)) -- associativity
+
+ where
+ (*) = sequenceLoops
+ f = (sel n) x a1
+ g = (sel m) y a2
+ h = (sel o) z a3
+
+ _ = a1 :: Int; _ = a2 :: Int; _ = a3 :: Int
+ k g = loopArr (loopWrapper g xs)
+
+-- check wrapper elimination
+prop_loop_loop_wrapper_elimination n m x y a1 a2 xs =
+ loopWrapper g (loopArr (loopWrapper f xs)) ==
+ loopSndAcc (loopWrapper (sequenceLoops f g) xs)
+ where
+ f = (sel n) x a1
+ g = (sel m) y a2
+ _ = a1 :: Int; _ = a2 :: Int
+
+sel :: Bool
+ -> (acc -> Word8 -> PairS acc (MaybeS Word8))
+ -> acc
+ -> Ptr Word8
+ -> Ptr Word8
+ -> Int
+ -> IO (PairS (PairS acc Int) Int)
+sel False = doDownLoop
+sel True = doUpLoop
+
+------------------------------------------------------------------------
+--
+-- Test fusion forms
+--
+
+prop_up_up_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doUpLoop f1 acc1) (doUpLoop f2 acc2)) ==
+ k (doUpLoop (f1 `fuseAccAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int; k g = loopWrapper g xs
+
+prop_down_down_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doDownLoop f1 acc1) (doDownLoop f2 acc2)) ==
+ k (doDownLoop (f1 `fuseAccAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int ; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_noAcc_noAcc_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doNoAccLoop f1 acc1) (doNoAccLoop f2 acc2)) ==
+ k (doNoAccLoop (f1 `fuseNoAccNoAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int ; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_noAcc_up_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doNoAccLoop f1 acc1) (doUpLoop f2 acc2)) ==
+ k (doUpLoop (f1 `fuseNoAccAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int; k g = loopWrapper g xs
+
+prop_up_noAcc_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doUpLoop f1 acc1) (doNoAccLoop f2 acc2)) ==
+ k (doUpLoop (f1 `fuseAccNoAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int; k g = loopWrapper g xs
+
+prop_noAcc_down_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doNoAccLoop f1 acc1) (doDownLoop f2 acc2)) ==
+ k (doDownLoop (f1 `fuseNoAccAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_down_noAcc_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doDownLoop f1 acc1) (doNoAccLoop f2 acc2)) ==
+ k (doDownLoop (f1 `fuseAccNoAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int; k g = loopWrapper g xs
+
+prop_map_map_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doMapLoop f1 acc1) (doMapLoop f2 acc2)) ==
+ k (doMapLoop (f1 `fuseMapMapEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_filter_filter_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doFilterLoop f1 acc1) (doFilterLoop f2 acc2)) ==
+ k (doFilterLoop (f1 `fuseFilterFilterEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_map_filter_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doMapLoop f1 acc1) (doFilterLoop f2 acc2)) ==
+ k (doNoAccLoop (f1 `fuseMapFilterEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_filter_map_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doFilterLoop f1 acc1) (doMapLoop f2 acc2)) ==
+ k (doNoAccLoop (f1 `fuseFilterMapEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_map_noAcc_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doMapLoop f1 acc1) (doNoAccLoop f2 acc2)) ==
+ k (doNoAccLoop (f1 `fuseMapNoAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_noAcc_map_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doNoAccLoop f1 acc1) (doMapLoop f2 acc2)) ==
+ k (doNoAccLoop (f1 `fuseNoAccMapEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_map_up_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doMapLoop f1 acc1) (doUpLoop f2 acc2)) ==
+ k (doUpLoop (f1 `fuseMapAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_up_map_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doUpLoop f1 acc1) (doMapLoop f2 acc2)) ==
+ k (doUpLoop (f1 `fuseAccMapEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_map_down_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doMapLoop f1 acc1) (doDownLoop f2 acc2)) ==
+ k (doDownLoop (f1 `fuseMapAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_down_map_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doDownLoop f1 acc1) (doMapLoop f2 acc2)) ==
+ k (doDownLoop (f1 `fuseAccMapEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_filter_noAcc_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doFilterLoop f1 acc1) (doNoAccLoop f2 acc2)) ==
+ k (doNoAccLoop (f1 `fuseFilterNoAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_noAcc_filter_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doNoAccLoop f1 acc1) (doFilterLoop f2 acc2)) ==
+ k (doNoAccLoop (f1 `fuseNoAccFilterEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_filter_up_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doFilterLoop f1 acc1) (doUpLoop f2 acc2)) ==
+ k (doUpLoop (f1 `fuseFilterAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_up_filter_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doUpLoop f1 acc1) (doFilterLoop f2 acc2)) ==
+ k (doUpLoop (f1 `fuseAccFilterEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_filter_down_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doFilterLoop f1 acc1) (doDownLoop f2 acc2)) ==
+ k (doDownLoop (f1 `fuseFilterAccEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+prop_down_filter_loop_fusion f1 f2 acc1 acc2 xs =
+ k (sequenceLoops (doDownLoop f1 acc1) (doFilterLoop f2 acc2)) ==
+ k (doDownLoop (f1 `fuseAccFilterEFL` f2) (acc1 :*: acc2))
+ where _ = acc1 :: Int; _ = acc2 :: Int ; k g = loopWrapper g xs
+
+------------------------------------------------------------------------
+
+prop_length_loop_fusion_1 f1 acc1 xs =
+ P.length (loopArr (loopWrapper (doUpLoop f1 acc1) xs)) ==
+ P.foldl' (const . (+1)) 0 (loopArr (loopWrapper (doUpLoop f1 acc1) xs))
+ where _ = acc1 :: Int
+
+prop_length_loop_fusion_2 f1 acc1 xs =
+ P.length (loopArr (loopWrapper (doDownLoop f1 acc1) xs)) ==
+ P.foldl' (const . (+1)) 0 (loopArr (loopWrapper (doDownLoop f1 acc1) xs))
+ where _ = acc1 :: Int
+
+prop_length_loop_fusion_3 f1 acc1 xs =
+ P.length (loopArr (loopWrapper (doMapLoop f1 acc1) xs)) ==
+ P.foldl' (const . (+1)) 0 (loopArr (loopWrapper (doMapLoop f1 acc1) xs))
+ where _ = acc1 :: Int
+
+prop_length_loop_fusion_4 f1 acc1 xs =
+ P.length (loopArr (loopWrapper (doFilterLoop f1 acc1) xs)) ==
+ P.foldl' (const . (+1)) 0 (loopArr (loopWrapper (doFilterLoop f1 acc1) xs))
+ where _ = acc1 :: Int
+
+------------------------------------------------------------------------
+-- The entry point
+
+main :: IO ()
+main = myrun tests
+
+myrun :: [(String, Int -> IO ())] -> IO ()
+myrun tests = do
+ x <- getArgs
+ let n = if null x then 100 else read . head $ x
+ mapM_ (\(s,a) -> printf "%-25s: " s >> a n) tests
+
+--
+-- And now a list of all the properties to test.
+--
+
+tests = misc_tests
+ ++ bl_tests
+ ++ bp_tests
+ ++ pl_tests
+ ++ fusion_tests
+
+misc_tests =
+ [("invariant", mytest prop_invariant)]
+
+------------------------------------------------------------------------
+-- ByteString.Lazy <=> List
+
+bl_tests =
+ [("all", mytest prop_allBL)
+ ,("any", mytest prop_anyBL)
+ ,("append", mytest prop_appendBL)
+ ,("compare", mytest prop_compareBL)
+ ,("concat", mytest prop_concatBL)
+ ,("cons", mytest prop_consBL)
+ ,("eq", mytest prop_eqBL)
+ ,("filter", mytest prop_filterBL)
+ ,("find", mytest prop_findBL)
+ ,("findIndex", mytest prop_findIndexBL)
+ ,("findIndices", mytest prop_findIndicesBL)
+ ,("foldl", mytest prop_foldlBL)
+ ,("foldl'", mytest prop_foldlBL')
+ ,("foldl1", mytest prop_foldl1BL)
+ ,("foldl1'", mytest prop_foldl1BL')
+ ,("foldr", mytest prop_foldrBL)
+ ,("foldr1", mytest prop_foldr1BL)
+ ,("mapAccumL", mytest prop_mapAccumLBL)
+ ,("unfoldr", mytest prop_unfoldrBL)
+ ,("head", mytest prop_headBL)
+ ,("init", mytest prop_initBL)
+ ,("isPrefixOf", mytest prop_isPrefixOfBL)
+ ,("last", mytest prop_lastBL)
+ ,("length", mytest prop_lengthBL)
+ ,("map", mytest prop_mapBL)
+ ,("maximum", mytest prop_maximumBL)
+ ,("minimum", mytest prop_minimumBL)
+ ,("null", mytest prop_nullBL)
+ ,("reverse", mytest prop_reverseBL)
+ ,("snoc", mytest prop_snocBL)
+ ,("tail", mytest prop_tailBL)
+ ,("transpose", mytest prop_transposeBL)
+ ,("replicate", mytest prop_replicateBL)
+ ,("take", mytest prop_takeBL)
+ ,("drop", mytest prop_dropBL)
+ ,("splitAt", mytest prop_splitAtBL)
+ ,("takeWhile", mytest prop_takeWhileBL)
+ ,("dropWhile", mytest prop_dropWhileBL)
+ ,("break", mytest prop_breakBL)
+ ,("span", mytest prop_spanBL)
+ ,("group", mytest prop_groupBL)
+ ,("inits", mytest prop_initsBL)
+ ,("tails", mytest prop_tailsBL)
+ ,("elem", mytest prop_elemBL)
+ ,("notElem", mytest prop_notElemBL)
+ ,("lines", mytest prop_linesBL)
+ ,("elemIndex", mytest prop_elemIndexBL)
+ ,("elemIndices", mytest prop_elemIndicesBL)
+-- ,("concatMap", mytest prop_concatMapBL)
+ ]
+
+------------------------------------------------------------------------
+-- ByteString.Lazy <=> ByteString
+
+bp_tests =
+ [("all", mytest prop_allBP)
+ ,("any", mytest prop_anyBP)
+ ,("append", mytest prop_appendBP)
+ ,("compare", mytest prop_compareBP)
+ ,("concat", mytest prop_concatBP)
+ ,("cons", mytest prop_consBP)
+ ,("eq", mytest prop_eqBP)
+ ,("filter", mytest prop_filterBP)
+ ,("find", mytest prop_findBP)
+ ,("findIndex", mytest prop_findIndexBP)
+ ,("findIndices", mytest prop_findIndicesBP)
+ ,("foldl", mytest prop_foldlBP)
+ ,("foldl'", mytest prop_foldlBP')
+ ,("foldl1", mytest prop_foldl1BP)
+ ,("foldl1'", mytest prop_foldl1BP')
+ ,("foldr", mytest prop_foldrBP)
+ ,("foldr1", mytest prop_foldr1BP)
+ ,("mapAccumL", mytest prop_mapAccumLBP)
+ ,("unfoldr", mytest prop_unfoldrBP)
+ ,("head", mytest prop_headBP)
+ ,("init", mytest prop_initBP)
+ ,("isPrefixOf", mytest prop_isPrefixOfBP)
+ ,("last", mytest prop_lastBP)
+ ,("length", mytest prop_lengthBP)
+ ,("readInt", mytest prop_readIntBP)
+ ,("lines", mytest prop_linesBP)
+ ,("map", mytest prop_mapBP)
+ ,("maximum ", mytest prop_maximumBP)
+ ,("minimum" , mytest prop_minimumBP)
+ ,("null", mytest prop_nullBP)
+ ,("reverse", mytest prop_reverseBP)
+ ,("snoc", mytest prop_snocBP)
+ ,("tail", mytest prop_tailBP)
+ ,("scanl", mytest prop_scanlBP)
+ ,("transpose", mytest prop_transposeBP)
+ ,("replicate", mytest prop_replicateBP)
+ ,("take", mytest prop_takeBP)
+ ,("drop", mytest prop_dropBP)
+ ,("splitAt", mytest prop_splitAtBP)
+ ,("takeWhile", mytest prop_takeWhileBP)
+ ,("dropWhile", mytest prop_dropWhileBP)
+ ,("break", mytest prop_breakBP)
+ ,("span", mytest prop_spanBP)
+ ,("split", mytest prop_splitBP)
+ ,("count", mytest prop_countBP)
+ ,("group", mytest prop_groupBP)
+ ,("inits", mytest prop_initsBP)
+ ,("tails", mytest prop_tailsBP)
+ ,("elem", mytest prop_elemBP)
+ ,("notElem", mytest prop_notElemBP)
+ ,("elemIndex", mytest prop_elemIndexBP)
+ ,("elemIndices", mytest prop_elemIndicesBP)
+-- ,("concatMap", mytest prop_concatMapBP)
+ ]
+
+------------------------------------------------------------------------
+-- ByteString <=> List
+
+pl_tests =
+ [("all", mytest prop_allPL)
+ ,("any", mytest prop_anyPL)
+ ,("append", mytest prop_appendPL)
+ ,("compare", mytest prop_comparePL)
+ ,("concat", mytest prop_concatPL)
+ ,("cons", mytest prop_consPL)
+ ,("eq", mytest prop_eqPL)
+ ,("filter", mytest prop_filterPL)
+ ,("find", mytest prop_findPL)
+ ,("findIndex", mytest prop_findIndexPL)
+ ,("findIndices", mytest prop_findIndicesPL)
+ ,("foldl", mytest prop_foldlPL)
+ ,("foldl'", mytest prop_foldlPL')
+ ,("foldl1", mytest prop_foldl1PL)
+ ,("foldl1'", mytest prop_foldl1PL')
+ ,("foldr1", mytest prop_foldr1PL)
+ ,("foldr", mytest prop_foldrPL)
+ ,("mapAccumL", mytest prop_mapAccumLPL)
+ ,("mapAccumR", mytest prop_mapAccumRPL)
+ ,("unfoldr", mytest prop_unfoldrPL)
+ ,("scanl", mytest prop_scanlPL)
+ ,("scanl1", mytest prop_scanl1PL)
+ ,("scanr", mytest prop_scanrPL)
+ ,("scanr1", mytest prop_scanr1PL)
+ ,("head", mytest prop_headPL)
+ ,("init", mytest prop_initPL)
+ ,("last", mytest prop_lastPL)
+ ,("maximum", mytest prop_maximumPL)
+ ,("minimum", mytest prop_minimumPL)
+ ,("tail", mytest prop_tailPL)
+ ,("isPrefixOf", mytest prop_isPrefixOfPL)
+ ,("length", mytest prop_lengthPL)
+ ,("map", mytest prop_mapPL)
+ ,("null", mytest prop_nullPL)
+ ,("reverse", mytest prop_reversePL)
+ ,("snoc", mytest prop_snocPL)
+ ,("transpose", mytest prop_transposePL)
+ ,("replicate", mytest prop_replicatePL)
+ ,("take", mytest prop_takePL)
+ ,("drop", mytest prop_dropPL)
+ ,("splitAt", mytest prop_splitAtPL)
+ ,("takeWhile", mytest prop_takeWhilePL)
+ ,("dropWhile", mytest prop_dropWhilePL)
+ ,("break", mytest prop_breakPL)
+ ,("span", mytest prop_spanPL)
+ ,("group", mytest prop_groupPL)
+ ,("inits", mytest prop_initsPL)
+ ,("tails", mytest prop_tailsPL)
+ ,("elem", mytest prop_elemPL)
+ ,("notElem", mytest prop_notElemPL)
+ ,("lines", mytest prop_linesBL)
+ ,("elemIndex", mytest prop_elemIndexPL)
+ ,("elemIndices", mytest prop_elemIndicesPL)
+-- ,("concatMap", mytest prop_concatMapPL)
+ ]
+
+------------------------------------------------------------------------
+-- Fusion rules
+
+fusion_tests =
+-- v1 fusion
+ [ ("lazy loop/loop fusion", mytest prop_lazylooploop)
+ , ("loop/loop fusion", mytest prop_looploop)
+
+-- v2 fusion
+ ,("loop/loop wrapper elim", mytest prop_loop_loop_wrapper_elimination)
+ ,("sequence association", mytest prop_sequenceloops_assoc)
+
+ ,("up/up loop fusion", mytest prop_up_up_loop_fusion)
+ ,("down/down loop fusion", mytest prop_down_down_loop_fusion)
+ ,("noAcc/noAcc loop fusion", mytest prop_noAcc_noAcc_loop_fusion)
+ ,("noAcc/up loop fusion", mytest prop_noAcc_up_loop_fusion)
+ ,("up/noAcc loop fusion", mytest prop_up_noAcc_loop_fusion)
+ ,("noAcc/down loop fusion", mytest prop_noAcc_down_loop_fusion)
+ ,("down/noAcc loop fusion", mytest prop_down_noAcc_loop_fusion)
+ ,("map/map loop fusion", mytest prop_map_map_loop_fusion)
+ ,("filter/filter loop fusion", mytest prop_filter_filter_loop_fusion)
+ ,("map/filter loop fusion", mytest prop_map_filter_loop_fusion)
+ ,("filter/map loop fusion", mytest prop_filter_map_loop_fusion)
+ ,("map/noAcc loop fusion", mytest prop_map_noAcc_loop_fusion)
+ ,("noAcc/map loop fusion", mytest prop_noAcc_map_loop_fusion)
+ ,("map/up loop fusion", mytest prop_map_up_loop_fusion)
+ ,("up/map loop fusion", mytest prop_up_map_loop_fusion)
+ ,("map/down loop fusion", mytest prop_map_down_fusion)
+ ,("down/map loop fusion", mytest prop_down_map_loop_fusion)
+ ,("filter/noAcc loop fusion", mytest prop_filter_noAcc_loop_fusion)
+ ,("noAcc/filter loop fusion", mytest prop_noAcc_filter_loop_fusion)
+ ,("filter/up loop fusion", mytest prop_filter_up_loop_fusion)
+ ,("up/filter loop fusion", mytest prop_up_filter_loop_fusion)
+ ,("filter/down loop fusion", mytest prop_filter_down_fusion)
+ ,("down/filter loop fusion", mytest prop_down_filter_loop_fusion)
+
+ ,("length/loop fusion", mytest prop_length_loop_fusion_1)
+ ,("length/loop fusion", mytest prop_length_loop_fusion_2)
+ ,("length/loop fusion", mytest prop_length_loop_fusion_3)
+ ,("length/loop fusion", mytest prop_length_loop_fusion_4)
+ ]
+
+
+------------------------------------------------------------------------
+--
+-- These are miscellaneous tests left over. Or else they test some
+-- property internal to a type (i.e. head . sort == minimum), without
+-- reference to a model type.
+--
+
+invariant :: L.ByteString -> Bool
+invariant L.Empty = True
+invariant (L.Chunk c cs) = not (P.null c) && invariant cs
+
+prop_invariant = invariant
+
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring001.stdout b/testsuite/tests/lib/Data.ByteString/bytestring001.stdout
new file mode 100644
index 0000000000..e2b220dc41
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring001.stdout
@@ -0,0 +1,185 @@
+invariant : OK, 100 tests.
+all : OK, 100 tests.
+any : OK, 100 tests.
+append : OK, 100 tests.
+compare : OK, 100 tests.
+concat : OK, 100 tests.
+cons : OK, 100 tests.
+eq : OK, 100 tests.
+filter : OK, 100 tests.
+find : OK, 100 tests.
+findIndex : OK, 100 tests.
+findIndices : OK, 100 tests.
+foldl : OK, 100 tests.
+foldl' : OK, 100 tests.
+foldl1 : OK, 100 tests.
+foldl1' : OK, 100 tests.
+foldr : OK, 100 tests.
+foldr1 : OK, 100 tests.
+mapAccumL : OK, 100 tests.
+unfoldr : OK, 100 tests.
+head : OK, 100 tests.
+init : OK, 100 tests.
+isPrefixOf : OK, 100 tests.
+last : OK, 100 tests.
+length : OK, 100 tests.
+map : OK, 100 tests.
+maximum : OK, 100 tests.
+minimum : OK, 100 tests.
+null : OK, 100 tests.
+reverse : OK, 100 tests.
+snoc : OK, 100 tests.
+tail : OK, 100 tests.
+transpose : OK, 100 tests.
+replicate : OK, 100 tests.
+take : OK, 100 tests.
+drop : OK, 100 tests.
+splitAt : OK, 100 tests.
+takeWhile : OK, 100 tests.
+dropWhile : OK, 100 tests.
+break : OK, 100 tests.
+span : OK, 100 tests.
+group : OK, 100 tests.
+inits : OK, 100 tests.
+tails : OK, 100 tests.
+elem : OK, 100 tests.
+notElem : OK, 100 tests.
+lines : OK, 100 tests.
+elemIndex : OK, 100 tests.
+elemIndices : OK, 100 tests.
+all : OK, 100 tests.
+any : OK, 100 tests.
+append : OK, 100 tests.
+compare : OK, 100 tests.
+concat : OK, 100 tests.
+cons : OK, 100 tests.
+eq : OK, 100 tests.
+filter : OK, 100 tests.
+find : OK, 100 tests.
+findIndex : OK, 100 tests.
+findIndices : OK, 100 tests.
+foldl : OK, 100 tests.
+foldl' : OK, 100 tests.
+foldl1 : OK, 100 tests.
+foldl1' : OK, 100 tests.
+foldr : OK, 100 tests.
+foldr1 : OK, 100 tests.
+mapAccumL : OK, 100 tests.
+unfoldr : OK, 100 tests.
+head : OK, 100 tests.
+init : OK, 100 tests.
+isPrefixOf : OK, 100 tests.
+last : OK, 100 tests.
+length : OK, 100 tests.
+readInt : OK, 100 tests.
+lines : OK, 100 tests.
+map : OK, 100 tests.
+maximum : OK, 100 tests.
+minimum : OK, 100 tests.
+null : OK, 100 tests.
+reverse : OK, 100 tests.
+snoc : OK, 100 tests.
+tail : OK, 100 tests.
+scanl : OK, 100 tests.
+transpose : OK, 100 tests.
+replicate : OK, 100 tests.
+take : OK, 100 tests.
+drop : OK, 100 tests.
+splitAt : OK, 100 tests.
+takeWhile : OK, 100 tests.
+dropWhile : OK, 100 tests.
+break : OK, 100 tests.
+span : OK, 100 tests.
+split : OK, 100 tests.
+count : OK, 100 tests.
+group : OK, 100 tests.
+inits : OK, 100 tests.
+tails : OK, 100 tests.
+elem : OK, 100 tests.
+notElem : OK, 100 tests.
+elemIndex : OK, 100 tests.
+elemIndices : OK, 100 tests.
+all : OK, 100 tests.
+any : OK, 100 tests.
+append : OK, 100 tests.
+compare : OK, 100 tests.
+concat : OK, 100 tests.
+cons : OK, 100 tests.
+eq : OK, 100 tests.
+filter : OK, 100 tests.
+find : OK, 100 tests.
+findIndex : OK, 100 tests.
+findIndices : OK, 100 tests.
+foldl : OK, 100 tests.
+foldl' : OK, 100 tests.
+foldl1 : OK, 100 tests.
+foldl1' : OK, 100 tests.
+foldr1 : OK, 100 tests.
+foldr : OK, 100 tests.
+mapAccumL : OK, 100 tests.
+mapAccumR : OK, 100 tests.
+unfoldr : OK, 100 tests.
+scanl : OK, 100 tests.
+scanl1 : OK, 100 tests.
+scanr : OK, 100 tests.
+scanr1 : OK, 100 tests.
+head : OK, 100 tests.
+init : OK, 100 tests.
+last : OK, 100 tests.
+maximum : OK, 100 tests.
+minimum : OK, 100 tests.
+tail : OK, 100 tests.
+isPrefixOf : OK, 100 tests.
+length : OK, 100 tests.
+map : OK, 100 tests.
+null : OK, 100 tests.
+reverse : OK, 100 tests.
+snoc : OK, 100 tests.
+transpose : OK, 100 tests.
+replicate : OK, 100 tests.
+take : OK, 100 tests.
+drop : OK, 100 tests.
+splitAt : OK, 100 tests.
+takeWhile : OK, 100 tests.
+dropWhile : OK, 100 tests.
+break : OK, 100 tests.
+span : OK, 100 tests.
+group : OK, 100 tests.
+inits : OK, 100 tests.
+tails : OK, 100 tests.
+elem : OK, 100 tests.
+notElem : OK, 100 tests.
+lines : OK, 100 tests.
+elemIndex : OK, 100 tests.
+elemIndices : OK, 100 tests.
+lazy loop/loop fusion : OK, 100 tests.
+loop/loop fusion : OK, 100 tests.
+loop/loop wrapper elim : OK, 100 tests.
+sequence association : OK, 100 tests.
+up/up loop fusion: OK, 100 tests.
+down/down loop fusion: OK, 100 tests.
+noAcc/noAcc loop fusion: OK, 100 tests.
+noAcc/up loop fusion: OK, 100 tests.
+up/noAcc loop fusion: OK, 100 tests.
+noAcc/down loop fusion: OK, 100 tests.
+down/noAcc loop fusion: OK, 100 tests.
+map/map loop fusion: OK, 100 tests.
+filter/filter loop fusion: OK, 100 tests.
+map/filter loop fusion: OK, 100 tests.
+filter/map loop fusion: OK, 100 tests.
+map/noAcc loop fusion: OK, 100 tests.
+noAcc/map loop fusion: OK, 100 tests.
+map/up loop fusion: OK, 100 tests.
+up/map loop fusion: OK, 100 tests.
+map/down loop fusion: OK, 100 tests.
+down/map loop fusion: OK, 100 tests.
+filter/noAcc loop fusion: OK, 100 tests.
+noAcc/filter loop fusion: OK, 100 tests.
+filter/up loop fusion: OK, 100 tests.
+up/filter loop fusion: OK, 100 tests.
+filter/down loop fusion: OK, 100 tests.
+down/filter loop fusion: OK, 100 tests.
+length/loop fusion : OK, 100 tests.
+length/loop fusion : OK, 100 tests.
+length/loop fusion : OK, 100 tests.
+length/loop fusion : OK, 100 tests.
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring002.hs b/testsuite/tests/lib/Data.ByteString/bytestring002.hs
new file mode 100644
index 0000000000..23d6cf270f
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring002.hs
@@ -0,0 +1,6 @@
+--
+-- The unix wc -l program
+--
+import qualified Data.ByteString as B
+
+main = print . B.count 10 =<< B.getContents
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring002.stdin b/testsuite/tests/lib/Data.ByteString/bytestring002.stdin
new file mode 100644
index 0000000000..abffbabe44
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring002.stdin
@@ -0,0 +1,1000 @@
+A
+a
+aa
+aal
+aalii
+aam
+Aani
+aardvark
+aardwolf
+Aaron
+Aaronic
+Aaronical
+Aaronite
+Aaronitic
+Aaru
+Ab
+aba
+Ababdeh
+Ababua
+abac
+abaca
+abacate
+abacay
+abacinate
+abacination
+abaciscus
+abacist
+aback
+abactinal
+abactinally
+abaction
+abactor
+abaculus
+abacus
+Abadite
+abaff
+abaft
+abaisance
+abaiser
+abaissed
+abalienate
+abalienation
+abalone
+Abama
+abampere
+abandon
+abandonable
+abandoned
+abandonedly
+abandonee
+abandoner
+abandonment
+Abanic
+Abantes
+abaptiston
+Abarambo
+Abaris
+abarthrosis
+abarticular
+abarticulation
+abas
+abase
+abased
+abasedly
+abasedness
+abasement
+abaser
+Abasgi
+abash
+abashed
+abashedly
+abashedness
+abashless
+abashlessly
+abashment
+abasia
+abasic
+abask
+Abassin
+abastardize
+abatable
+abate
+abatement
+abater
+abatis
+abatised
+abaton
+abator
+abattoir
+Abatua
+abature
+abave
+abaxial
+abaxile
+abaze
+abb
+Abba
+abbacomes
+abbacy
+Abbadide
+abbas
+abbasi
+abbassi
+Abbasside
+abbatial
+abbatical
+abbess
+abbey
+abbeystede
+Abbie
+abbot
+abbotcy
+abbotnullius
+abbotship
+abbreviate
+abbreviately
+abbreviation
+abbreviator
+abbreviatory
+abbreviature
+Abby
+abcoulomb
+abdal
+abdat
+Abderian
+Abderite
+abdest
+abdicable
+abdicant
+abdicate
+abdication
+abdicative
+abdicator
+Abdiel
+abditive
+abditory
+abdomen
+abdominal
+Abdominales
+abdominalian
+abdominally
+abdominoanterior
+abdominocardiac
+abdominocentesis
+abdominocystic
+abdominogenital
+abdominohysterectomy
+abdominohysterotomy
+abdominoposterior
+abdominoscope
+abdominoscopy
+abdominothoracic
+abdominous
+abdominovaginal
+abdominovesical
+abduce
+abducens
+abducent
+abduct
+abduction
+abductor
+Abe
+abeam
+abear
+abearance
+abecedarian
+abecedarium
+abecedary
+abed
+abeigh
+Abel
+abele
+Abelia
+Abelian
+Abelicea
+Abelite
+abelite
+Abelmoschus
+abelmosk
+Abelonian
+abeltree
+Abencerrages
+abenteric
+abepithymia
+Aberdeen
+aberdevine
+Aberdonian
+Aberia
+aberrance
+aberrancy
+aberrant
+aberrate
+aberration
+aberrational
+aberrator
+aberrometer
+aberroscope
+aberuncator
+abet
+abetment
+abettal
+abettor
+abevacuation
+abey
+abeyance
+abeyancy
+abeyant
+abfarad
+abhenry
+abhiseka
+abhominable
+abhor
+abhorrence
+abhorrency
+abhorrent
+abhorrently
+abhorrer
+abhorrible
+abhorring
+Abhorson
+abidal
+abidance
+abide
+abider
+abidi
+abiding
+abidingly
+abidingness
+Abie
+Abies
+abietate
+abietene
+abietic
+abietin
+Abietineae
+abietineous
+abietinic
+Abiezer
+Abigail
+abigail
+abigailship
+abigeat
+abigeus
+abilao
+ability
+abilla
+abilo
+abintestate
+abiogenesis
+abiogenesist
+abiogenetic
+abiogenetical
+abiogenetically
+abiogenist
+abiogenous
+abiogeny
+abiological
+abiologically
+abiology
+abiosis
+abiotic
+abiotrophic
+abiotrophy
+Abipon
+abir
+abirritant
+abirritate
+abirritation
+abirritative
+abiston
+Abitibi
+abiuret
+abject
+abjectedness
+abjection
+abjective
+abjectly
+abjectness
+abjoint
+abjudge
+abjudicate
+abjudication
+abjunction
+abjunctive
+abjuration
+abjuratory
+abjure
+abjurement
+abjurer
+abkar
+abkari
+Abkhas
+Abkhasian
+ablach
+ablactate
+ablactation
+ablare
+ablastemic
+ablastous
+ablate
+ablation
+ablatitious
+ablatival
+ablative
+ablator
+ablaut
+ablaze
+able
+ableeze
+ablegate
+ableness
+ablepharia
+ablepharon
+ablepharous
+Ablepharus
+ablepsia
+ableptical
+ableptically
+abler
+ablest
+ablewhackets
+ablins
+abloom
+ablow
+ablude
+abluent
+ablush
+ablution
+ablutionary
+abluvion
+ably
+abmho
+Abnaki
+abnegate
+abnegation
+abnegative
+abnegator
+Abner
+abnerval
+abnet
+abneural
+abnormal
+abnormalism
+abnormalist
+abnormality
+abnormalize
+abnormally
+abnormalness
+abnormity
+abnormous
+abnumerable
+Abo
+aboard
+Abobra
+abode
+abodement
+abody
+abohm
+aboil
+abolish
+abolisher
+abolishment
+abolition
+abolitionary
+abolitionism
+abolitionist
+abolitionize
+abolla
+aboma
+abomasum
+abomasus
+abominable
+abominableness
+abominably
+abominate
+abomination
+abominator
+abomine
+Abongo
+aboon
+aborad
+aboral
+aborally
+abord
+aboriginal
+aboriginality
+aboriginally
+aboriginary
+aborigine
+abort
+aborted
+aborticide
+abortient
+abortifacient
+abortin
+abortion
+abortional
+abortionist
+abortive
+abortively
+abortiveness
+abortus
+abouchement
+abound
+abounder
+abounding
+aboundingly
+about
+abouts
+above
+aboveboard
+abovedeck
+aboveground
+aboveproof
+abovestairs
+abox
+abracadabra
+abrachia
+abradant
+abrade
+abrader
+Abraham
+Abrahamic
+Abrahamidae
+Abrahamite
+Abrahamitic
+abraid
+Abram
+Abramis
+abranchial
+abranchialism
+abranchian
+Abranchiata
+abranchiate
+abranchious
+abrasax
+abrase
+abrash
+abrasiometer
+abrasion
+abrasive
+abrastol
+abraum
+abraxas
+abreact
+abreaction
+abreast
+abrenounce
+abret
+abrico
+abridge
+abridgeable
+abridged
+abridgedly
+abridger
+abridgment
+abrim
+abrin
+abristle
+abroach
+abroad
+Abrocoma
+abrocome
+abrogable
+abrogate
+abrogation
+abrogative
+abrogator
+Abroma
+Abronia
+abrook
+abrotanum
+abrotine
+abrupt
+abruptedly
+abruption
+abruptly
+abruptness
+Abrus
+Absalom
+absampere
+Absaroka
+absarokite
+abscess
+abscessed
+abscession
+abscessroot
+abscind
+abscise
+abscision
+absciss
+abscissa
+abscissae
+abscisse
+abscission
+absconce
+abscond
+absconded
+abscondedly
+abscondence
+absconder
+absconsa
+abscoulomb
+absence
+absent
+absentation
+absentee
+absenteeism
+absenteeship
+absenter
+absently
+absentment
+absentmindedly
+absentness
+absfarad
+abshenry
+Absi
+absinthe
+absinthial
+absinthian
+absinthiate
+absinthic
+absinthin
+absinthine
+absinthism
+absinthismic
+absinthium
+absinthol
+absit
+absmho
+absohm
+absolute
+absolutely
+absoluteness
+absolution
+absolutism
+absolutist
+absolutistic
+absolutistically
+absolutive
+absolutization
+absolutize
+absolutory
+absolvable
+absolvatory
+absolve
+absolvent
+absolver
+absolvitor
+absolvitory
+absonant
+absonous
+absorb
+absorbability
+absorbable
+absorbed
+absorbedly
+absorbedness
+absorbefacient
+absorbency
+absorbent
+absorber
+absorbing
+absorbingly
+absorbition
+absorpt
+absorptance
+absorptiometer
+absorptiometric
+absorption
+absorptive
+absorptively
+absorptiveness
+absorptivity
+absquatulate
+abstain
+abstainer
+abstainment
+abstemious
+abstemiously
+abstemiousness
+abstention
+abstentionist
+abstentious
+absterge
+abstergent
+abstersion
+abstersive
+abstersiveness
+abstinence
+abstinency
+abstinent
+abstinential
+abstinently
+abstract
+abstracted
+abstractedly
+abstractedness
+abstracter
+abstraction
+abstractional
+abstractionism
+abstractionist
+abstractitious
+abstractive
+abstractively
+abstractiveness
+abstractly
+abstractness
+abstractor
+abstrahent
+abstricted
+abstriction
+abstruse
+abstrusely
+abstruseness
+abstrusion
+abstrusity
+absume
+absumption
+absurd
+absurdity
+absurdly
+absurdness
+absvolt
+Absyrtus
+abterminal
+abthain
+abthainrie
+abthainry
+abthanage
+Abu
+abu
+abucco
+abulia
+abulic
+abulomania
+abuna
+abundance
+abundancy
+abundant
+Abundantia
+abundantly
+abura
+aburabozu
+aburban
+aburst
+aburton
+abusable
+abuse
+abusedly
+abusee
+abuseful
+abusefully
+abusefulness
+abuser
+abusion
+abusious
+abusive
+abusively
+abusiveness
+abut
+Abuta
+Abutilon
+abutment
+abuttal
+abutter
+abutting
+abuzz
+abvolt
+abwab
+aby
+abysm
+abysmal
+abysmally
+abyss
+abyssal
+Abyssinian
+abyssobenthonic
+abyssolith
+abyssopelagic
+acacatechin
+acacatechol
+acacetin
+Acacia
+Acacian
+acaciin
+acacin
+academe
+academial
+academian
+Academic
+academic
+academical
+academically
+academicals
+academician
+academicism
+academism
+academist
+academite
+academization
+academize
+Academus
+academy
+Acadia
+acadialite
+Acadian
+Acadie
+Acaena
+acajou
+acaleph
+Acalepha
+Acalephae
+acalephan
+acalephoid
+acalycal
+acalycine
+acalycinous
+acalyculate
+Acalypha
+Acalypterae
+Acalyptrata
+Acalyptratae
+acalyptrate
+Acamar
+acampsia
+acana
+acanaceous
+acanonical
+acanth
+acantha
+Acanthaceae
+acanthaceous
+acanthad
+Acantharia
+Acanthia
+acanthial
+acanthin
+acanthine
+acanthion
+acanthite
+acanthocarpous
+Acanthocephala
+acanthocephalan
+Acanthocephali
+acanthocephalous
+Acanthocereus
+acanthocladous
+Acanthodea
+acanthodean
+Acanthodei
+Acanthodes
+acanthodian
+Acanthodidae
+Acanthodii
+Acanthodini
+acanthoid
+Acantholimon
+acanthological
+acanthology
+acantholysis
+acanthoma
+Acanthomeridae
+acanthon
+Acanthopanax
+Acanthophis
+acanthophorous
+acanthopod
+acanthopodous
+acanthopomatous
+acanthopore
+acanthopteran
+Acanthopteri
+acanthopterous
+acanthopterygian
+Acanthopterygii
+acanthosis
+acanthous
+Acanthuridae
+Acanthurus
+acanthus
+acapnia
+acapnial
+acapsular
+acapu
+acapulco
+acara
+Acarapis
+acardia
+acardiac
+acari
+acarian
+acariasis
+acaricidal
+acaricide
+acarid
+Acarida
+Acaridea
+acaridean
+acaridomatium
+acariform
+Acarina
+acarine
+acarinosis
+acarocecidium
+acarodermatitis
+acaroid
+acarol
+acarologist
+acarology
+acarophilous
+acarophobia
+acarotoxic
+acarpelous
+acarpous
+Acarus
+Acastus
+acatalectic
+acatalepsia
+acatalepsy
+acataleptic
+acatallactic
+acatamathesia
+acataphasia
+acataposis
+acatastasia
+acatastatic
+acate
+acategorical
+acatery
+acatharsia
+acatharsy
+acatholic
+acaudal
+acaudate
+acaulescent
+acauline
+acaulose
+acaulous
+acca
+accede
+accedence
+acceder
+accelerable
+accelerando
+accelerant
+accelerate
+accelerated
+acceleratedly
+acceleration
+accelerative
+accelerator
+acceleratory
+accelerograph
+accelerometer
+accend
+accendibility
+accendible
+accension
+accensor
+accent
+accentless
+accentor
+accentuable
+accentual
+accentuality
+accentually
+accentuate
+accentuation
+accentuator
+accentus
+accept
+acceptability
+acceptable
+acceptableness
+acceptably
+acceptance
+acceptancy
+acceptant
+acceptation
+accepted
+acceptedly
+accepter
+acceptilate
+acceptilation
+acception
+acceptive
+acceptor
+acceptress
+accerse
+accersition
+accersitor
+access
+accessarily
+accessariness
+accessary
+accessaryship
+accessibility
+accessible
+accessibly
+accession
+accessional
+accessioner
+accessive
+accessively
+accessless
+accessorial
+accessorily
+accessoriness
+accessorius
+accessory
+accidence
+accidency
+accident
+accidental
+accidentalism
+accidentalist
+accidentality
+accidentally
+accidentalness
+accidented
+accidential
+accidentiality
+accidently
+accidia
+accidie
+accinge
+accipient
+Accipiter
+accipitral
+accipitrary
+Accipitres
+accipitrine
+accismus
+accite
+acclaim
+acclaimable
+acclaimer
+acclamation
+acclamator
+acclamatory
+acclimatable
+acclimatation
+acclimate
+acclimatement
+acclimation
+acclimatizable
+acclimatization
+acclimatize
+acclimatizer
+acclimature
+acclinal
+acclinate
+acclivitous
+acclivity
+acclivous
+accloy
+accoast
+accoil
+accolade
+accoladed
+accolated
+accolent
+accolle
+accombination
+accommodable
+accommodableness
+accommodate
+accommodately
+accommodateness
+accommodating
+accommodatingly
+accommodation
+accommodational
+accommodative
+accommodativeness
+accommodator
+accompanier
+accompaniment
+accompanimental
+accompanist
+accompany
+accompanyist
+accompletive
+accomplice
+accompliceship
+accomplicity
+accomplish
+accomplishable
+accomplished
+accomplisher
+accomplishment
+accomplisht
+accompt
+accord
+accordable
+accordance
+accordancy
+accordant
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring002.stdout b/testsuite/tests/lib/Data.ByteString/bytestring002.stdout
new file mode 100644
index 0000000000..83b33d238d
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring002.stdout
@@ -0,0 +1 @@
+1000
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring003.hs b/testsuite/tests/lib/Data.ByteString/bytestring003.hs
new file mode 100644
index 0000000000..c31ab8d17f
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring003.hs
@@ -0,0 +1,36 @@
+{-# OPTIONS -cpp #-}
+
+--
+-- 'sums' benchmark from the great language shootout
+--
+
+import System.IO
+import qualified Data.ByteString as B
+import Data.ByteString (ByteString)
+import Data.ByteString.Unsafe (unsafeTail,unsafeIndex)
+import Data.Char -- seems to help!
+
+#define STRICT2(f) f a b | a `seq` b `seq` False = undefined
+
+main = print . go 0 =<< B.getContents
+
+STRICT2(go)
+go i ps
+ | B.null ps = i
+ | x == 45 = neg 0 xs
+ | otherwise = pos (parse x) xs
+ where
+ (x, xs) = (ps `unsafeIndex` 0, unsafeTail ps)
+
+ STRICT2(neg)
+ neg n qs | x == 10 = go (i-n) xs
+ | otherwise = neg (parse x + (10 * n)) xs
+ where (x, xs) = (qs `unsafeIndex` 0, unsafeTail qs)
+
+ STRICT2(pos)
+ pos n qs | x == 10 = go (i+n) xs
+ | otherwise = pos (parse x + (10 * n)) xs
+ where (x, xs) = (qs `unsafeIndex` 0, unsafeTail qs)
+
+parse w = fromIntegral (w - 48) :: Int
+{-# INLINE parse #-}
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring003.stdin b/testsuite/tests/lib/Data.ByteString/bytestring003.stdin
new file mode 100644
index 0000000000..956aba1447
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring003.stdin
@@ -0,0 +1,1000 @@
+276
+498
+-981
+770
+-401
+702
+966
+950
+-853
+-53
+-293
+604
+288
+892
+-697
+204
+96
+408
+880
+-7
+-817
+422
+-261
+-485
+-77
+826
+184
+864
+-751
+626
+812
+-369
+-353
+-371
+488
+-83
+-659
+24
+524
+-21
+840
+-757
+-17
+-973
+-843
+260
+858
+-389
+-521
+-99
+482
+-561
+-213
+630
+766
+932
+112
+-419
+-877
+762
+266
+-837
+170
+834
+746
+764
+922
+-89
+576
+-63
+90
+684
+316
+506
+-959
+708
+70
+252
+-747
+342
+-593
+-895
+-937
+-707
+350
+588
+-201
+-683
+-113
+-511
+-867
+322
+202
+472
+150
+-9
+-643
+28
+336
+86
+-925
+836
+-473
+-451
+-971
+-805
+-619
+84
+-67
+806
+270
+366
+334
+-555
+-557
+-331
+-409
+-553
+-145
+-71
+528
+490
+492
+828
+628
+-961
+536
+-859
+-271
+974
+-671
+-749
+414
+-257
+778
+56
+598
+-437
+-899
+-785
+-987
+32
+-999
+132
+-821
+-209
+402
+-543
+194
+-967
+294
+-943
+-285
+-483
+-97
+660
+-481
+-829
+-309
+-597
+-855
+80
+-355
+192
+-823
+436
+916
+282
+-629
+612
+-329
+-535
+780
+-47
+706
+110
+756
+-857
+-933
+-345
+-523
+718
+-31
+902
+678
+540
+698
+456
+-399
+126
+412
+-563
+-321
+-487
+-641
+-195
+-199
+-955
+772
+570
+18
+-217
+886
+984
+-721
+-995
+46
+-989
+946
+64
+716
+-719
+-869
+-579
+776
+450
+936
+980
+-439
+-977
+-455
+-997
+6
+268
+-269
+-421
+328
+352
+578
+-575
+476
+976
+-57
+-469
+544
+582
+-43
+510
+-939
+-581
+-337
+-203
+-737
+-827
+852
+-279
+-803
+-911
+-865
+548
+48
+-75
+416
+-275
+688
+-255
+-687
+-461
+-233
+420
+912
+-901
+-299
+12
+568
+694
+-411
+-883
+-327
+-361
+-339
+646
+-137
+-905
+670
+686
+-131
+-849
+-825
+256
+228
+-841
+68
+368
+-909
+242
+298
+118
+10
+222
+954
+-493
+-459
+-445
+608
+-765
+34
+468
+-715
+690
+-185
+-551
+-571
+-241
+292
+92
+768
+-923
+956
+614
+8
+730
+208
+-417
+300
+136
+-59
+-251
+-539
+166
+798
+866
+454
+-391
+-317
+668
+502
+-15
+994
+854
+-189
+666
+446
+-565
+-5
+42
+-227
+-87
+-779
+26
+312
+354
+754
+396
+-515
+220
+872
+654
+88
+-667
+250
+572
+952
+72
+982
+972
+-529
+-471
+-533
+-427
+538
+154
+-457
+-819
+750
+152
+452
+-41
+838
+-489
+418
+-649
+-637
+-197
+74
+394
+-653
+-727
+-435
+-23
+348
+638
+-611
+914
+-357
+-743
+-685
+580
+-247
+-577
+54
+-931
+-3
+558
+-793
+-443
+-759
+162
+-811
+384
+720
+-117
+900
+-519
+-39
+744
+432
+286
+-873
+380
+-167
+-283
+430
+-155
+-755
+206
+100
+364
+-677
+332
+-567
+382
+-605
+-181
+676
+-475
+-845
+910
+546
+14
+398
+616
+-769
+424
+992
+-235
+-239
+774
+478
+-919
+168
+-771
+-773
+-69
+-509
+930
+550
+-463
+178
+-861
+-761
+-795
+234
+-831
+-61
+-979
+-851
+-665
+-709
+896
+742
+-123
+590
+-693
+-887
+-379
+144
+-717
+20
+174
+82
+464
+30
+-969
+-349
+-531
+-799
+-661
+-647
+-623
+878
+148
+-545
+238
+-259
+554
+726
+-37
+-797
+98
+78
+-591
+-975
+962
+120
+906
+-207
+656
+-171
+652
+188
+672
+-133
+-91
+224
+818
+-333
+-839
+-499
+22
+-739
+142
+378
+-403
+-315
+370
+284
+122
+230
+-527
+-127
+442
+534
+160
+722
+262
+-657
+304
+258
+-103
+960
+-495
+-265
+634
+-101
+480
+-363
+308
+76
+-949
+-585
+904
+146
+-703
+164
+850
+246
+732
+-725
+566
+274
+-163
+-935
+-681
+-229
+254
+-733
+-547
+-273
+-903
+736
+-711
+794
+392
+-655
+-549
+808
+-429
+484
+-701
+-617
+804
+36
+-775
+-335
+-927
+714
+-177
+-325
+-413
+-963
+114
+-253
+-789
+-645
+40
+434
+898
+924
+-19
+738
+788
+280
+-121
+594
+-913
+426
+816
+-373
+-45
+340
+-109
+-323
+58
+-249
+940
+-297
+988
+998
+-607
+-745
+-633
+-115
+996
+-893
+696
+400
+848
+500
+-263
+562
+-807
+-105
+-603
+658
+-73
+-863
+448
+680
+-157
+-161
+728
+814
+-477
+-375
+1000
+-631
+-991
+362
+156
+-187
+-705
+-917
+-449
+-741
+556
+440
+-589
+-11
+-359
+-891
+-801
+-153
+-381
+938
+-173
+-243
+618
+-599
+-497
+486
+128
+790
+460
+-27
+-305
+-205
+-215
+324
+-341
+50
+458
+52
+-621
+874
+386
+560
+-569
+-51
+802
+786
+920
+-425
+466
+444
+-507
+-915
+346
+622
+-679
+784
+-689
+388
+508
+-613
+-313
+-447
+564
+-897
+-211
+-225
+-615
+-367
+186
+894
+-65
+-453
+-245
+602
+496
+-651
+-601
+820
+226
+-695
+-119
+372
+180
+94
+214
+542
+648
+-871
+592
+584
+824
+796
+374
+-945
+-311
+516
+942
+-221
+-433
+200
+-465
+-953
+870
+868
+-879
+518
+356
+-223
+682
+990
+-191
+-541
+-951
+-921
+-319
+-169
+-291
+-289
+792
+876
+306
+-491
+326
+-885
+62
+514
+-929
+318
+-231
+632
+44
+-107
+644
+-267
+-343
+-847
+934
+734
+-505
+-351
+574
+-627
+636
+-93
+-431
+-835
+428
+-183
+-151
+2
+-813
+-595
+958
+-141
+692
+-385
+610
+-179
+376
+948
+198
+-675
+964
+-907
+918
+-165
+-1
+406
+748
+-111
+532
+-55
+-281
+740
+504
+236
+-29
+662
+-713
+-537
+196
+-587
+822
+-135
+700
+-35
+674
+-407
+240
+-673
+-669
+-393
+470
+-525
+-875
+-383
+-625
+296
+-85
+-147
+-277
+800
+-691
+-143
+16
+-983
+-303
+290
+-139
+172
+320
+512
+596
+640
+664
+-791
+-783
+-387
+-735
+-467
+-301
+810
+134
+216
+278
+176
+606
+140
+-787
+978
+586
+890
+882
+-753
+-13
+970
+-941
+-175
+-777
+-809
+-441
+-347
+-377
+390
+-423
+842
+642
+190
+302
+438
+704
+310
+-49
+124
+-781
+-287
+724
+-767
+830
+620
+-295
+244
+-159
+-307
+-397
+66
+-237
+314
+-79
+624
+710
+272
+-365
+928
+856
+138
+-479
+520
+832
+862
+760
+846
+-81
+106
+-513
+-193
+650
+782
+-517
+944
+218
+712
+-663
+-559
+462
+-635
+-25
+182
+530
+844
+330
+-833
+102
+-881
+108
+-947
+-763
+-405
+232
+410
+104
+-729
+-149
+-889
+888
+360
+968
+908
+116
+-815
+-129
+522
+-723
+-993
+860
+-503
+926
+-219
+-415
+60
+158
+-609
+-501
+986
+-699
+-583
+884
+212
+210
+-957
+526
+-985
+552
+344
+-395
+-95
+338
+248
+494
+130
+404
+358
+600
+-639
+-125
+-33
+-965
+752
+474
+-731
+758
+-573
+4
+38
+264
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring003.stdout b/testsuite/tests/lib/Data.ByteString/bytestring003.stdout
new file mode 100644
index 0000000000..1b79f38e25
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring003.stdout
@@ -0,0 +1 @@
+500
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring004.hs b/testsuite/tests/lib/Data.ByteString/bytestring004.hs
new file mode 100644
index 0000000000..5c4df86a90
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring004.hs
@@ -0,0 +1,564 @@
+#!/usr/bin/env runhaskell
+--
+-- Uses multi-param type classes
+--
+
+import Test.QuickCheck.Batch
+import Test.QuickCheck
+import Text.Show.Functions
+
+import Data.Char
+import Data.Int
+import Data.List
+import Data.Maybe
+import Data.Word
+
+import System.IO
+import System.Environment
+import System.IO.Unsafe
+import System.Random
+
+import Control.Monad ( liftM2 )
+import Control.Monad.Instances ()
+
+import Text.Printf
+import Debug.Trace
+
+import Foreign.Ptr
+
+import Data.ByteString.Lazy (ByteString(..), pack , unpack)
+import qualified Data.ByteString.Lazy as L
+import qualified Data.ByteString.Lazy.Internal as L
+
+import Data.ByteString.Fusion
+import qualified Data.ByteString as P
+import qualified Data.ByteString.Lazy as L
+
+import qualified Data.ByteString.Char8 as PC
+import qualified Data.ByteString.Lazy.Char8 as LC
+import qualified Data.ByteString as P
+import qualified Data.ByteString.Internal as P
+import qualified Data.ByteString.Char8 as C
+import qualified Data.ByteString.Lazy.Char8 as D
+import Data.ByteString.Fusion
+
+import Prelude hiding (abs)
+
+-- Enable this to get verbose test output. Including the actual tests.
+debug = False
+
+mytest :: Testable a => a -> Int -> IO ()
+mytest a n = mycheck defaultConfig
+ { configMaxTest=n
+ , configEvery= \n args -> if debug then show n ++ ":\n" ++ unlines args else [] } a
+
+mycheck :: Testable a => Config -> a -> IO ()
+mycheck config a =
+ do let rnd = mkStdGen 99
+ mytests config (evaluate a) rnd 0 0 []
+
+mytests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> IO ()
+mytests config gen rnd0 ntest nfail stamps
+ | ntest == configMaxTest config = do done "OK," ntest stamps
+ | nfail == configMaxFail config = do done "Arguments exhausted after" ntest stamps
+ | otherwise =
+ do putStr (configEvery config ntest (arguments result)) >> hFlush stdout
+ case ok result of
+ Nothing ->
+ mytests config gen rnd1 ntest (nfail+1) stamps
+ Just True ->
+ mytests config gen rnd1 (ntest+1) nfail (stamp result:stamps)
+ Just False ->
+ putStr ( "Falsifiable after "
+ ++ show ntest
+ ++ " tests:\n"
+ ++ unlines (arguments result)
+ ) >> hFlush stdout
+ where
+ result = generate (configSize config ntest) rnd2 gen
+ (rnd1,rnd2) = split rnd0
+
+done :: String -> Int -> [[String]] -> IO ()
+done mesg ntest stamps =
+ do putStr ( mesg ++ " " ++ show ntest ++ " tests" ++ table )
+ where
+ table = display
+ . map entry
+ . reverse
+ . sort
+ . map pairLength
+ . group
+ . sort
+ . filter (not . null)
+ $ stamps
+
+ display [] = ".\n"
+ display [x] = " (" ++ x ++ ").\n"
+ display xs = ".\n" ++ unlines (map (++ ".") xs)
+
+ pairLength xss@(xs:_) = (length xss, xs)
+ entry (n, xs) = percentage n ntest
+ ++ " "
+ ++ concat (intersperse ", " xs)
+
+ percentage n m = show ((100 * n) `div` m) ++ "%"
+
+------------------------------------------------------------------------
+
+instance Arbitrary Char where
+ arbitrary = choose ('a', 'i')
+ coarbitrary c = variant (ord c `rem` 4)
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (PairS a b) where
+ arbitrary = liftM2 (:*:) arbitrary arbitrary
+ coarbitrary (a :*: b) = coarbitrary a . coarbitrary b
+
+instance Arbitrary Word8 where
+ arbitrary = choose (97, 105)
+ coarbitrary c = variant (fromIntegral ((fromIntegral c) `rem` 4))
+
+instance Arbitrary Int64 where
+ arbitrary = sized $ \n -> choose (-fromIntegral n,fromIntegral n)
+ coarbitrary n = variant (fromIntegral (if n >= 0 then 2*n else 2*(-n) + 1))
+
+instance Arbitrary a => Arbitrary (MaybeS a) where
+ arbitrary = do a <- arbitrary ; elements [NothingS, JustS a]
+ coarbitrary NothingS = variant 0
+ coarbitrary _ = variant 1 -- ok?
+
+{-
+instance Arbitrary Char where
+ arbitrary = choose ('\0', '\255') -- since we have to test words, unlines too
+ coarbitrary c = variant (ord c `rem` 16)
+
+instance Arbitrary Word8 where
+ arbitrary = choose (minBound, maxBound)
+ coarbitrary c = variant (fromIntegral ((fromIntegral c) `rem` 16))
+-}
+
+instance Random Word8 where
+ randomR = integralRandomR
+ random = randomR (minBound,maxBound)
+
+instance Random Int64 where
+ randomR = integralRandomR
+ random = randomR (minBound,maxBound)
+
+integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)
+integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer,
+ fromIntegral b :: Integer) g of
+ (x,g) -> (fromIntegral x, g)
+
+instance Arbitrary L.ByteString where
+ arbitrary = arbitrary >>= return . L.fromChunks . filter (not. P.null) -- maintain the invariant.
+ coarbitrary s = coarbitrary (L.unpack s)
+
+instance Arbitrary P.ByteString where
+ arbitrary = P.pack `fmap` arbitrary
+ coarbitrary s = coarbitrary (P.unpack s)
+
+------------------------------------------------------------------------
+--
+-- We're doing two forms of testing here. Firstly, model based testing.
+-- For our Lazy and strict bytestring types, we have model types:
+--
+-- i.e. Lazy == Byte
+-- \\ //
+-- List
+--
+-- That is, the Lazy type can be modeled by functions in both the Byte
+-- and List type. For each of the 3 models, we have a set of tests that
+-- check those types match.
+--
+-- The Model class connects a type and its model type, via a conversion
+-- function.
+--
+--
+class Model a b where
+ model :: a -> b -- get the abstract vale from a concrete value
+
+--
+-- Connecting our Lazy and Strict types to their models. We also check
+-- the data invariant on Lazy types.
+--
+-- These instances represent the arrows in the above diagram
+--
+instance Model B P where model = abstr . checkInvariant
+instance Model P [W] where model = P.unpack
+instance Model P [Char] where model = PC.unpack
+instance Model B [W] where model = L.unpack . checkInvariant
+instance Model B [Char] where model = LC.unpack . checkInvariant
+
+-- Types are trivially modeled by themselves
+instance Model Bool Bool where model = id
+instance Model Int Int where model = id
+instance Model Int64 Int64 where model = id
+instance Model Int64 Int where model = fromIntegral
+instance Model Word8 Word8 where model = id
+instance Model Ordering Ordering where model = id
+
+-- More structured types are modeled recursively, using the NatTrans class from Gofer.
+class (Functor f, Functor g) => NatTrans f g where
+ eta :: f a -> g a
+
+-- The transformation of the same type is identity
+instance NatTrans [] [] where eta = id
+instance NatTrans Maybe Maybe where eta = id
+instance NatTrans ((->) X) ((->) X) where eta = id
+instance NatTrans ((->) W) ((->) W) where eta = id
+
+-- We have a transformation of pairs, if the pairs are in Model
+instance Model f g => NatTrans ((,) f) ((,) g) where eta (f,a) = (model f, a)
+
+-- And finally, we can take any (m a) to (n b), if we can Model m n, and a b
+instance (NatTrans m n, Model a b) => Model (m a) (n b) where model x = fmap model (eta x)
+
+------------------------------------------------------------------------
+
+-- In a form more useful for QC testing (and it's lazy)
+checkInvariant :: L.ByteString -> L.ByteString
+checkInvariant cs0 = check cs0
+ where check L.Empty = L.Empty
+ check (L.Chunk c cs)
+ | P.null c = error ("invariant violation: " ++ show cs0)
+ | otherwise = L.Chunk c (check cs)
+
+abstr :: L.ByteString -> P.ByteString
+abstr = P.concat . L.toChunks
+
+-- Some short hand.
+type X = Int
+type W = Word8
+type P = P.ByteString
+type B = L.ByteString
+
+------------------------------------------------------------------------
+--
+-- These comparison functions handle wrapping and equality.
+--
+-- A single class for these would be nice, but note that they differe in
+-- the number of arguments, and those argument types, so we'd need HList
+-- tricks. See here: http://okmij.org/ftp/Haskell/vararg-fn.lhs
+--
+
+eq1 f g = \a ->
+ model (f a) == g (model a)
+eq2 f g = \a b ->
+ model (f a b) == g (model a) (model b)
+eq3 f g = \a b c ->
+ model (f a b c) == g (model a) (model b) (model c)
+eq4 f g = \a b c d ->
+ model (f a b c d) == g (model a) (model b) (model c) (model d)
+eq5 f g = \a b c d e ->
+ model (f a b c d e) == g (model a) (model b) (model c) (model d) (model e)
+
+--
+-- And for functions that take non-null input
+--
+eqnotnull1 f g = \x -> (not (isNull x)) ==> eq1 f g x
+eqnotnull2 f g = \x y -> (not (isNull y)) ==> eq2 f g x y
+eqnotnull3 f g = \x y z -> (not (isNull z)) ==> eq3 f g x y z
+
+class IsNull t where isNull :: t -> Bool
+instance IsNull L.ByteString where isNull = L.null
+instance IsNull P.ByteString where isNull = P.null
+
+main = do
+ x <- getArgs
+ let n = if null x then 100 else read . head $ x
+ mapM_ (\(s,a) -> printf "%-25s: " s >> a n) tests
+
+--
+-- Test that, after loop fusion, our code behaves the same as the
+-- unfused lazy or list models. Use -ddump-simpl to also check that
+-- rules are firing for each case.
+--
+tests = -- 29/5/06, all tests are fusing:
+ [("down/down list", mytest prop_downdown_list) -- checked
+ ,("down/filter list", mytest prop_downfilter_list) -- checked
+ ,("down/map list", mytest prop_downmap_list) -- checked
+ ,("filter/down lazy", mytest prop_filterdown_lazy) -- checked
+ ,("filter/down list", mytest prop_filterdown_list) -- checked
+ ,("filter/filter lazy", mytest prop_filterfilter_lazy) -- checked
+ ,("filter/filter list", mytest prop_filterfilter_list) -- checked
+ ,("filter/map lazy", mytest prop_filtermap_lazy) -- checked
+ ,("filter/map list", mytest prop_filtermap_list) -- checked
+ ,("filter/up lazy", mytest prop_filterup_lazy) -- checked
+ ,("filter/up list", mytest prop_filterup_list) -- checked
+ ,("map/down lazy", mytest prop_mapdown_lazy) -- checked
+ ,("map/down list", mytest prop_mapdown_list) -- checked
+ ,("map/filter lazy", mytest prop_mapfilter_lazy) -- checked
+ ,("map/filter list", mytest prop_mapfilter_list) -- checked
+ ,("map/map lazy", mytest prop_mapmap_lazy) -- checked
+ ,("map/map list", mytest prop_mapmap_list) -- checked
+ ,("map/up lazy", mytest prop_mapup_lazy) -- checked
+ ,("map/up list", mytest prop_mapup_list) -- checked
+ ,("up/filter lazy", mytest prop_upfilter_lazy) -- checked
+ ,("up/filter list", mytest prop_upfilter_list) -- checked
+ ,("up/map lazy", mytest prop_upmap_lazy) -- checked
+ ,("up/map list", mytest prop_upmap_list) -- checked
+ ,("up/up lazy", mytest prop_upup_lazy) -- checked
+ ,("up/up list", mytest prop_upup_list) -- checked
+ ,("noacc/noacc lazy", mytest prop_noacc_noacc_lazy) -- checked
+ ,("noacc/noacc list", mytest prop_noacc_noacc_list) -- checked
+ ,("noacc/up lazy", mytest prop_noacc_up_lazy) -- checked
+ ,("noacc/up list", mytest prop_noacc_up_list) -- checked
+ ,("up/noacc lazy", mytest prop_up_noacc_lazy) -- checked
+ ,("up/noacc list", mytest prop_up_noacc_list) -- checked
+ ,("map/noacc lazy", mytest prop_map_noacc_lazy) -- checked
+ ,("map/noacc list", mytest prop_map_noacc_list) -- checked
+ ,("noacc/map lazy", mytest prop_noacc_map_lazy) -- checked
+ ,("noacc/map list", mytest prop_noacc_map_list) -- checked
+ ,("filter/noacc lazy", mytest prop_filter_noacc_lazy) -- checked
+ ,("filter/noacc list", mytest prop_filter_noacc_list) -- checked
+ ,("noacc/filter lazy", mytest prop_noacc_filter_lazy) -- checked
+ ,("noacc/filter list", mytest prop_noacc_filter_list) -- checked
+ ,("noacc/down lazy", mytest prop_noacc_down_lazy) -- checked
+ ,("noacc/down list", mytest prop_noacc_down_list) -- checked
+-- ,("down/noacc lazy", mytest prop_down_noacc_lazy) -- checked
+ ,("down/noacc list", mytest prop_down_noacc_list) -- checked
+
+
+ ,("length/loop list", mytest prop_lengthloop_list)
+-- ,("length/loop lazy", mytest prop_lengthloop_lazy)
+ ,("maximum/loop list", mytest prop_maximumloop_list)
+-- ,("maximum/loop lazy", mytest prop_maximumloop_lazy)
+ ,("minimum/loop list", mytest prop_minimumloop_list)
+-- ,("minimum/loop lazy", mytest prop_minimumloop_lazy)
+
+ ]
+
+prop_upup_list = eq3
+ (\f g -> P.foldl f (0::Int) . P.scanl g (0::W))
+ ((\f g -> foldl f (0::Int) . scanl g (0::W)) :: (X -> W -> X) -> (W -> W -> W) -> [W] -> X)
+
+prop_upup_lazy = eq3
+ (\f g -> L.foldl f (0::X) . L.scanl g (0::W))
+ (\f g -> P.foldl f (0::X) . P.scanl g (0::W))
+
+prop_mapmap_list = eq3
+ (\f g -> P.map f . P.map g)
+ ((\f g -> map f . map g) :: (W -> W) -> (W -> W) -> [W] -> [W])
+
+prop_mapmap_lazy = eq3
+ (\f g -> L.map f . L.map g)
+ (\f g -> P.map f . P.map g)
+
+prop_filterfilter_list = eq3
+ (\f g -> P.filter f . P.filter g)
+ ((\f g -> filter f . filter g) :: (W -> Bool) -> (W -> Bool) -> [W] -> [W])
+
+prop_filterfilter_lazy = eq3
+ (\f g -> L.filter f . L.filter g)
+ (\f g -> P.filter f . P.filter g)
+
+prop_mapfilter_list = eq3
+ (\f g -> P.filter f . P.map g)
+ ((\f g -> filter f . map g) :: (W -> Bool) -> (W -> W) -> [W] -> [W])
+
+prop_mapfilter_lazy = eq3
+ (\f g -> L.filter f . L.map g)
+ (\f g -> P.filter f . P.map g)
+
+prop_filtermap_list = eq3
+ (\f g -> P.map f . P.filter g)
+ ((\f g -> map f . filter g) :: (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+prop_filtermap_lazy = eq3
+ (\f g -> L.map f . L.filter g)
+ (\f g -> P.map f . P.filter g)
+
+prop_mapup_list = eq3
+ (\f g -> P.foldl g (0::W) . P.map f)
+ ((\f g -> foldl g (0::W) . map f) :: (W -> W) -> (W -> W -> W) -> [W] -> W)
+
+prop_mapup_lazy = eq3
+ (\f g -> L.foldl g (0::W) . L.map f) -- n.b. scan doesn't fuse here, atm
+ (\f g -> P.foldl g (0::W) . P.map f)
+
+prop_upmap_list = eq3
+ (\f g -> P.map f . P.scanl g (0::W))
+ ((\f g -> map f . scanl g (0::W)) :: (W -> W) -> (W -> W -> W) -> [W] -> [W])
+
+prop_upmap_lazy = eq3
+ (\f g -> L.map f . L.scanl g (0::W))
+ (\f g -> P.map f . P.scanl g (0::W))
+
+prop_filterup_list = eq3
+ (\f g -> P.foldl g (0::W) . P.filter f)
+ ((\f g -> foldl g (0::W) . filter f) :: (W -> Bool) -> (W -> W -> W) -> [W] -> W)
+
+prop_filterup_lazy = eq3
+ (\f g -> L.foldl g (0::W) . L.filter f)
+ (\f g -> P.foldl g (0::W) . P.filter f)
+
+prop_upfilter_list = eq3
+ (\f g -> P.filter f . P.scanl g (0::W))
+ ((\f g -> filter f . scanl g (0::W)) :: (W -> Bool) -> (W -> W -> W) -> [W] -> [W])
+
+prop_upfilter_lazy = eq3
+ (\f g -> L.filter f . L.scanl g (0::W))
+ (\f g -> P.filter f . P.scanl g (0::W))
+
+prop_downdown_list = eq3
+ (\f g -> P.foldr f (0::X) . P.scanr g (0::W))
+ ((\f g -> foldr f (0::X) . scanr g (0::W)) :: (W -> X -> X) -> (W -> W -> W) -> [W] -> X)
+
+{-
+-- no lazy scanr yet
+prop_downdown_lazy = eq3
+ (\f g -> L.foldr f (0::X) . L.scanr g (0::W))
+ (\f g -> P.foldr f (0::X) . P.scanr g (0::W))
+-}
+
+prop_mapdown_list = eq3
+ (\f g -> P.foldr g (0::W) . P.map f)
+ ((\f g -> foldr g (0::W) . map f) :: (W -> W) -> (W -> W -> W) -> [W] -> W)
+
+prop_mapdown_lazy = eq3
+ (\f g -> L.foldr g (0::W) . L.map f) -- n.b. scan doesn't fuse here, atm
+ (\f g -> P.foldr g (0::W) . P.map f)
+
+prop_downmap_list = eq3
+ (\f g -> P.map f . P.scanr g (0::W))
+ ((\f g -> map f . scanr g (0::W)) :: (W -> W) -> (W -> W -> W) -> [W] -> [W])
+
+{-
+prop_downmap_lazy = eq3
+ (\f g -> L.map f . L.scanr g (0::W))
+ (\f g -> P.map f . P.scanr g (0::W))
+-}
+
+prop_filterdown_list = eq3
+ (\f g -> P.foldr g (0::W) . P.filter f)
+ ((\f g -> foldr g (0::W) . filter f) :: (W -> Bool) -> (W -> W -> W) -> [W] -> W)
+
+prop_filterdown_lazy = eq3
+ (\f g -> L.foldr g (0::W) . L.filter f) -- n.b. scan doesn't fuse here, atm
+ (\f g -> P.foldr g (0::W) . P.filter f)
+
+prop_downfilter_list = eq3
+ (\f g -> P.filter f . P.scanr g (0::W))
+ ((\f g -> filter f . scanr g (0::W)) :: (W -> Bool) -> (W -> W -> W) -> [W] -> [W])
+
+{-
+prop_downfilter_lazy = eq3
+ (\f g -> L.filter f . L.scanr g (0::W))
+ (\f g -> P.filter f . P.scanr g (0::W))
+-}
+
+prop_noacc_noacc_list = eq5
+ (\f g h i -> (P.map f . P.filter g) . (P.map h . P.filter i))
+ ((\f g h i -> ( map f . filter g) . ( map h . filter i))
+ :: (W -> W) -> (W -> Bool) -> (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+prop_noacc_noacc_lazy = eq5
+ (\f g h i -> (L.map f . L.filter g) . (L.map h . L.filter i))
+ (\f g h i -> (P.map f . P.filter g) . (P.map h . P.filter i))
+
+prop_noacc_up_list = eq4
+ ( \g h i -> P.foldl g (0::W) . (P.map h . P.filter i))
+ ((\g h i -> foldl g (0::W) . ( map h . filter i))
+ :: (W -> W -> W) -> (W -> W) -> (W -> Bool) -> [W] -> W)
+
+prop_noacc_up_lazy = eq4
+ (\g h i -> L.foldl g (0::W) . (L.map h . L.filter i))
+ (\g h i -> P.foldl g (0::W) . (P.map h . P.filter i))
+
+prop_up_noacc_list = eq4
+ ( \g h i -> (P.map h . P.filter i) . P.scanl g (0::W))
+ ((\g h i -> ( map h . filter i) . scanl g (0::W))
+ :: (W -> W -> W) -> (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+prop_up_noacc_lazy = eq4
+ (\g h i -> (L.map h . L.filter i) . L.scanl g (0::W))
+ (\g h i -> (P.map h . P.filter i) . P.scanl g (0::W))
+
+prop_map_noacc_list = eq4
+ ( \g h i -> (P.map h . P.filter i) . P.map g)
+ ((\g h i -> ( map h . filter i) . map g)
+ :: (W -> W) -> (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+prop_map_noacc_lazy = eq4
+ (\g h i -> (L.map h . L.filter i) . L.map g)
+ (\g h i -> (P.map h . P.filter i) . P.map g)
+
+prop_noacc_map_list = eq4
+ ( \g h i -> P.map g . (P.map h . P.filter i))
+ ((\g h i -> map g . ( map h . filter i))
+ :: (W -> W) -> (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+prop_noacc_map_lazy = eq4
+ (\g h i -> L.map g . (L.map h . L.filter i))
+ (\g h i -> P.map g . (P.map h . P.filter i))
+
+prop_filter_noacc_list = eq4
+ ( \g h i -> (P.map h . P.filter i) . P.filter g)
+ ((\g h i -> ( map h . filter i) . filter g)
+ :: (W -> Bool) -> (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+prop_filter_noacc_lazy = eq4
+ (\g h i -> (L.map h . L.filter i) . L.filter g)
+ (\g h i -> (P.map h . P.filter i) . P.filter g)
+
+prop_noacc_filter_list = eq4
+ ( \g h i -> P.filter g . (P.map h . P.filter i))
+ ((\g h i -> filter g . ( map h . filter i))
+ :: (W -> Bool) -> (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+prop_noacc_filter_lazy = eq4
+ (\g h i -> L.filter g . (L.map h . L.filter i))
+ (\g h i -> P.filter g . (P.map h . P.filter i))
+
+prop_noacc_down_list = eq4
+ ( \g h i -> P.foldr g (0::W) . (P.map h . P.filter i))
+ ((\g h i -> foldr g (0::W) . ( map h . filter i))
+ :: (W -> W -> W) -> (W -> W) -> (W -> Bool) -> [W] -> W)
+
+prop_noacc_down_lazy = eq4
+ (\g h i -> L.foldr g (0::W) . (L.map h . L.filter i))
+ (\g h i -> P.foldr g (0::W) . (P.map h . P.filter i))
+
+prop_down_noacc_list = eq4
+ ( \g h i -> (P.map h . P.filter i) . P.scanr g (0::W))
+ ((\g h i -> ( map h . filter i) . scanr g (0::W))
+ :: (W -> W -> W) -> (W -> W) -> (W -> Bool) -> [W] -> [W])
+
+{-
+prop_down_noacc_lazy = eq4
+ (\g h i -> (L.map h . L.filter i) . L.scanl g (0::W))
+ (\g h i -> (P.map h . P.filter i) . P.scanl g (0::W))
+-}
+
+------------------------------------------------------------------------
+
+prop_lengthloop_list = eq2
+ (\f -> P.length . P.filter f)
+ ((\f -> length . filter f) :: (W -> Bool) -> [W] -> X)
+
+{-
+prop_lengthloop_lazy = eq2
+ (\f g -> L.length . L.filter f) -- n.b. scan doesn't fuse here, atm
+ (\f g -> P.length . P.filter f)
+-}
+
+prop_maximumloop_list = eqnotnull2
+ (\f -> P.maximum . P.map f) -- so we don't get null strings
+ ((\f -> maximum . map f) :: (W -> W) -> [W] -> W)
+
+{-
+prop_maximumloop_lazy = eq2
+ (\f g -> L.maximum . L.filter f) -- n.b. scan doesn't fuse here, atm
+ (\f g -> P.maximum . P.filter f)
+-}
+
+prop_minimumloop_list = eqnotnull2
+ (\f -> P.minimum . P.map f)
+ ((\f -> minimum . map f) :: (W -> W) -> [W] -> W)
+
+{-
+prop_minimumloop_lazy = eq2
+ (\f g -> L.minimum . L.filter f) -- n.b. scan doesn't fuse here, atm
+ (\f g -> P.minimum . P.filter f)
+-}
+
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring004.stdout b/testsuite/tests/lib/Data.ByteString/bytestring004.stdout
new file mode 100644
index 0000000000..cbc88dbf91
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring004.stdout
@@ -0,0 +1,45 @@
+down/down list : OK, 100 tests.
+down/filter list : OK, 100 tests.
+down/map list : OK, 100 tests.
+filter/down lazy : OK, 100 tests.
+filter/down list : OK, 100 tests.
+filter/filter lazy : OK, 100 tests.
+filter/filter list : OK, 100 tests.
+filter/map lazy : OK, 100 tests.
+filter/map list : OK, 100 tests.
+filter/up lazy : OK, 100 tests.
+filter/up list : OK, 100 tests.
+map/down lazy : OK, 100 tests.
+map/down list : OK, 100 tests.
+map/filter lazy : OK, 100 tests.
+map/filter list : OK, 100 tests.
+map/map lazy : OK, 100 tests.
+map/map list : OK, 100 tests.
+map/up lazy : OK, 100 tests.
+map/up list : OK, 100 tests.
+up/filter lazy : OK, 100 tests.
+up/filter list : OK, 100 tests.
+up/map lazy : OK, 100 tests.
+up/map list : OK, 100 tests.
+up/up lazy : OK, 100 tests.
+up/up list : OK, 100 tests.
+noacc/noacc lazy : OK, 100 tests.
+noacc/noacc list : OK, 100 tests.
+noacc/up lazy : OK, 100 tests.
+noacc/up list : OK, 100 tests.
+up/noacc lazy : OK, 100 tests.
+up/noacc list : OK, 100 tests.
+map/noacc lazy : OK, 100 tests.
+map/noacc list : OK, 100 tests.
+noacc/map lazy : OK, 100 tests.
+noacc/map list : OK, 100 tests.
+filter/noacc lazy : OK, 100 tests.
+filter/noacc list : OK, 100 tests.
+noacc/filter lazy : OK, 100 tests.
+noacc/filter list : OK, 100 tests.
+noacc/down lazy : OK, 100 tests.
+noacc/down list : OK, 100 tests.
+down/noacc list : OK, 100 tests.
+length/loop list : OK, 100 tests.
+maximum/loop list : OK, 100 tests.
+minimum/loop list : OK, 100 tests.
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring005.hs b/testsuite/tests/lib/Data.ByteString/bytestring005.hs
new file mode 100644
index 0000000000..7bd37da004
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring005.hs
@@ -0,0 +1,1138 @@
+#!/usr/bin/env runhaskell
+--
+-- Uses multi-param type classes
+--
+
+import Test.QuickCheck
+import Text.Show.Functions
+
+import Data.Char
+import Data.Int
+import Data.List
+import Data.Maybe
+import Data.Word
+
+import System.IO
+import System.Environment
+import System.IO.Unsafe
+import System.Random
+
+import Control.Monad ( liftM2 )
+import Control.Monad.Instances ()
+
+import Text.Printf
+import Debug.Trace
+
+import Foreign.Ptr
+
+import Data.ByteString.Lazy (ByteString(..), pack , unpack)
+import qualified Data.ByteString.Lazy as L
+import qualified Data.ByteString.Lazy.Internal as L
+
+import Data.ByteString.Fusion
+import qualified Data.ByteString as P
+import qualified Data.ByteString.Unsafe as P
+import qualified Data.ByteString.Lazy as L
+
+import qualified Data.ByteString.Char8 as PC
+import qualified Data.ByteString.Lazy.Char8 as LC
+import qualified Data.ByteString as P
+import qualified Data.ByteString.Internal as P
+import qualified Data.ByteString.Char8 as C
+import qualified Data.ByteString.Lazy.Char8 as D
+import Data.ByteString.Fusion
+
+import Prelude hiding (abs)
+
+-- Enable this to get verbose test output. Including the actual tests.
+debug = False
+
+mytest :: Testable a => a -> Int -> IO ()
+mytest a n = mycheck defaultConfig
+ { configMaxTest=n
+ , configEvery= \n args -> if debug then show n ++ ":\n" ++ unlines args else [] } a
+
+mycheck :: Testable a => Config -> a -> IO ()
+mycheck config a =
+ do let rnd = mkStdGen 99
+ mytests config (evaluate a) rnd 0 0 []
+
+mytests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> IO ()
+mytests config gen rnd0 ntest nfail stamps
+ | ntest == configMaxTest config = do done "OK," ntest stamps
+ | nfail == configMaxFail config = do done "Arguments exhausted after" ntest stamps
+ | otherwise =
+ do putStr (configEvery config ntest (arguments result)) >> hFlush stdout
+ case ok result of
+ Nothing ->
+ mytests config gen rnd1 ntest (nfail+1) stamps
+ Just True ->
+ mytests config gen rnd1 (ntest+1) nfail (stamp result:stamps)
+ Just False ->
+ putStr ( "Falsifiable after "
+ ++ show ntest
+ ++ " tests:\n"
+ ++ unlines (arguments result)
+ ) >> hFlush stdout
+ where
+ result = generate (configSize config ntest) rnd2 gen
+ (rnd1,rnd2) = split rnd0
+
+done :: String -> Int -> [[String]] -> IO ()
+done mesg ntest stamps =
+ do putStr ( mesg ++ " " ++ show ntest ++ " tests" ++ table )
+ where
+ table = display
+ . map entry
+ . reverse
+ . sort
+ . map pairLength
+ . group
+ . sort
+ . filter (not . null)
+ $ stamps
+
+ display [] = ".\n"
+ display [x] = " (" ++ x ++ ").\n"
+ display xs = ".\n" ++ unlines (map (++ ".") xs)
+
+ pairLength xss@(xs:_) = (length xss, xs)
+ entry (n, xs) = percentage n ntest
+ ++ " "
+ ++ concat (intersperse ", " xs)
+
+ percentage n m = show ((100 * n) `div` m) ++ "%"
+
+------------------------------------------------------------------------
+
+instance Arbitrary Char where
+ arbitrary = choose ('a', 'i')
+ coarbitrary c = variant (ord c `rem` 4)
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (PairS a b) where
+ arbitrary = liftM2 (:*:) arbitrary arbitrary
+ coarbitrary (a :*: b) = coarbitrary a . coarbitrary b
+
+instance Arbitrary Word8 where
+ arbitrary = choose (97, 105)
+ coarbitrary c = variant (fromIntegral ((fromIntegral c) `rem` 4))
+
+instance Arbitrary Int64 where
+ arbitrary = sized $ \n -> choose (-fromIntegral n,fromIntegral n)
+ coarbitrary n = variant (fromIntegral (if n >= 0 then 2*n else 2*(-n) + 1))
+
+instance Arbitrary a => Arbitrary (MaybeS a) where
+ arbitrary = do a <- arbitrary ; elements [NothingS, JustS a]
+ coarbitrary NothingS = variant 0
+ coarbitrary _ = variant 1 -- ok?
+
+{-
+instance Arbitrary Char where
+ arbitrary = choose ('\0', '\255') -- since we have to test words, unlines too
+ coarbitrary c = variant (ord c `rem` 16)
+
+instance Arbitrary Word8 where
+ arbitrary = choose (minBound, maxBound)
+ coarbitrary c = variant (fromIntegral ((fromIntegral c) `rem` 16))
+-}
+
+instance Random Word8 where
+ randomR = integralRandomR
+ random = randomR (minBound,maxBound)
+
+instance Random Int64 where
+ randomR = integralRandomR
+ random = randomR (minBound,maxBound)
+
+integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)
+integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer,
+ fromIntegral b :: Integer) g of
+ (x,g) -> (fromIntegral x, g)
+
+instance Arbitrary L.ByteString where
+ arbitrary = arbitrary >>= return . L.fromChunks . filter (not. P.null) -- maintain the invariant.
+ coarbitrary s = coarbitrary (L.unpack s)
+
+instance Arbitrary P.ByteString where
+ arbitrary = P.pack `fmap` arbitrary
+ coarbitrary s = coarbitrary (P.unpack s)
+
+------------------------------------------------------------------------
+--
+-- We're doing two forms of testing here. Firstly, model based testing.
+-- For our Lazy and strict bytestring types, we have model types:
+--
+-- i.e. Lazy == Byte
+-- \\ //
+-- List
+--
+-- That is, the Lazy type can be modeled by functions in both the Byte
+-- and List type. For each of the 3 models, we have a set of tests that
+-- check those types match.
+--
+-- The Model class connects a type and its model type, via a conversion
+-- function.
+--
+--
+class Model a b where
+ model :: a -> b -- get the abstract vale from a concrete value
+
+--
+-- Connecting our Lazy and Strict types to their models. We also check
+-- the data invariant on Lazy types.
+--
+-- These instances represent the arrows in the above diagram
+--
+instance Model B P where model = abstr . checkInvariant
+instance Model P [W] where model = P.unpack
+instance Model P [Char] where model = PC.unpack
+instance Model B [W] where model = L.unpack . checkInvariant
+instance Model B [Char] where model = LC.unpack . checkInvariant
+
+-- Types are trivially modeled by themselves
+instance Model Bool Bool where model = id
+instance Model Int Int where model = id
+instance Model Int64 Int64 where model = id
+instance Model Int64 Int where model = fromIntegral
+instance Model Word8 Word8 where model = id
+instance Model Ordering Ordering where model = id
+
+-- More structured types are modeled recursively, using the NatTrans class from Gofer.
+class (Functor f, Functor g) => NatTrans f g where
+ eta :: f a -> g a
+
+-- The transformation of the same type is identity
+instance NatTrans [] [] where eta = id
+instance NatTrans Maybe Maybe where eta = id
+instance NatTrans ((->) X) ((->) X) where eta = id
+instance NatTrans ((->) W) ((->) W) where eta = id
+
+-- We have a transformation of pairs, if the pairs are in Model
+instance Model f g => NatTrans ((,) f) ((,) g) where eta (f,a) = (model f, a)
+
+-- And finally, we can take any (m a) to (n b), if we can Model m n, and a b
+instance (NatTrans m n, Model a b) => Model (m a) (n b) where model x = fmap model (eta x)
+
+------------------------------------------------------------------------
+
+-- In a form more useful for QC testing (and it's lazy)
+checkInvariant :: L.ByteString -> L.ByteString
+checkInvariant cs0 = check cs0
+ where check L.Empty = L.Empty
+ check (L.Chunk c cs)
+ | P.null c = error ("invariant violation: " ++ show cs0)
+ | otherwise = L.Chunk c (check cs)
+
+abstr :: L.ByteString -> P.ByteString
+abstr = P.concat . L.toChunks
+
+-- Some short hand.
+type X = Int
+type W = Word8
+type P = P.ByteString
+type B = L.ByteString
+
+------------------------------------------------------------------------
+--
+-- These comparison functions handle wrapping and equality.
+--
+-- A single class for these would be nice, but note that they differe in
+-- the number of arguments, and those argument types, so we'd need HList
+-- tricks. See here: http://okmij.org/ftp/Haskell/vararg-fn.lhs
+--
+
+eq1 f g = \a ->
+ model (f a) == g (model a)
+eq2 f g = \a b ->
+ model (f a b) == g (model a) (model b)
+eq3 f g = \a b c ->
+ model (f a b c) == g (model a) (model b) (model c)
+eq4 f g = \a b c d ->
+ model (f a b c d) == g (model a) (model b) (model c) (model d)
+eq5 f g = \a b c d e ->
+ model (f a b c d e) == g (model a) (model b) (model c) (model d) (model e)
+
+--
+-- And for functions that take non-null input
+--
+eqnotnull1 f g = \x -> (not (isNull x)) ==> eq1 f g x
+eqnotnull2 f g = \x y -> (not (isNull y)) ==> eq2 f g x y
+eqnotnull3 f g = \x y z -> (not (isNull z)) ==> eq3 f g x y z
+
+class IsNull t where isNull :: t -> Bool
+instance IsNull L.ByteString where isNull = L.null
+instance IsNull P.ByteString where isNull = P.null
+
+------------------------------------------------------------------------
+
+--
+-- These are miscellaneous tests left over. Or else they test some
+-- property internal to a type (i.e. head . sort == minimum), without
+-- reference to a model type.
+--
+
+invariant :: L.ByteString -> Bool
+invariant L.Empty = True
+invariant (L.Chunk c cs) = not (P.null c) && invariant cs
+
+prop_invariant = invariant
+
+prop_eq_refl x = x == (x :: ByteString)
+prop_eq_symm x y = (x == y) == (y == (x :: ByteString))
+
+prop_eq1 xs = xs == (unpack . pack $ xs)
+prop_eq2 xs = xs == (xs :: ByteString)
+prop_eq3 xs ys = (xs == ys) == (unpack xs == unpack ys)
+
+prop_compare1 xs = (pack xs `compare` pack xs) == EQ
+prop_compare2 xs c = (pack (xs++[c]) `compare` pack xs) == GT
+prop_compare3 xs c = (pack xs `compare` pack (xs++[c])) == LT
+
+prop_compare4 xs = (not (null xs)) ==> (pack xs `compare` L.empty) == GT
+prop_compare5 xs = (not (null xs)) ==> (L.empty `compare` pack xs) == LT
+prop_compare6 xs ys = (not (null ys)) ==> (pack (xs++ys) `compare` pack xs) == GT
+
+prop_compare7 x y = x `compare` y == (L.singleton x `compare` L.singleton y)
+prop_compare8 xs ys = xs `compare` ys == (L.pack xs `compare` L.pack ys)
+
+prop_empty1 = L.length L.empty == 0
+prop_empty2 = L.unpack L.empty == []
+
+prop_packunpack s = (L.unpack . L.pack) s == id s
+prop_unpackpack s = (L.pack . L.unpack) s == id s
+
+prop_null xs = null (L.unpack xs) == L.null xs
+
+prop_length1 xs = fromIntegral (length xs) == L.length (L.pack xs)
+
+prop_length2 xs = L.length xs == length1 xs
+ where length1 ys
+ | L.null ys = 0
+ | otherwise = 1 + length1 (L.tail ys)
+
+prop_cons1 c xs = unpack (L.cons c (pack xs)) == (c:xs)
+prop_cons2 c = L.singleton c == (c `L.cons` L.empty)
+prop_cons3 c = unpack (L.singleton c) == (c:[])
+prop_cons4 c = (c `L.cons` L.empty) == pack (c:[])
+
+prop_snoc1 xs c = xs ++ [c] == unpack ((pack xs) `L.snoc` c)
+
+prop_head xs = (not (null xs)) ==> head xs == (L.head . pack) xs
+prop_head1 xs = not (L.null xs) ==> L.head xs == head (L.unpack xs)
+
+prop_tail xs = not (L.null xs) ==> L.tail xs == pack (tail (unpack xs))
+prop_tail1 xs = (not (null xs)) ==> tail xs == (unpack . L.tail . pack) xs
+
+prop_last xs = (not (null xs)) ==> last xs == (L.last . pack) xs
+
+prop_init xs =
+ (not (null xs)) ==>
+ init xs == (unpack . L.init . pack) xs
+
+prop_append1 xs = (xs ++ xs) == (unpack $ pack xs `L.append` pack xs)
+prop_append2 xs ys = (xs ++ ys) == (unpack $ pack xs `L.append` pack ys)
+prop_append3 xs ys = L.append xs ys == pack (unpack xs ++ unpack ys)
+
+prop_map1 f xs = L.map f (pack xs) == pack (map f xs)
+prop_map2 f g xs = L.map f (L.map g xs) == L.map (f . g) xs
+prop_map3 f xs = map f xs == (unpack . L.map f . pack) xs
+
+prop_filter1 c xs = (filter (/=c) xs) == (unpack $ L.filter (/=c) (pack xs))
+prop_filter2 p xs = (filter p xs) == (unpack $ L.filter p (pack xs))
+
+prop_reverse xs = reverse xs == (unpack . L.reverse . pack) xs
+prop_reverse1 xs = L.reverse (pack xs) == pack (reverse xs)
+prop_reverse2 xs = reverse (unpack xs) == (unpack . L.reverse) xs
+
+prop_transpose xs = (transpose xs) == ((map unpack) . L.transpose . (map pack)) xs
+
+prop_foldl f c xs = L.foldl f c (pack xs) == foldl f c xs
+ where _ = c :: Char
+
+prop_foldr f c xs = L.foldl f c (pack xs) == foldl f c xs
+ where _ = c :: Char
+
+prop_foldl_1 xs = L.foldl (\xs c -> c `L.cons` xs) L.empty xs == L.reverse xs
+prop_foldr_1 xs = L.foldr (\c xs -> c `L.cons` xs) L.empty xs == id xs
+
+prop_foldl1_1 xs =
+ (not . L.null) xs ==>
+ L.foldl1 (\x c -> if c > x then c else x) xs ==
+ L.foldl (\x c -> if c > x then c else x) 0 xs
+
+prop_foldl1_2 xs =
+ (not . L.null) xs ==>
+ L.foldl1 const xs == L.head xs
+
+prop_foldl1_3 xs =
+ (not . L.null) xs ==>
+ L.foldl1 (flip const) xs == L.last xs
+
+prop_foldr1_1 xs =
+ (not . L.null) xs ==>
+ L.foldr1 (\c x -> if c > x then c else x) xs ==
+ L.foldr (\c x -> if c > x then c else x) 0 xs
+
+prop_foldr1_2 xs =
+ (not . L.null) xs ==>
+ L.foldr1 (flip const) xs == L.last xs
+
+prop_foldr1_3 xs =
+ (not . L.null) xs ==>
+ L.foldr1 const xs == L.head xs
+
+prop_concat1 xs = (concat [xs,xs]) == (unpack $ L.concat [pack xs, pack xs])
+prop_concat2 xs = (concat [xs,[]]) == (unpack $ L.concat [pack xs, pack []])
+prop_concat3 xss = L.concat (map pack xss) == pack (concat xss)
+
+prop_concatMap xs = L.concatMap L.singleton xs == (pack . concatMap (:[]) . unpack) xs
+
+prop_any xs a = (any (== a) xs) == (L.any (== a) (pack xs))
+prop_all xs a = (all (== a) xs) == (L.all (== a) (pack xs))
+
+prop_maximum xs = (not (null xs)) ==> (maximum xs) == (L.maximum ( pack xs ))
+prop_minimum xs = (not (null xs)) ==> (minimum xs) == (L.minimum ( pack xs ))
+
+prop_replicate1 n c =
+ (n >= 0) ==> unpack (L.replicate (fromIntegral n) c) == replicate n c
+
+prop_replicate2 c = unpack (L.replicate 0 c) == replicate 0 c
+
+prop_take1 i xs = L.take (fromIntegral i) (pack xs) == pack (take i xs)
+prop_drop1 i xs = L.drop (fromIntegral i) (pack xs) == pack (drop i xs)
+
+prop_splitAt i xs = collect (i >= 0 && i < length xs) $
+ L.splitAt (fromIntegral i) (pack xs) == let (a,b) = splitAt i xs in (pack a, pack b)
+
+prop_takeWhile f xs = L.takeWhile f (pack xs) == pack (takeWhile f xs)
+prop_dropWhile f xs = L.dropWhile f (pack xs) == pack (dropWhile f xs)
+
+prop_break f xs = L.break f (pack xs) ==
+ let (a,b) = break f xs in (pack a, pack b)
+
+prop_breakspan xs c = L.break (==c) xs == L.span (/=c) xs
+
+prop_span xs a = (span (/=a) xs) == (let (x,y) = L.span (/=a) (pack xs) in (unpack x, unpack y))
+
+-- prop_breakByte xs c = L.break (== c) xs == L.breakByte c xs
+
+-- prop_spanByte c xs = (L.span (==c) xs) == L.spanByte c xs
+
+prop_split c xs = (map L.unpack . map checkInvariant . L.split c $ xs)
+ == (map P.unpack . P.split c . P.pack . L.unpack $ xs)
+
+prop_splitWith f xs = (l1 == l2 || l1 == l2+1) &&
+ sum (map L.length splits) == L.length xs - l2
+ where splits = L.splitWith f xs
+ l1 = fromIntegral (length splits)
+ l2 = L.length (L.filter f xs)
+
+prop_joinsplit c xs = L.intercalate (pack [c]) (L.split c xs) == id xs
+
+prop_group xs = group xs == (map unpack . L.group . pack) xs
+-- prop_groupBy f xs = groupBy f xs == (map unpack . L.groupBy f . pack) xs
+
+-- prop_joinjoinByte xs ys c = L.joinWithByte c xs ys == L.join (L.singleton c) [xs,ys]
+
+prop_index xs =
+ not (null xs) ==>
+ forAll indices $ \i -> (xs !! i) == L.pack xs `L.index` (fromIntegral i)
+ where indices = choose (0, length xs -1)
+
+prop_elemIndex xs c = (elemIndex c xs) == fmap fromIntegral (L.elemIndex c (pack xs))
+
+prop_elemIndices xs c = elemIndices c xs == map fromIntegral (L.elemIndices c (pack xs))
+
+prop_count c xs = length (L.elemIndices c xs) == fromIntegral (L.count c xs)
+
+prop_findIndex xs f = (findIndex f xs) == fmap fromIntegral (L.findIndex f (pack xs))
+prop_findIndicies xs f = (findIndices f xs) == map fromIntegral (L.findIndices f (pack xs))
+
+prop_elem xs c = (c `elem` xs) == (c `L.elem` (pack xs))
+prop_notElem xs c = (c `notElem` xs) == (L.notElem c (pack xs))
+prop_elem_notelem xs c = c `L.elem` xs == not (c `L.notElem` xs)
+
+-- prop_filterByte xs c = L.filterByte c xs == L.filter (==c) xs
+-- prop_filterByte2 xs c = unpack (L.filterByte c xs) == filter (==c) (unpack xs)
+
+-- prop_filterNotByte xs c = L.filterNotByte c xs == L.filter (/=c) xs
+-- prop_filterNotByte2 xs c = unpack (L.filterNotByte c xs) == filter (/=c) (unpack xs)
+
+prop_find p xs = find p xs == L.find p (pack xs)
+
+prop_find_findIndex p xs =
+ L.find p xs == case L.findIndex p xs of
+ Just n -> Just (xs `L.index` n)
+ _ -> Nothing
+
+prop_isPrefixOf xs ys = isPrefixOf xs ys == (pack xs `L.isPrefixOf` pack ys)
+
+{-
+prop_sort1 xs = sort xs == (unpack . L.sort . pack) xs
+prop_sort2 xs = (not (null xs)) ==> (L.head . L.sort . pack $ xs) == minimum xs
+prop_sort3 xs = (not (null xs)) ==> (L.last . L.sort . pack $ xs) == maximum xs
+prop_sort4 xs ys =
+ (not (null xs)) ==>
+ (not (null ys)) ==>
+ (L.head . L.sort) (L.append (pack xs) (pack ys)) == min (minimum xs) (minimum ys)
+
+prop_sort5 xs ys =
+ (not (null xs)) ==>
+ (not (null ys)) ==>
+ (L.last . L.sort) (L.append (pack xs) (pack ys)) == max (maximum xs) (maximum ys)
+
+-}
+
+------------------------------------------------------------------------
+-- Misc ByteString properties
+
+prop_nil1BB = P.length P.empty == 0
+prop_nil2BB = P.unpack P.empty == []
+
+prop_tailSBB xs = not (P.null xs) ==> P.tail xs == P.pack (tail (P.unpack xs))
+
+prop_nullBB xs = null (P.unpack xs) == P.null xs
+
+prop_lengthBB xs = P.length xs == length1 xs
+ where
+ length1 ys
+ | P.null ys = 0
+ | otherwise = 1 + length1 (P.tail ys)
+
+prop_lengthSBB xs = length xs == P.length (P.pack xs)
+
+prop_indexBB xs =
+ not (null xs) ==>
+ forAll indices $ \i -> (xs !! i) == P.pack xs `P.index` i
+ where indices = choose (0, length xs -1)
+
+prop_unsafeIndexBB xs =
+ not (null xs) ==>
+ forAll indices $ \i -> (xs !! i) == P.pack xs `P.unsafeIndex` i
+ where indices = choose (0, length xs -1)
+
+prop_mapfusionBB f g xs = P.map f (P.map g xs) == P.map (f . g) xs
+
+prop_filterBB f xs = P.filter f (P.pack xs) == P.pack (filter f xs)
+
+prop_filterfusionBB f g xs = P.filter f (P.filter g xs) == P.filter (\c -> f c && g c) xs
+
+prop_elemSBB x xs = P.elem x (P.pack xs) == elem x xs
+
+prop_takeSBB i xs = P.take i (P.pack xs) == P.pack (take i xs)
+prop_dropSBB i xs = P.drop i (P.pack xs) == P.pack (drop i xs)
+
+prop_splitAtSBB i xs = -- collect (i >= 0 && i < length xs) $
+ P.splitAt i (P.pack xs) ==
+ let (a,b) = splitAt i xs in (P.pack a, P.pack b)
+
+prop_foldlBB f c xs = P.foldl f c (P.pack xs) == foldl f c xs
+ where types = c :: Char
+
+prop_scanlfoldlBB f z xs = not (P.null xs) ==> P.last (P.scanl f z xs) == P.foldl f z xs
+
+prop_foldrBB f c xs = P.foldl f c (P.pack xs) == foldl f c xs
+ where types = c :: Char
+
+prop_takeWhileSBB f xs = P.takeWhile f (P.pack xs) == P.pack (takeWhile f xs)
+prop_dropWhileSBB f xs = P.dropWhile f (P.pack xs) == P.pack (dropWhile f xs)
+
+prop_spanSBB f xs = P.span f (P.pack xs) ==
+ let (a,b) = span f xs in (P.pack a, P.pack b)
+
+prop_breakSBB f xs = P.break f (P.pack xs) ==
+ let (a,b) = break f xs in (P.pack a, P.pack b)
+
+prop_breakspan_1BB xs c = P.break (== c) xs == P.span (/= c) xs
+
+prop_linesSBB xs = C.lines (C.pack xs) == map C.pack (lines xs)
+
+prop_unlinesSBB xss = C.unlines (map C.pack xss) == C.pack (unlines xss)
+
+prop_wordsSBB xs =
+ C.words (C.pack xs) == map C.pack (words xs)
+
+prop_unwordsSBB xss = C.unwords (map C.pack xss) == C.pack (unwords xss)
+
+prop_splitWithBB f xs = (l1 == l2 || l1 == l2+1) &&
+ sum (map P.length splits) == P.length xs - l2
+ where splits = P.splitWith f xs
+ l1 = length splits
+ l2 = P.length (P.filter f xs)
+
+prop_joinsplitBB c xs = P.intercalate (P.pack [c]) (P.split c xs) == xs
+
+-- prop_linessplitBB xs =
+-- (not . C.null) xs ==>
+-- C.lines' xs == C.split '\n' xs
+
+prop_linessplit2BB xs =
+ C.lines xs == C.split '\n' xs ++ (if C.last xs == '\n' then [C.empty] else [])
+
+prop_splitsplitWithBB c xs = P.split c xs == P.splitWith (== c) xs
+
+prop_bijectionBB c = (P.w2c . P.c2w) c == id c
+prop_bijectionBB' w = (P.c2w . P.w2c) w == id w
+
+prop_packunpackBB s = (P.unpack . P.pack) s == id s
+prop_packunpackBB' s = (P.pack . P.unpack) s == id s
+
+prop_eq1BB xs = xs == (P.unpack . P.pack $ xs)
+prop_eq2BB xs = xs == xs
+prop_eq3BB xs ys = (xs == ys) == (P.unpack xs == P.unpack ys)
+
+prop_compare1BB xs = (P.pack xs `compare` P.pack xs) == EQ
+prop_compare2BB xs c = (P.pack (xs++[c]) `compare` P.pack xs) == GT
+prop_compare3BB xs c = (P.pack xs `compare` P.pack (xs++[c])) == LT
+
+prop_compare4BB xs = (not (null xs)) ==> (P.pack xs `compare` P.empty) == GT
+prop_compare5BB xs = (not (null xs)) ==> (P.empty `compare` P.pack xs) == LT
+prop_compare6BB xs ys= (not (null ys)) ==> (P.pack (xs++ys) `compare` P.pack xs) == GT
+
+prop_compare7BB x y = x `compare` y == (C.singleton x `compare` C.singleton y)
+prop_compare8BB xs ys = xs `compare` ys == (P.pack xs `compare` P.pack ys)
+
+prop_consBB c xs = P.unpack (P.cons c (P.pack xs)) == (c:xs)
+prop_cons1BB xs = 'X' : xs == C.unpack ('X' `C.cons` (C.pack xs))
+prop_cons2BB xs c = c : xs == P.unpack (c `P.cons` (P.pack xs))
+prop_cons3BB c = C.unpack (C.singleton c) == (c:[])
+prop_cons4BB c = (c `P.cons` P.empty) == P.pack (c:[])
+
+prop_snoc1BB xs c = xs ++ [c] == P.unpack ((P.pack xs) `P.snoc` c)
+
+prop_head1BB xs = (not (null xs)) ==> head xs == (P.head . P.pack) xs
+prop_head2BB xs = (not (null xs)) ==> head xs == (P.unsafeHead . P.pack) xs
+prop_head3BB xs = not (P.null xs) ==> P.head xs == head (P.unpack xs)
+
+prop_tailBB xs = (not (null xs)) ==> tail xs == (P.unpack . P.tail . P.pack) xs
+prop_tail1BB xs = (not (null xs)) ==> tail xs == (P.unpack . P.unsafeTail. P.pack) xs
+
+prop_lastBB xs = (not (null xs)) ==> last xs == (P.last . P.pack) xs
+
+prop_initBB xs =
+ (not (null xs)) ==>
+ init xs == (P.unpack . P.init . P.pack) xs
+
+-- prop_null xs = (null xs) ==> null xs == (nullPS (pack xs))
+
+prop_append1BB xs = (xs ++ xs) == (P.unpack $ P.pack xs `P.append` P.pack xs)
+prop_append2BB xs ys = (xs ++ ys) == (P.unpack $ P.pack xs `P.append` P.pack ys)
+prop_append3BB xs ys = P.append xs ys == P.pack (P.unpack xs ++ P.unpack ys)
+
+prop_map1BB f xs = P.map f (P.pack xs) == P.pack (map f xs)
+prop_map2BB f g xs = P.map f (P.map g xs) == P.map (f . g) xs
+prop_map3BB f xs = map f xs == (P.unpack . P.map f . P.pack) xs
+-- prop_mapBB' f xs = P.map' f (P.pack xs) == P.pack (map f xs)
+
+prop_filter1BB xs = (filter (=='X') xs) == (C.unpack $ C.filter (=='X') (C.pack xs))
+prop_filter2BB p xs = (filter p xs) == (P.unpack $ P.filter p (P.pack xs))
+
+prop_findBB p xs = find p xs == P.find p (P.pack xs)
+
+prop_find_findIndexBB p xs =
+ P.find p xs == case P.findIndex p xs of
+ Just n -> Just (xs `P.unsafeIndex` n)
+ _ -> Nothing
+
+prop_foldl1BB xs a = ((foldl (\x c -> if c == a then x else c:x) [] xs)) ==
+ (P.unpack $ P.foldl (\x c -> if c == a then x else c `P.cons` x) P.empty (P.pack xs))
+prop_foldl2BB xs = P.foldl (\xs c -> c `P.cons` xs) P.empty (P.pack xs) == P.reverse (P.pack xs)
+
+prop_foldr1BB xs a = ((foldr (\c x -> if c == a then x else c:x) [] xs)) ==
+ (P.unpack $ P.foldr (\c x -> if c == a then x else c `P.cons` x)
+ P.empty (P.pack xs))
+
+prop_foldr2BB xs = P.foldr (\c xs -> c `P.cons` xs) P.empty (P.pack xs) == (P.pack xs)
+
+prop_foldl1_1BB xs =
+ (not . P.null) xs ==>
+ P.foldl1 (\x c -> if c > x then c else x) xs ==
+ P.foldl (\x c -> if c > x then c else x) 0 xs
+
+prop_foldl1_2BB xs =
+ (not . P.null) xs ==>
+ P.foldl1 const xs == P.head xs
+
+prop_foldl1_3BB xs =
+ (not . P.null) xs ==>
+ P.foldl1 (flip const) xs == P.last xs
+
+prop_foldr1_1BB xs =
+ (not . P.null) xs ==>
+ P.foldr1 (\c x -> if c > x then c else x) xs ==
+ P.foldr (\c x -> if c > x then c else x) 0 xs
+
+prop_foldr1_2BB xs =
+ (not . P.null) xs ==>
+ P.foldr1 (flip const) xs == P.last xs
+
+prop_foldr1_3BB xs =
+ (not . P.null) xs ==>
+ P.foldr1 const xs == P.head xs
+
+prop_takeWhileBB xs a = (takeWhile (/= a) xs) == (P.unpack . (P.takeWhile (/= a)) . P.pack) xs
+
+prop_dropWhileBB xs a = (dropWhile (/= a) xs) == (P.unpack . (P.dropWhile (/= a)) . P.pack) xs
+
+prop_takeBB xs = (take 10 xs) == (P.unpack . (P.take 10) . P.pack) xs
+
+prop_dropBB xs = (drop 10 xs) == (P.unpack . (P.drop 10) . P.pack) xs
+
+prop_splitAtBB i xs = -- collect (i >= 0 && i < length xs) $
+ splitAt i xs ==
+ let (x,y) = P.splitAt i (P.pack xs) in (P.unpack x, P.unpack y)
+
+prop_spanBB xs a = (span (/=a) xs) == (let (x,y) = P.span (/=a) (P.pack xs)
+ in (P.unpack x, P.unpack y))
+
+prop_breakBB xs a = (break (/=a) xs) == (let (x,y) = P.break (/=a) (P.pack xs)
+ in (P.unpack x, P.unpack y))
+
+prop_reverse1BB xs = (reverse xs) == (P.unpack . P.reverse . P.pack) xs
+prop_reverse2BB xs = P.reverse (P.pack xs) == P.pack (reverse xs)
+prop_reverse3BB xs = reverse (P.unpack xs) == (P.unpack . P.reverse) xs
+
+prop_elemBB xs a = (a `elem` xs) == (a `P.elem` (P.pack xs))
+
+prop_notElemBB c xs = P.notElem c (P.pack xs) == notElem c xs
+
+-- should try to stress it
+prop_concat1BB xs = (concat [xs,xs]) == (P.unpack $ P.concat [P.pack xs, P.pack xs])
+prop_concat2BB xs = (concat [xs,[]]) == (P.unpack $ P.concat [P.pack xs, P.pack []])
+prop_concatBB xss = P.concat (map P.pack xss) == P.pack (concat xss)
+
+prop_concatMapBB xs = C.concatMap C.singleton xs == (C.pack . concatMap (:[]) . C.unpack) xs
+
+prop_anyBB xs a = (any (== a) xs) == (P.any (== a) (P.pack xs))
+prop_allBB xs a = (all (== a) xs) == (P.all (== a) (P.pack xs))
+
+prop_linesBB xs = (lines xs) == ((map C.unpack) . C.lines . C.pack) xs
+
+prop_unlinesBB xs = (unlines.lines) xs == (C.unpack. C.unlines . C.lines .C.pack) xs
+
+prop_wordsBB xs =
+ (words xs) == ((map C.unpack) . C.words . C.pack) xs
+-- prop_wordstokensBB xs = C.words xs == C.tokens isSpace xs
+
+prop_unwordsBB xs =
+ (C.pack.unwords.words) xs == (C.unwords . C.words .C.pack) xs
+
+prop_groupBB xs = group xs == (map P.unpack . P.group . P.pack) xs
+
+prop_groupByBB xs = groupBy (==) xs == (map P.unpack . P.groupBy (==) . P.pack) xs
+prop_groupBy1BB xs = groupBy (/=) xs == (map P.unpack . P.groupBy (/=) . P.pack) xs
+
+prop_joinBB xs ys = (concat . (intersperse ys) . lines) xs ==
+ (C.unpack $ C.intercalate (C.pack ys) (C.lines (C.pack xs)))
+
+prop_elemIndex1BB xs = (elemIndex 'X' xs) == (C.elemIndex 'X' (C.pack xs))
+prop_elemIndex2BB xs c = (elemIndex c xs) == (C.elemIndex c (C.pack xs))
+
+-- prop_lineIndices1BB xs = C.elemIndices '\n' xs == C.lineIndices xs
+
+prop_countBB c xs = length (P.elemIndices c xs) == P.count c xs
+
+prop_elemIndexEnd1BB c xs = (P.elemIndexEnd c (P.pack xs)) ==
+ (case P.elemIndex c (P.pack (reverse xs)) of
+ Nothing -> Nothing
+ Just i -> Just (length xs -1 -i))
+
+prop_elemIndexEnd2BB c xs = (P.elemIndexEnd c (P.pack xs)) ==
+ ((-) (length xs - 1) `fmap` P.elemIndex c (P.pack $ reverse xs))
+
+prop_elemIndicesBB xs c = elemIndices c xs == P.elemIndices c (P.pack xs)
+
+prop_findIndexBB xs a = (findIndex (==a) xs) == (P.findIndex (==a) (P.pack xs))
+
+prop_findIndiciesBB xs c = (findIndices (==c) xs) == (P.findIndices (==c) (P.pack xs))
+
+-- example properties from QuickCheck.Batch
+prop_sort1BB xs = sort xs == (P.unpack . P.sort . P.pack) xs
+prop_sort2BB xs = (not (null xs)) ==> (P.head . P.sort . P.pack $ xs) == minimum xs
+prop_sort3BB xs = (not (null xs)) ==> (P.last . P.sort . P.pack $ xs) == maximum xs
+prop_sort4BB xs ys =
+ (not (null xs)) ==>
+ (not (null ys)) ==>
+ (P.head . P.sort) (P.append (P.pack xs) (P.pack ys)) == min (minimum xs) (minimum ys)
+prop_sort5BB xs ys =
+ (not (null xs)) ==>
+ (not (null ys)) ==>
+ (P.last . P.sort) (P.append (P.pack xs) (P.pack ys)) == max (maximum xs) (maximum ys)
+
+prop_intersperseBB c xs = (intersperse c xs) == (P.unpack $ P.intersperse c (P.pack xs))
+
+prop_transposeBB xs = (transpose xs) == ((map P.unpack) . P.transpose . (map P.pack)) xs
+
+prop_maximumBB xs = (not (null xs)) ==> (maximum xs) == (P.maximum ( P.pack xs ))
+prop_minimumBB xs = (not (null xs)) ==> (minimum xs) == (P.minimum ( P.pack xs ))
+
+-- prop_dropSpaceBB xs = dropWhile isSpace xs == C.unpack (C.dropSpace (C.pack xs))
+-- prop_dropSpaceEndBB xs = (C.reverse . (C.dropWhile isSpace) . C.reverse) (C.pack xs) ==
+-- (C.dropSpaceEnd (C.pack xs))
+
+-- prop_breakSpaceBB xs =
+-- (let (x,y) = C.breakSpace (C.pack xs)
+-- in (C.unpack x, C.unpack y)) == (break isSpace xs)
+
+prop_spanEndBB xs =
+ (C.spanEnd (not . isSpace) (C.pack xs)) ==
+ (let (x,y) = C.span (not.isSpace) (C.reverse (C.pack xs)) in (C.reverse y,C.reverse x))
+
+prop_breakEndBB p xs = P.breakEnd (not.p) xs == P.spanEnd p xs
+
+-- prop_breakCharBB c xs =
+-- (break (==c) xs) ==
+-- (let (x,y) = C.breakChar c (C.pack xs) in (C.unpack x, C.unpack y))
+
+-- prop_spanCharBB c xs =
+-- (break (/=c) xs) ==
+-- (let (x,y) = C.spanChar c (C.pack xs) in (C.unpack x, C.unpack y))
+
+-- prop_spanChar_1BB c xs =
+-- (C.span (==c) xs) == C.spanChar c xs
+
+-- prop_wordsBB' xs =
+-- (C.unpack . C.unwords . C.words' . C.pack) xs ==
+-- (map (\c -> if isSpace c then ' ' else c) xs)
+
+-- prop_linesBB' xs = (C.unpack . C.unlines' . C.lines' . C.pack) xs == (xs)
+
+prop_unfoldrBB c n =
+ (fst $ C.unfoldrN n fn c) == (C.pack $ take n $ unfoldr fn c)
+ where
+ fn x = Just (x, chr (ord x + 1))
+
+prop_prefixBB xs ys = isPrefixOf xs ys == (P.pack xs `P.isPrefixOf` P.pack ys)
+prop_suffixBB xs ys = isSuffixOf xs ys == (P.pack xs `P.isSuffixOf` P.pack ys)
+
+prop_copyBB xs = let p = P.pack xs in P.copy p == p
+
+prop_initsBB xs = inits xs == map P.unpack (P.inits (P.pack xs))
+
+prop_tailsBB xs = tails xs == map P.unpack (P.tails (P.pack xs))
+
+prop_findSubstringsBB s x l
+ = C.findSubstrings (C.pack p) (C.pack s) == naive_findSubstrings p s
+ where
+ _ = l :: Int
+ _ = x :: Int
+
+ -- we look for some random substring of the test string
+ p = take (model l) $ drop (model x) s
+
+ -- naive reference implementation
+ naive_findSubstrings :: String -> String -> [Int]
+ naive_findSubstrings p s = [x | x <- [0..length s], p `isPrefixOf` drop x s]
+
+prop_replicate1BB n c = P.unpack (P.replicate n c) == replicate n c
+prop_replicate2BB n c = P.replicate n c == fst (P.unfoldrN n (\u -> Just (u,u)) c)
+
+prop_replicate3BB c = P.unpack (P.replicate 0 c) == replicate 0 c
+
+prop_readintBB n = (fst . fromJust . C.readInt . C.pack . show) n == (n :: Int)
+prop_readintLL n = (fst . fromJust . D.readInt . D.pack . show) n == (n :: Int)
+
+prop_readint2BB s =
+ let s' = filter (\c -> c `notElem` ['0'..'9']) s
+ in C.readInt (C.pack s') == Nothing
+
+-- prop_filterChar1BB c xs = (filter (==c) xs) == ((C.unpack . C.filterChar c . C.pack) xs)
+-- prop_filterChar2BB c xs = (C.filter (==c) (C.pack xs)) == (C.filterChar c (C.pack xs))
+-- prop_filterChar3BB c xs = C.filterChar c xs == C.replicate (C.count c xs) c
+
+-- prop_filterNotChar1BB c xs = (filter (/=c) xs) == ((C.unpack . C.filterNotChar c . C.pack) xs)
+-- prop_filterNotChar2BB c xs = (C.filter (/=c) (C.pack xs)) == (C.filterNotChar c (C.pack xs))
+
+-- prop_joinjoinpathBB xs ys c = C.joinWithChar c xs ys == C.join (C.singleton c) [xs,ys]
+
+prop_zipBB xs ys = zip xs ys == P.zip (P.pack xs) (P.pack ys)
+prop_zip1BB xs ys = P.zip xs ys == zip (P.unpack xs) (P.unpack ys)
+
+prop_zipWithBB xs ys = P.zipWith (,) xs ys == P.zip xs ys
+-- prop_zipWith'BB xs ys = P.pack (P.zipWith (+) xs ys) == P.zipWith' (+) xs ys
+
+prop_unzipBB x = let (xs,ys) = unzip x in (P.pack xs, P.pack ys) == P.unzip x
+
+------------------------------------------------------------------------
+-- The entry point
+
+main = run tests
+
+run :: [(String, Int -> IO ())] -> IO ()
+run tests = do
+ x <- getArgs
+ let n = if null x then 100 else read . head $ x
+ mapM_ (\(s,a) -> printf "%-25s: " s >> a n) tests
+
+--
+-- And now a list of all the properties to test.
+--
+
+tests = bb_tests ++ ll_tests
+
+------------------------------------------------------------------------
+-- extra ByteString properties
+
+bb_tests =
+ [ ("bijection", mytest prop_bijectionBB)
+ , ("bijection'", mytest prop_bijectionBB')
+ , ("pack/unpack", mytest prop_packunpackBB)
+ , ("unpack/pack", mytest prop_packunpackBB')
+ , ("eq 1", mytest prop_eq1BB)
+ , ("eq 2", mytest prop_eq3BB)
+ , ("eq 3", mytest prop_eq3BB)
+ , ("compare 1", mytest prop_compare1BB)
+ , ("compare 2", mytest prop_compare2BB)
+ , ("compare 3", mytest prop_compare3BB)
+ , ("compare 4", mytest prop_compare4BB)
+ , ("compare 5", mytest prop_compare5BB)
+ , ("compare 6", mytest prop_compare6BB)
+ , ("compare 7", mytest prop_compare7BB)
+ , ("compare 8", mytest prop_compare8BB)
+ , ("empty 1", mytest prop_nil1BB)
+ , ("empty 2", mytest prop_nil2BB)
+ , ("null", mytest prop_nullBB)
+ , ("length 1", mytest prop_lengthBB)
+ , ("length 2", mytest prop_lengthSBB)
+ , ("cons 1", mytest prop_consBB)
+ , ("cons 2", mytest prop_cons1BB)
+ , ("cons 3", mytest prop_cons2BB)
+ , ("cons 4", mytest prop_cons3BB)
+ , ("cons 5", mytest prop_cons4BB)
+ , ("snoc", mytest prop_snoc1BB)
+ , ("head 1", mytest prop_head1BB)
+ , ("head 2", mytest prop_head2BB)
+ , ("head 3", mytest prop_head3BB)
+ , ("tail", mytest prop_tailBB)
+ , ("tail 1", mytest prop_tail1BB)
+ , ("last", mytest prop_lastBB)
+ , ("init", mytest prop_initBB)
+ , ("append 1", mytest prop_append1BB)
+ , ("append 2", mytest prop_append2BB)
+ , ("append 3", mytest prop_append3BB)
+ , ("map 1", mytest prop_map1BB)
+ , ("map 2", mytest prop_map2BB)
+ , ("map 3", mytest prop_map3BB)
+ , ("filter1", mytest prop_filter1BB)
+ , ("filter2", mytest prop_filter2BB)
+ , ("map fusion", mytest prop_mapfusionBB)
+ , ("filter fusion", mytest prop_filterfusionBB)
+ , ("reverse 1", mytest prop_reverse1BB)
+ , ("reverse 2", mytest prop_reverse2BB)
+ , ("reverse 3", mytest prop_reverse3BB)
+ , ("foldl 1", mytest prop_foldl1BB)
+ , ("foldl 2", mytest prop_foldl2BB)
+ , ("foldr 1", mytest prop_foldr1BB)
+ , ("foldr 2", mytest prop_foldr2BB)
+ , ("foldl1 1", mytest prop_foldl1_1BB)
+ , ("foldl1 2", mytest prop_foldl1_2BB)
+ , ("foldl1 3", mytest prop_foldl1_3BB)
+ , ("foldr1 1", mytest prop_foldr1_1BB)
+ , ("foldr1 2", mytest prop_foldr1_2BB)
+ , ("foldr1 3", mytest prop_foldr1_3BB)
+ , ("scanl/foldl", mytest prop_scanlfoldlBB)
+ , ("all", mytest prop_allBB)
+ , ("any", mytest prop_anyBB)
+ , ("take", mytest prop_takeBB)
+ , ("drop", mytest prop_dropBB)
+ , ("takeWhile", mytest prop_takeWhileBB)
+ , ("dropWhile", mytest prop_dropWhileBB)
+ , ("splitAt", mytest prop_splitAtBB)
+ , ("span", mytest prop_spanBB)
+ , ("break", mytest prop_breakBB)
+ , ("elem", mytest prop_elemBB)
+ , ("notElem", mytest prop_notElemBB)
+ , ("concat 1", mytest prop_concat1BB)
+ , ("concat 2", mytest prop_concat2BB)
+ , ("concat 3", mytest prop_concatBB)
+ , ("lines", mytest prop_linesBB)
+ , ("unlines", mytest prop_unlinesBB)
+ , ("words", mytest prop_wordsBB)
+ , ("unwords", mytest prop_unwordsBB)
+ , ("group", mytest prop_groupBB)
+ , ("groupBy", mytest prop_groupByBB)
+ , ("groupBy 1", mytest prop_groupBy1BB)
+ , ("join", mytest prop_joinBB)
+ , ("elemIndex 1", mytest prop_elemIndex1BB)
+ , ("elemIndex 2", mytest prop_elemIndex2BB)
+ , ("findIndex", mytest prop_findIndexBB)
+ , ("findIndicies", mytest prop_findIndiciesBB)
+ , ("elemIndices", mytest prop_elemIndicesBB)
+ , ("find", mytest prop_findBB)
+ , ("find/findIndex", mytest prop_find_findIndexBB)
+ , ("sort 1", mytest prop_sort1BB)
+ , ("sort 2", mytest prop_sort2BB)
+ , ("sort 3", mytest prop_sort3BB)
+ , ("sort 4", mytest prop_sort4BB)
+ , ("sort 5", mytest prop_sort5BB)
+ , ("intersperse", mytest prop_intersperseBB)
+ , ("maximum", mytest prop_maximumBB)
+ , ("minimum", mytest prop_minimumBB)
+-- , ("breakChar", mytest prop_breakCharBB)
+-- , ("spanChar 1", mytest prop_spanCharBB)
+-- , ("spanChar 2", mytest prop_spanChar_1BB)
+-- , ("breakSpace", mytest prop_breakSpaceBB)
+-- , ("dropSpace", mytest prop_dropSpaceBB)
+ , ("spanEnd", mytest prop_spanEndBB)
+ , ("breakEnd", mytest prop_breakEndBB)
+ , ("elemIndexEnd 1",mytest prop_elemIndexEnd1BB)
+ , ("elemIndexEnd 2",mytest prop_elemIndexEnd2BB)
+-- , ("words'", mytest prop_wordsBB')
+-- , ("lines'", mytest prop_linesBB')
+-- , ("dropSpaceEnd", mytest prop_dropSpaceEndBB)
+ , ("unfoldr", mytest prop_unfoldrBB)
+ , ("prefix", mytest prop_prefixBB)
+ , ("suffix", mytest prop_suffixBB)
+ , ("copy", mytest prop_copyBB)
+ , ("inits", mytest prop_initsBB)
+ , ("tails", mytest prop_tailsBB)
+ , ("findSubstrings ",mytest prop_findSubstringsBB)
+ , ("replicate1", mytest prop_replicate1BB)
+ , ("replicate2", mytest prop_replicate2BB)
+ , ("replicate3", mytest prop_replicate3BB)
+ , ("readInt", mytest prop_readintBB)
+ , ("readInt 2", mytest prop_readint2BB)
+ , ("Lazy.readInt", mytest prop_readintLL)
+-- , ("filterChar1", mytest prop_filterChar1BB)
+-- , ("filterChar2", mytest prop_filterChar2BB)
+-- , ("filterChar3", mytest prop_filterChar3BB)
+-- , ("filterNotChar1", mytest prop_filterNotChar1BB)
+-- , ("filterNotChar2", mytest prop_filterNotChar2BB)
+ , ("tail", mytest prop_tailSBB)
+ , ("index", mytest prop_indexBB)
+ , ("unsafeIndex", mytest prop_unsafeIndexBB)
+-- , ("map'", mytest prop_mapBB')
+ , ("filter", mytest prop_filterBB)
+ , ("elem", mytest prop_elemSBB)
+ , ("take", mytest prop_takeSBB)
+ , ("drop", mytest prop_dropSBB)
+ , ("splitAt", mytest prop_splitAtSBB)
+ , ("foldl", mytest prop_foldlBB)
+ , ("foldr", mytest prop_foldrBB)
+ , ("takeWhile ", mytest prop_takeWhileSBB)
+ , ("dropWhile ", mytest prop_dropWhileSBB)
+ , ("span ", mytest prop_spanSBB)
+ , ("break ", mytest prop_breakSBB)
+ , ("breakspan", mytest prop_breakspan_1BB)
+ , ("lines ", mytest prop_linesSBB)
+ , ("unlines ", mytest prop_unlinesSBB)
+ , ("words ", mytest prop_wordsSBB)
+ , ("unwords ", mytest prop_unwordsSBB)
+-- , ("wordstokens", mytest prop_wordstokensBB)
+ , ("splitWith", mytest prop_splitWithBB)
+ , ("joinsplit", mytest prop_joinsplitBB)
+-- , ("lineIndices", mytest prop_lineIndices1BB)
+ , ("count", mytest prop_countBB)
+-- , ("linessplit", mytest prop_linessplitBB)
+ , ("splitsplitWith", mytest prop_splitsplitWithBB)
+-- , ("joinjoinpath", mytest prop_joinjoinpathBB)
+ , ("zip", mytest prop_zipBB)
+ , ("zip1", mytest prop_zip1BB)
+ , ("zipWith", mytest prop_zipWithBB)
+-- , ("zipWith'", mytest prop_zipWith'BB)
+ , ("unzip", mytest prop_unzipBB)
+ , ("concatMap", mytest prop_concatMapBB)
+ ]
+
+
+------------------------------------------------------------------------
+-- Extra lazy properties
+
+ll_tests =
+ [("eq 1", mytest prop_eq1)
+ ,("eq 2", mytest prop_eq2)
+ ,("eq 3", mytest prop_eq3)
+ ,("eq refl", mytest prop_eq_refl)
+ ,("eq symm", mytest prop_eq_symm)
+ ,("compare 1", mytest prop_compare1)
+ ,("compare 2", mytest prop_compare2)
+ ,("compare 3", mytest prop_compare3)
+ ,("compare 4", mytest prop_compare4)
+ ,("compare 5", mytest prop_compare5)
+ ,("compare 6", mytest prop_compare6)
+ ,("compare 7", mytest prop_compare7)
+ ,("compare 8", mytest prop_compare8)
+ ,("empty 1", mytest prop_empty1)
+ ,("empty 2", mytest prop_empty2)
+ ,("pack/unpack", mytest prop_packunpack)
+ ,("unpack/pack", mytest prop_unpackpack)
+ ,("null", mytest prop_null)
+ ,("length 1", mytest prop_length1)
+ ,("length 2", mytest prop_length2)
+ ,("cons 1" , mytest prop_cons1)
+ ,("cons 2" , mytest prop_cons2)
+ ,("cons 3" , mytest prop_cons3)
+ ,("cons 4" , mytest prop_cons4)
+ ,("snoc" , mytest prop_snoc1)
+ ,("head/pack", mytest prop_head)
+ ,("head/unpack", mytest prop_head1)
+ ,("tail/pack", mytest prop_tail)
+ ,("tail/unpack", mytest prop_tail1)
+ ,("last", mytest prop_last)
+ ,("init", mytest prop_init)
+ ,("append 1", mytest prop_append1)
+ ,("append 2", mytest prop_append2)
+ ,("append 3", mytest prop_append3)
+ ,("map 1", mytest prop_map1)
+ ,("map 2", mytest prop_map2)
+ ,("map 3", mytest prop_map3)
+ ,("filter 1", mytest prop_filter1)
+ ,("filter 2", mytest prop_filter2)
+ ,("reverse", mytest prop_reverse)
+ ,("reverse1", mytest prop_reverse1)
+ ,("reverse2", mytest prop_reverse2)
+ ,("transpose", mytest prop_transpose)
+ ,("foldl", mytest prop_foldl)
+ ,("foldl/reverse", mytest prop_foldl_1)
+ ,("foldr", mytest prop_foldr)
+ ,("foldr/id", mytest prop_foldr_1)
+ ,("foldl1/foldl", mytest prop_foldl1_1)
+ ,("foldl1/head", mytest prop_foldl1_2)
+ ,("foldl1/tail", mytest prop_foldl1_3)
+ ,("foldr1/foldr", mytest prop_foldr1_1)
+ ,("foldr1/last", mytest prop_foldr1_2)
+ ,("foldr1/head", mytest prop_foldr1_3)
+ ,("concat 1", mytest prop_concat1)
+ ,("concat 2", mytest prop_concat2)
+ ,("concat/pack", mytest prop_concat3)
+ ,("any", mytest prop_any)
+ ,("all", mytest prop_all)
+ ,("maximum", mytest prop_maximum)
+ ,("minimum", mytest prop_minimum)
+ ,("replicate 1", mytest prop_replicate1)
+ ,("replicate 2", mytest prop_replicate2)
+ ,("take", mytest prop_take1)
+ ,("drop", mytest prop_drop1)
+ ,("splitAt", mytest prop_drop1)
+ ,("takeWhile", mytest prop_takeWhile)
+ ,("dropWhile", mytest prop_dropWhile)
+ ,("break", mytest prop_break)
+ ,("span", mytest prop_span)
+ ,("break/span", mytest prop_breakspan)
+-- ,("break/breakByte", mytest prop_breakByte)
+-- ,("span/spanByte", mytest prop_spanByte)
+ ,("split", mytest prop_split)
+ ,("splitWith", mytest prop_splitWith)
+ ,("join.split/id", mytest prop_joinsplit)
+-- ,("join/joinByte", mytest prop_joinjoinByte)
+ ,("group", mytest prop_group)
+-- ,("groupBy", mytest prop_groupBy)
+ ,("index", mytest prop_index)
+ ,("elemIndex", mytest prop_elemIndex)
+ ,("elemIndices", mytest prop_elemIndices)
+ ,("count/elemIndices", mytest prop_count)
+ ,("findIndex", mytest prop_findIndex)
+ ,("findIndices", mytest prop_findIndicies)
+ ,("find", mytest prop_find)
+ ,("find/findIndex", mytest prop_find_findIndex)
+ ,("elem", mytest prop_elem)
+ ,("notElem", mytest prop_notElem)
+ ,("elem/notElem", mytest prop_elem_notelem)
+-- ,("filterByte 1", mytest prop_filterByte)
+-- ,("filterByte 2", mytest prop_filterByte2)
+-- ,("filterNotByte 1", mytest prop_filterNotByte)
+-- ,("filterNotByte 2", mytest prop_filterNotByte2)
+ ,("isPrefixOf", mytest prop_isPrefixOf)
+ ,("concatMap", mytest prop_concatMap)
+ ]
+
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring005.stdout b/testsuite/tests/lib/Data.ByteString/bytestring005.stdout
new file mode 100644
index 0000000000..2efe5278dc
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring005.stdout
@@ -0,0 +1,226 @@
+bijection : OK, 100 tests.
+bijection' : OK, 100 tests.
+pack/unpack : OK, 100 tests.
+unpack/pack : OK, 100 tests.
+eq 1 : OK, 100 tests.
+eq 2 : OK, 100 tests.
+eq 3 : OK, 100 tests.
+compare 1 : OK, 100 tests.
+compare 2 : OK, 100 tests.
+compare 3 : OK, 100 tests.
+compare 4 : OK, 100 tests.
+compare 5 : OK, 100 tests.
+compare 6 : OK, 100 tests.
+compare 7 : OK, 100 tests.
+compare 8 : OK, 100 tests.
+empty 1 : OK, 100 tests.
+empty 2 : OK, 100 tests.
+null : OK, 100 tests.
+length 1 : OK, 100 tests.
+length 2 : OK, 100 tests.
+cons 1 : OK, 100 tests.
+cons 2 : OK, 100 tests.
+cons 3 : OK, 100 tests.
+cons 4 : OK, 100 tests.
+cons 5 : OK, 100 tests.
+snoc : OK, 100 tests.
+head 1 : OK, 100 tests.
+head 2 : OK, 100 tests.
+head 3 : OK, 100 tests.
+tail : OK, 100 tests.
+tail 1 : OK, 100 tests.
+last : OK, 100 tests.
+init : OK, 100 tests.
+append 1 : OK, 100 tests.
+append 2 : OK, 100 tests.
+append 3 : OK, 100 tests.
+map 1 : OK, 100 tests.
+map 2 : OK, 100 tests.
+map 3 : OK, 100 tests.
+filter1 : OK, 100 tests.
+filter2 : OK, 100 tests.
+map fusion : OK, 100 tests.
+filter fusion : OK, 100 tests.
+reverse 1 : OK, 100 tests.
+reverse 2 : OK, 100 tests.
+reverse 3 : OK, 100 tests.
+foldl 1 : OK, 100 tests.
+foldl 2 : OK, 100 tests.
+foldr 1 : OK, 100 tests.
+foldr 2 : OK, 100 tests.
+foldl1 1 : OK, 100 tests.
+foldl1 2 : OK, 100 tests.
+foldl1 3 : OK, 100 tests.
+foldr1 1 : OK, 100 tests.
+foldr1 2 : OK, 100 tests.
+foldr1 3 : OK, 100 tests.
+scanl/foldl : OK, 100 tests.
+all : OK, 100 tests.
+any : OK, 100 tests.
+take : OK, 100 tests.
+drop : OK, 100 tests.
+takeWhile : OK, 100 tests.
+dropWhile : OK, 100 tests.
+splitAt : OK, 100 tests.
+span : OK, 100 tests.
+break : OK, 100 tests.
+elem : OK, 100 tests.
+notElem : OK, 100 tests.
+concat 1 : OK, 100 tests.
+concat 2 : OK, 100 tests.
+concat 3 : OK, 100 tests.
+lines : OK, 100 tests.
+unlines : OK, 100 tests.
+words : OK, 100 tests.
+unwords : OK, 100 tests.
+group : OK, 100 tests.
+groupBy : OK, 100 tests.
+groupBy 1 : OK, 100 tests.
+join : OK, 100 tests.
+elemIndex 1 : OK, 100 tests.
+elemIndex 2 : OK, 100 tests.
+findIndex : OK, 100 tests.
+findIndicies : OK, 100 tests.
+elemIndices : OK, 100 tests.
+find : OK, 100 tests.
+find/findIndex : OK, 100 tests.
+sort 1 : OK, 100 tests.
+sort 2 : OK, 100 tests.
+sort 3 : OK, 100 tests.
+sort 4 : OK, 100 tests.
+sort 5 : OK, 100 tests.
+intersperse : OK, 100 tests.
+maximum : OK, 100 tests.
+minimum : OK, 100 tests.
+spanEnd : OK, 100 tests.
+breakEnd : OK, 100 tests.
+elemIndexEnd 1 : OK, 100 tests.
+elemIndexEnd 2 : OK, 100 tests.
+unfoldr : OK, 100 tests.
+prefix : OK, 100 tests.
+suffix : OK, 100 tests.
+copy : OK, 100 tests.
+inits : OK, 100 tests.
+tails : OK, 100 tests.
+findSubstrings : OK, 100 tests.
+replicate1 : OK, 100 tests.
+replicate2 : OK, 100 tests.
+replicate3 : OK, 100 tests.
+readInt : OK, 100 tests.
+readInt 2 : OK, 100 tests.
+Lazy.readInt : OK, 100 tests.
+tail : OK, 100 tests.
+index : OK, 100 tests.
+unsafeIndex : OK, 100 tests.
+filter : OK, 100 tests.
+elem : OK, 100 tests.
+take : OK, 100 tests.
+drop : OK, 100 tests.
+splitAt : OK, 100 tests.
+foldl : OK, 100 tests.
+foldr : OK, 100 tests.
+takeWhile : OK, 100 tests.
+dropWhile : OK, 100 tests.
+span : OK, 100 tests.
+break : OK, 100 tests.
+breakspan : OK, 100 tests.
+lines : OK, 100 tests.
+unlines : OK, 100 tests.
+words : OK, 100 tests.
+unwords : OK, 100 tests.
+splitWith : OK, 100 tests.
+joinsplit : OK, 100 tests.
+count : OK, 100 tests.
+splitsplitWith : OK, 100 tests.
+zip : OK, 100 tests.
+zip1 : OK, 100 tests.
+zipWith : OK, 100 tests.
+unzip : OK, 100 tests.
+concatMap : OK, 100 tests.
+eq 1 : OK, 100 tests.
+eq 2 : OK, 100 tests.
+eq 3 : OK, 100 tests.
+eq refl : OK, 100 tests.
+eq symm : OK, 100 tests.
+compare 1 : OK, 100 tests.
+compare 2 : OK, 100 tests.
+compare 3 : OK, 100 tests.
+compare 4 : OK, 100 tests.
+compare 5 : OK, 100 tests.
+compare 6 : OK, 100 tests.
+compare 7 : OK, 100 tests.
+compare 8 : OK, 100 tests.
+empty 1 : OK, 100 tests.
+empty 2 : OK, 100 tests.
+pack/unpack : OK, 100 tests.
+unpack/pack : OK, 100 tests.
+null : OK, 100 tests.
+length 1 : OK, 100 tests.
+length 2 : OK, 100 tests.
+cons 1 : OK, 100 tests.
+cons 2 : OK, 100 tests.
+cons 3 : OK, 100 tests.
+cons 4 : OK, 100 tests.
+snoc : OK, 100 tests.
+head/pack : OK, 100 tests.
+head/unpack : OK, 100 tests.
+tail/pack : OK, 100 tests.
+tail/unpack : OK, 100 tests.
+last : OK, 100 tests.
+init : OK, 100 tests.
+append 1 : OK, 100 tests.
+append 2 : OK, 100 tests.
+append 3 : OK, 100 tests.
+map 1 : OK, 100 tests.
+map 2 : OK, 100 tests.
+map 3 : OK, 100 tests.
+filter 1 : OK, 100 tests.
+filter 2 : OK, 100 tests.
+reverse : OK, 100 tests.
+reverse1 : OK, 100 tests.
+reverse2 : OK, 100 tests.
+transpose : OK, 100 tests.
+foldl : OK, 100 tests.
+foldl/reverse : OK, 100 tests.
+foldr : OK, 100 tests.
+foldr/id : OK, 100 tests.
+foldl1/foldl : OK, 100 tests.
+foldl1/head : OK, 100 tests.
+foldl1/tail : OK, 100 tests.
+foldr1/foldr : OK, 100 tests.
+foldr1/last : OK, 100 tests.
+foldr1/head : OK, 100 tests.
+concat 1 : OK, 100 tests.
+concat 2 : OK, 100 tests.
+concat/pack : OK, 100 tests.
+any : OK, 100 tests.
+all : OK, 100 tests.
+maximum : OK, 100 tests.
+minimum : OK, 100 tests.
+replicate 1 : OK, 100 tests.
+replicate 2 : OK, 100 tests.
+take : OK, 100 tests.
+drop : OK, 100 tests.
+splitAt : OK, 100 tests.
+takeWhile : OK, 100 tests.
+dropWhile : OK, 100 tests.
+break : OK, 100 tests.
+span : OK, 100 tests.
+break/span : OK, 100 tests.
+split : OK, 100 tests.
+splitWith : OK, 100 tests.
+join.split/id : OK, 100 tests.
+group : OK, 100 tests.
+index : OK, 100 tests.
+elemIndex : OK, 100 tests.
+elemIndices : OK, 100 tests.
+count/elemIndices : OK, 100 tests.
+findIndex : OK, 100 tests.
+findIndices : OK, 100 tests.
+find : OK, 100 tests.
+find/findIndex : OK, 100 tests.
+elem : OK, 100 tests.
+notElem : OK, 100 tests.
+elem/notElem : OK, 100 tests.
+isPrefixOf : OK, 100 tests.
+concatMap : OK, 100 tests.
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring006.hs b/testsuite/tests/lib/Data.ByteString/bytestring006.hs
new file mode 100644
index 0000000000..d58147a485
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring006.hs
@@ -0,0 +1,10 @@
+
+module Main (main) where
+
+import qualified Data.ByteString.Char8 as B
+import qualified Data.ByteString.Lazy.Char8 as L
+
+main :: IO ()
+main = do print $ map B.unpack $ B.lines $ B.pack "a\n\nb\n\nc"
+ print $ map L.unpack $ L.lines $ L.pack "a\n\nb\n\nc"
+
diff --git a/testsuite/tests/lib/Data.ByteString/bytestring006.stdout b/testsuite/tests/lib/Data.ByteString/bytestring006.stdout
new file mode 100644
index 0000000000..240d746197
--- /dev/null
+++ b/testsuite/tests/lib/Data.ByteString/bytestring006.stdout
@@ -0,0 +1,2 @@
+["a","","b","","c"]
+["a","","b","","c"]
diff --git a/testsuite/tests/lib/Data.Fixed/Makefile b/testsuite/tests/lib/Data.Fixed/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Data.Fixed/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Data.Fixed/all.T b/testsuite/tests/lib/Data.Fixed/all.T
new file mode 100644
index 0000000000..c4d77d28c8
--- /dev/null
+++ b/testsuite/tests/lib/Data.Fixed/all.T
@@ -0,0 +1 @@
+test('data-fixed-show-read', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs b/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs
new file mode 100644
index 0000000000..349f639f2c
--- /dev/null
+++ b/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs
@@ -0,0 +1,22 @@
+
+module Main (main) where
+
+import Data.Fixed
+
+main :: IO ()
+main = do doit 38.001
+ doit 38.009
+ doit 38.01
+ doit 38.09
+ print (read "38" :: Centi)
+ doit (-38.001)
+ doit (-38.009)
+ doit (-38.01)
+ doit (-38.09)
+ print (read "-38" :: Centi)
+
+doit :: Centi -> IO ()
+doit c = do let s = show c
+ r = read s :: Centi
+ putStrLn s
+ print r
diff --git a/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.stdout b/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.stdout
new file mode 100644
index 0000000000..0e5d7caef5
--- /dev/null
+++ b/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.stdout
@@ -0,0 +1,18 @@
+38.00
+38.00
+38.00
+38.00
+38.01
+38.01
+38.09
+38.09
+38.00
+-38.00
+-38.00
+-38.00
+-38.00
+-38.01
+-38.01
+-38.09
+-38.09
+-38.00
diff --git a/testsuite/tests/lib/Data.HashTable/Makefile b/testsuite/tests/lib/Data.HashTable/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Data.HashTable/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Data.HashTable/all.T b/testsuite/tests/lib/Data.HashTable/all.T
new file mode 100644
index 0000000000..20b60f27cc
--- /dev/null
+++ b/testsuite/tests/lib/Data.HashTable/all.T
@@ -0,0 +1 @@
+test('hash001', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Data.HashTable/hash001.hs b/testsuite/tests/lib/Data.HashTable/hash001.hs
new file mode 100644
index 0000000000..727f488eb3
--- /dev/null
+++ b/testsuite/tests/lib/Data.HashTable/hash001.hs
@@ -0,0 +1,14 @@
+import Data.HashTable
+import qualified Data.HashTable as HT
+
+test :: Int -> IO ()
+test n = do ht <- new (==) hashInt
+ sequence_ [ insert ht key 0 | key <- [0..n]]
+ sequence_ [ insert ht key 1 | key <- [0..n]]
+
+ let check key = do (Just val) <- HT.lookup ht key
+ if val==1 then return () else putStrLn $ show key
+
+ sequence_ [ check key | key <- [0..n]]
+
+main = test 2048
diff --git a/testsuite/tests/lib/Data.Ix/Makefile b/testsuite/tests/lib/Data.Ix/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Data.Ix/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Data.Ix/all.T b/testsuite/tests/lib/Data.Ix/all.T
new file mode 100644
index 0000000000..972be5dc08
--- /dev/null
+++ b/testsuite/tests/lib/Data.Ix/all.T
@@ -0,0 +1 @@
+test('ix001', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Data.Ix/ix001.hs b/testsuite/tests/lib/Data.Ix/ix001.hs
new file mode 100644
index 0000000000..c723472bce
--- /dev/null
+++ b/testsuite/tests/lib/Data.Ix/ix001.hs
@@ -0,0 +1,4 @@
+import Data.Ix
+import Data.Int
+
+main = print (index (minBound::Int16,maxBound) maxBound)
diff --git a/testsuite/tests/lib/Data.Ix/ix001.stdout b/testsuite/tests/lib/Data.Ix/ix001.stdout
new file mode 100644
index 0000000000..7a53b35687
--- /dev/null
+++ b/testsuite/tests/lib/Data.Ix/ix001.stdout
@@ -0,0 +1 @@
+65535
diff --git a/testsuite/tests/lib/Data.List/Makefile b/testsuite/tests/lib/Data.List/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Data.List/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Data.List/all.T b/testsuite/tests/lib/Data.List/all.T
new file mode 100644
index 0000000000..125734882a
--- /dev/null
+++ b/testsuite/tests/lib/Data.List/all.T
@@ -0,0 +1,2 @@
+test('take001', extra_run_opts('1'), compile_and_run, [''])
+test('genericNegative001', extra_run_opts('-1'), compile_and_run, ['']) \ No newline at end of file
diff --git a/testsuite/tests/lib/Data.List/genericNegative001.hs b/testsuite/tests/lib/Data.List/genericNegative001.hs
new file mode 100644
index 0000000000..f59a42ffbc
--- /dev/null
+++ b/testsuite/tests/lib/Data.List/genericNegative001.hs
@@ -0,0 +1,8 @@
+-- Test for http://hackage.haskell.org/trac/ghc/ticket/2533
+import System.Environment
+import Data.List
+main = do
+ (n:_) <- getArgs
+ print (genericTake (read n) "none taken")
+ print (genericDrop (read n) "none dropped")
+ print (genericSplitAt (read n) "none split")
diff --git a/testsuite/tests/lib/Data.List/genericNegative001.stdout b/testsuite/tests/lib/Data.List/genericNegative001.stdout
new file mode 100644
index 0000000000..b8a090716c
--- /dev/null
+++ b/testsuite/tests/lib/Data.List/genericNegative001.stdout
@@ -0,0 +1,3 @@
+""
+"none dropped"
+("","none split")
diff --git a/testsuite/tests/lib/Data.List/take001.hs b/testsuite/tests/lib/Data.List/take001.hs
new file mode 100644
index 0000000000..a7a531480a
--- /dev/null
+++ b/testsuite/tests/lib/Data.List/take001.hs
@@ -0,0 +1,5 @@
+-- Test for bug #1219, F/B rule for take was too strict
+import System.Environment
+main = do
+ (n:_) <- getArgs
+ print (map (const 'x') (take (read n) (undefined:undefined)))
diff --git a/testsuite/tests/lib/Data.List/take001.stdout b/testsuite/tests/lib/Data.List/take001.stdout
new file mode 100644
index 0000000000..92232f694a
--- /dev/null
+++ b/testsuite/tests/lib/Data.List/take001.stdout
@@ -0,0 +1 @@
+"x"
diff --git a/testsuite/tests/lib/IO/2122.hs b/testsuite/tests/lib/IO/2122.hs
new file mode 100644
index 0000000000..6807f3476a
--- /dev/null
+++ b/testsuite/tests/lib/IO/2122.hs
@@ -0,0 +1,76 @@
+{-
+
+Before running this, check that /tmp/test does not exist and
+contain something important. Then do:
+
+ $ touch /tmp/test
+
+If you do:
+
+ $ runhaskell Test.hs
+
+it will work. If you do:
+
+ $ runhaskell Test.hs fail
+
+it will fail every time with:
+
+Test.hs: writeFile: /tmp/test: openFile: resource busy (file is locked)
+
+-}
+
+import Control.Monad
+import System.Directory
+import System.IO
+import System.Environment
+-- Used by test2:
+-- import System.Posix.IO
+
+fp = "2122-test"
+
+main :: IO ()
+main = do
+ writeFile fp "test"
+ test True
+
+-- fails everytime when causeFailure is True in GHCi, with runhaskell,
+-- or when compiled.
+test :: Bool -> IO ()
+test causeFailure =
+ do h1 <- openFile fp ReadMode `Prelude.catch` (\e -> error ("openFile 1: " ++ show e))
+ when causeFailure $ do
+ h2 <- openFile fp ReadMode `Prelude.catch` (\e -> error ("openFile 2: " ++ show e))
+ hClose h2
+ hClose h1
+ removeFile fp
+ writeFile fp (show [1..100]) `Prelude.catch` (\e -> error ("writeFile: " ++ show e))
+
+{-
+-- this version never fails (except in GHCi, if test has previously failed).
+-- probably because openFd does not try to lock the file
+test2 :: Bool -> IO ()
+test2 causeFailure =
+ do fd1 <- openFd fp ReadOnly Nothing defaultFileFlags `Prelude.catch` (\e -> error ("openFile 1: " ++ show e))
+ when causeFailure $ do
+ fd2 <- openFd fp ReadOnly Nothing defaultFileFlags `Prelude.catch` (\e -> error ("openFile 2: " ++ show e))
+ closeFd fd2
+ closeFd fd1
+ removeFile fp
+ writeFile fp (show [1..100]) `Prelude.catch` (\e -> error ("writeFile: " ++ show e))
+-}
+
+{-
+-- fails sometimes when run repeated in GHCi, but seems fine with
+-- runhaskell or compiled
+test3 :: IO ()
+test3 =
+ do h1 <- openFile fp ReadMode `Prelude.catch` (\e -> error ("openFile 1: " ++ show e))
+ h2 <- openFile fp ReadMode `Prelude.catch` (\e -> error ("openFile 2: " ++ show e))
+ removeFile fp
+ writeFile fp (show [1..100]) `Prelude.catch` (\e -> error ("writeFile: " ++ show e))
+ print =<< hGetContents h1
+ print =<< hGetContents h2
+ hClose h2
+ hClose h1
+-}
+
diff --git a/testsuite/tests/lib/IO/3307.hs b/testsuite/tests/lib/IO/3307.hs
new file mode 100644
index 0000000000..fb1a360ea2
--- /dev/null
+++ b/testsuite/tests/lib/IO/3307.hs
@@ -0,0 +1,52 @@
+import Control.Exception
+
+import System.Directory
+import System.Environment
+import System.IO
+
+import Data.Char
+import Data.List
+
+import GHC.IO.Encoding
+
+main = do
+ hSetBuffering stdout NoBuffering
+
+ -- 1) A file name arriving via an argument
+ putStrLn "Test 1"
+ [file] <- getArgs
+ print $ map ord file
+ readFile file >>= putStr
+
+ -- 2) A file name arriving via getDirectoryContents
+ putStrLn "Test 2"
+ [file] <- fmap (filter ("chinese-file-" `isPrefixOf`)) $ getDirectoryContents "."
+ print $ map ord file
+ readFile file >>= putStr
+
+ -- 3) A file name occurring literally in the program
+ -- The file is created with a UTF-8 file name as well, so this will only work in Windows or a
+ -- UTF-8 locale, or this string will be encoded in some non-UTF-8 way and won't match.
+ putStrLn "Test 3"
+ let file = "chinese-file-å°è¯´"
+ print $ map ord file
+ readFile file >>= putStr
+
+ -- 4) A file name arriving via another file.
+ -- Again, the file is created with UTF-8 contents, so we read it in that encoding.
+ -- Once again, on non-Windows this may fail in a non-UTF-8 locale because we could encode the valid
+ -- filename string into a useless non-UTF-8 byte sequence.
+ putStrLn "Test 4"
+ str <- readFileAs utf8 "chinese-name"
+ let file = dropTrailingSpace str
+ print $ map ord file
+ readFile file >>= putStr
+
+readFileAs :: TextEncoding -> FilePath -> IO String
+readFileAs enc fp = do
+ h <- openFile fp ReadMode
+ hSetEncoding h enc
+ hGetContents h
+
+dropTrailingSpace :: String -> String
+dropTrailingSpace = reverse . dropWhile (not . isAlphaNum) . reverse
diff --git a/testsuite/tests/lib/IO/3307.stdout b/testsuite/tests/lib/IO/3307.stdout
new file mode 100644
index 0000000000..8b26b5ff1d
--- /dev/null
+++ b/testsuite/tests/lib/IO/3307.stdout
@@ -0,0 +1,12 @@
+Test 1
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
+Ni hao
+Test 2
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
+Ni hao
+Test 3
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
+Ni hao
+Test 4
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
+Ni hao
diff --git a/testsuite/tests/lib/IO/4808.hs b/testsuite/tests/lib/IO/4808.hs
new file mode 100644
index 0000000000..97ca344bb4
--- /dev/null
+++ b/testsuite/tests/lib/IO/4808.hs
@@ -0,0 +1,12 @@
+import System.IO
+import GHC.IO.Handle
+import GHC.IO.FD as FD
+
+main = do
+ (fd, _) <- FD.openFile "4808.hs" ReadWriteMode False
+ hdl <- mkDuplexHandle fd "4808.hs" Nothing nativeNewlineMode
+ hClose hdl
+ (fd2, _) <- FD.openFile "4808.hs" ReadWriteMode False
+ print (fdFD fd == fdFD fd2) -- should be True
+ hGetLine hdl >>= print -- should fail with an exception
+
diff --git a/testsuite/tests/lib/IO/4808.stderr b/testsuite/tests/lib/IO/4808.stderr
new file mode 100644
index 0000000000..cccd936d05
--- /dev/null
+++ b/testsuite/tests/lib/IO/4808.stderr
@@ -0,0 +1 @@
+4808: 4808.hs: hGetLine: illegal operation (handle is closed)
diff --git a/testsuite/tests/lib/IO/4808.stdout b/testsuite/tests/lib/IO/4808.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/lib/IO/4808.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/lib/IO/4855.hs b/testsuite/tests/lib/IO/4855.hs
new file mode 100644
index 0000000000..fa862aaf14
--- /dev/null
+++ b/testsuite/tests/lib/IO/4855.hs
@@ -0,0 +1,3 @@
+import Debug.Trace
+
+main = trace "我爱我的电脑" $ return () \ No newline at end of file
diff --git a/testsuite/tests/lib/IO/4855.stderr b/testsuite/tests/lib/IO/4855.stderr
new file mode 100644
index 0000000000..558550e229
--- /dev/null
+++ b/testsuite/tests/lib/IO/4855.stderr
@@ -0,0 +1 @@
+我爱我的电脑
diff --git a/testsuite/tests/lib/IO/4895.hs b/testsuite/tests/lib/IO/4895.hs
new file mode 100644
index 0000000000..bb37915e19
--- /dev/null
+++ b/testsuite/tests/lib/IO/4895.hs
@@ -0,0 +1,9 @@
+module Main where
+import Foreign.Marshal.Alloc
+import System.IO
+
+main = do
+ h <- openBinaryFile "4895.hs" ReadMode
+ allocaBytes 10 $ \ptr -> hGetBuf h ptr 10
+ some <- allocaBytes 10 $ \ptr -> hGetBufSome h ptr 10
+ print some
diff --git a/testsuite/tests/lib/IO/4895.stdout b/testsuite/tests/lib/IO/4895.stdout
new file mode 100644
index 0000000000..f599e28b8a
--- /dev/null
+++ b/testsuite/tests/lib/IO/4895.stdout
@@ -0,0 +1 @@
+10
diff --git a/testsuite/tests/lib/IO/IOError001.hs b/testsuite/tests/lib/IO/IOError001.hs
new file mode 100644
index 0000000000..dee7f31e29
--- /dev/null
+++ b/testsuite/tests/lib/IO/IOError001.hs
@@ -0,0 +1,7 @@
+
+-- test for a bug in GHC <= 4.08.2: handles were being left locked after
+-- being shown in an error message.
+main = do
+ getContents
+ catch getChar (\e -> print e >> return 'x')
+ catch getChar (\e -> print e >> return 'x')
diff --git a/testsuite/tests/lib/IO/IOError001.stdout b/testsuite/tests/lib/IO/IOError001.stdout
new file mode 100644
index 0000000000..1e689bb0f9
--- /dev/null
+++ b/testsuite/tests/lib/IO/IOError001.stdout
@@ -0,0 +1,2 @@
+<stdin>: hGetChar: illegal operation (handle is closed)
+<stdin>: hGetChar: illegal operation (handle is closed)
diff --git a/testsuite/tests/lib/IO/IOError001.stdout-hugs b/testsuite/tests/lib/IO/IOError001.stdout-hugs
new file mode 100644
index 0000000000..036084a006
--- /dev/null
+++ b/testsuite/tests/lib/IO/IOError001.stdout-hugs
@@ -0,0 +1,2 @@
+<stdin>: getChar: illegal operation (handle is semi-closed)
+<stdin>: getChar: illegal operation (handle is semi-closed)
diff --git a/testsuite/tests/lib/IO/IOError002.hs b/testsuite/tests/lib/IO/IOError002.hs
new file mode 100644
index 0000000000..144e62783b
--- /dev/null
+++ b/testsuite/tests/lib/IO/IOError002.hs
@@ -0,0 +1,5 @@
+-- !!! IOErrors should have Eq defined
+
+import System.IO
+
+main = print (userError "urk" == userError "urk")
diff --git a/testsuite/tests/lib/IO/IOError002.stdout b/testsuite/tests/lib/IO/IOError002.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/lib/IO/IOError002.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/lib/IO/Makefile b/testsuite/tests/lib/IO/Makefile
new file mode 100644
index 0000000000..6808f5f868
--- /dev/null
+++ b/testsuite/tests/lib/IO/Makefile
@@ -0,0 +1,48 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+test.concio001:
+ $(TEST_HC) $(TEST_HC_OPTS) --make -fforce-recomp -v0 concio001 -o concio001
+ (sleep 1; echo x) | ./concio001
+
+test.concio001.thr:
+ $(TEST_HC) $(TEST_HC_OPTS) --make -fforce-recomp -v0 -threaded concio001 -o concio001
+ (sleep 1; echo x) | ./concio001
+
+# NB. utf8-test should *not* have a final newline. The last char should be 'X'.
+utf16-test: utf8-test
+ iconv -f UTF-8 -t UTF-16 <utf8-test >utf16-test
+
+utf16le-test: utf8-test
+ iconv -f UTF-8 -t UTF-16LE <utf8-test >utf16le-test
+
+utf16be-test: utf8-test
+ iconv -f UTF-8 -t UTF-16BE <utf8-test >utf16be-test
+
+utf32-test: utf8-test
+ iconv -f UTF-8 -t UTF-32 <utf8-test >utf32-test
+
+utf32le-test: utf8-test
+ iconv -f UTF-8 -t UTF-32LE <utf8-test >utf32le-test
+
+utf32be-test: utf8-test
+ iconv -f UTF-8 -t UTF-32BE <utf8-test >utf32be-test
+
+utf8-bom-test: utf16-test
+ iconv -f UTF-16LE -t UTF-8 <utf16-test >utf8-bom-test
+
+hSetEncoding001.in : latin1 utf8-test utf16le-test utf16be-test utf16-test utf32le-test utf32be-test utf32-test utf8-bom-test
+ cat >$@ latin1 utf8-test utf16le-test utf16be-test utf16-test utf32-test utf32le-test utf32be-test utf8-bom-test
+
+environment001-test:
+ "$(TEST_HC)" --make -fforce-recomp -v0 environment001.hs -o environment001
+ GHC_TEST=马克斯 ./environment001 说
+
+3307-test:
+ "$(TEST_HC)" --make -fforce-recomp -v0 3307.hs -o 3307
+ echo Ni hao > chinese-file-å°è¯´
+ echo chinese-file-å°è¯´ > chinese-name
+ # The tests are run in whatever the default locale is. This is almost always UTF-8,
+ # but in cmd on Windows it will be the non-Unicode CP850 locale.
+ ./3307 chinese-file-å°è¯´
diff --git a/testsuite/tests/lib/IO/T4113.hs b/testsuite/tests/lib/IO/T4113.hs
new file mode 100644
index 0000000000..3bc8096baa
--- /dev/null
+++ b/testsuite/tests/lib/IO/T4113.hs
@@ -0,0 +1,20 @@
+
+module Main (main) where
+
+import Control.Exception
+import Prelude hiding (catch)
+import System.Directory
+
+main :: IO ()
+main = do doit ""
+ doit "/no/such/file"
+
+doit :: FilePath -> IO ()
+doit fp = do fp' <- canonicalizePath fp
+ print (fp, mangle fp')
+ `catch` \e -> putStrLn ("Exception: " ++ show (e :: IOException))
+ where -- On Windows, "/no/such/file" -> "C:\\no\\such\\file", so
+ -- we remove the drive letter so as to get consistent output
+ mangle (_ : ':' : xs) = "drive:" ++ xs
+ mangle xs = xs
+
diff --git a/testsuite/tests/lib/IO/T4113.stdout b/testsuite/tests/lib/IO/T4113.stdout
new file mode 100644
index 0000000000..86a7e9e295
--- /dev/null
+++ b/testsuite/tests/lib/IO/T4113.stdout
@@ -0,0 +1,2 @@
+Exception: : canonicalizePath: does not exist (No such file or directory)
+Exception: /no/such/file: canonicalizePath: does not exist (No such file or directory)
diff --git a/testsuite/tests/lib/IO/T4113.stdout-i386-unknown-mingw32 b/testsuite/tests/lib/IO/T4113.stdout-i386-unknown-mingw32
new file mode 100644
index 0000000000..16f302c475
--- /dev/null
+++ b/testsuite/tests/lib/IO/T4113.stdout-i386-unknown-mingw32
@@ -0,0 +1,2 @@
+Exception: getFullPathName: invalid argument (The filename, directory name, or volume label syntax is incorrect.)
+("/no/such/file","drive:\\no\\such\\file")
diff --git a/testsuite/tests/lib/IO/T4144.hs b/testsuite/tests/lib/IO/T4144.hs
new file mode 100644
index 0000000000..ca14363682
--- /dev/null
+++ b/testsuite/tests/lib/IO/T4144.hs
@@ -0,0 +1,115 @@
+{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
+module Main (main) where
+
+import Control.Applicative
+import Control.Concurrent.MVar
+import Control.Monad
+
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Char8
+import Data.ByteString.Char8()
+import Data.ByteString.Unsafe as B
+import Data.ByteString.Internal (memcpy)
+import Data.Typeable (Typeable)
+import Data.Word
+
+import Foreign
+
+import GHC.IO.Buffer
+import GHC.IO.BufferedIO
+import GHC.IO.Device
+import GHC.IO.Handle
+
+import System.IO
+
+-- | Create a seakable read-handle from a bytestring
+bsHandle :: ByteString -> FilePath -> IO Handle
+bsHandle bs fp
+ = newBsDevice bs >>= \dev ->
+ mkFileHandle dev fp ReadMode Nothing noNewlineTranslation
+
+data BSIODevice
+ = BSIODevice
+ ByteString
+ (MVar Int) -- Position
+ deriving Typeable
+
+newBsDevice :: ByteString -> IO BSIODevice
+newBsDevice bs = BSIODevice bs <$> newMVar 0
+
+remaining :: BSIODevice -> IO Int
+remaining (BSIODevice bs mPos)
+ = do
+ let bsLen = B.length bs
+ withMVar mPos $ \pos -> return (bsLen - pos)
+
+sizeBS :: BSIODevice -> Int
+sizeBS (BSIODevice bs _) = B.length bs
+
+seekBS :: BSIODevice -> SeekMode -> Int -> IO ()
+seekBS dev AbsoluteSeek pos
+ | pos < 0 = error "Cannot seek to a negative position!"
+ | pos > sizeBS dev = error "Cannot seek past end of handle!"
+ | otherwise = case dev of
+ BSIODevice _ mPos
+ -> modifyMVar_ mPos $ \_ -> return pos
+seekBS dev SeekFromEnd pos = seekBS dev AbsoluteSeek (sizeBS dev - pos)
+seekBS dev RelativeSeek pos
+ = case dev of
+ BSIODevice _bs mPos
+ -> modifyMVar_ mPos $ \curPos ->
+ let newPos = curPos + pos
+ in if newPos < 0 || newPos > sizeBS dev
+ then error "Cannot seek outside of handle!"
+ else return newPos
+
+tellBS :: BSIODevice -> IO Int
+tellBS (BSIODevice _ mPos) = readMVar mPos
+
+dupBS :: BSIODevice -> IO BSIODevice
+dupBS (BSIODevice bs mPos) = BSIODevice bs <$> (readMVar mPos >>= newMVar)
+
+readBS :: BSIODevice -> Ptr Word8 -> Int -> IO Int
+readBS dev@(BSIODevice bs mPos) buff amount
+ = do
+ rem <- remaining dev
+ if amount > rem
+ then readBS dev buff rem
+ else B.unsafeUseAsCString bs $ \ptr ->
+ do
+ memcpy buff (castPtr ptr) (fromIntegral amount)
+ modifyMVar_ mPos (return . (+amount))
+ return amount
+
+instance BufferedIO BSIODevice where
+ newBuffer dev buffState = newByteBuffer (sizeBS dev) buffState
+ fillReadBuffer dev buff = readBuf dev buff
+ fillReadBuffer0 dev buff
+ = do
+ (amount, buff') <- fillReadBuffer dev buff
+ return (if amount == 0 then Nothing else Just amount, buff')
+
+instance RawIO BSIODevice where
+ read = readBS
+ readNonBlocking dev buff n = Just `liftM` readBS dev buff n
+
+instance IODevice BSIODevice where
+ ready _ True _ = return False -- read only
+ ready _ False _ = return True -- always ready
+
+ close _ = return ()
+ isTerminal _ = return False
+ isSeekable _ = return True
+ seek dev seekMode pos = seekBS dev seekMode (fromIntegral pos)
+ tell dev = fromIntegral <$> tellBS dev
+ getSize dev = return $ fromIntegral $ sizeBS dev
+ setEcho _ _ = error "Not a terminal device"
+ getEcho _ = error "Not a terminal device"
+ setRaw _ _ = error "Raw mode not supported"
+ devType _ = return RegularFile
+ dup = dupBS
+ dup2 _ _ = error "Dup2 not supported"
+
+
+main = bsHandle "test" "<fake file>" >>= Data.ByteString.Char8.hGetContents >>= print
diff --git a/testsuite/tests/lib/IO/T4144.stdout b/testsuite/tests/lib/IO/T4144.stdout
new file mode 100644
index 0000000000..8b8441b91d
--- /dev/null
+++ b/testsuite/tests/lib/IO/T4144.stdout
@@ -0,0 +1 @@
+"test"
diff --git a/testsuite/tests/lib/IO/all.T b/testsuite/tests/lib/IO/all.T
new file mode 100644
index 0000000000..cf557a6b96
--- /dev/null
+++ b/testsuite/tests/lib/IO/all.T
@@ -0,0 +1,173 @@
+# -*- coding: utf-8 -*-
+
+def expect_fail_if_windows(opts):
+ f = if_platform('i386-unknown-mingw32', expect_fail);
+ return f(opts);
+
+test('IOError001', compose(omit_ways(['ghci']), set_stdin('IOError001.hs')),
+ compile_and_run, [''])
+
+test('IOError002', normal, compile_and_run, [''])
+test('finalization001', normal, compile_and_run, [''])
+test('hClose001', extra_clean(['hClose001.tmp']), compile_and_run, [''])
+test('hClose002', extra_clean(['hClose002.tmp']), compile_and_run, [''])
+test('hClose003', reqlib('unix'), compile_and_run, ['-package unix'])
+test('hFileSize001', normal, compile_and_run, [''])
+test('hFileSize002',
+ [omit_ways(['ghci']),
+ extra_clean(['hFileSize002.out'])],
+ compile_and_run, [''])
+test('hFlush001',
+ extra_clean(['hFlush001.out']),
+ compile_and_run, [''])
+
+test('hGetBuffering001',
+ compose(omit_ways(['ghci']), set_stdin('hGetBuffering001.hs')),
+ compile_and_run, [''])
+
+test('hGetChar001', normal, compile_and_run, [''])
+test('hGetLine001', set_stdin('hGetLine001.hs'), compile_and_run, ['-cpp'])
+test('hGetLine002', normal, compile_and_run, [''])
+test('hGetLine003', normal, compile_and_run, [''])
+test('hGetPosn001',
+ extra_clean(['hGetPosn001.out']),
+ compile_and_run, ['-cpp'])
+test('hIsEOF001', normal, compile_and_run, [''])
+test('hIsEOF002', extra_clean(['hIsEOF002.out']), compile_and_run, ['-cpp'])
+
+test('hReady001', normal, compile_and_run, ['-cpp'])
+
+# hReady002 tests that hReady returns False for a pipe that has no
+# data to read. It relies on piping input from 'sleep 1', which doesn't
+# work for the 'ghci' way because in that case we already pipe input from
+# a script, so hence omit_ways(['ghci'])
+test('hReady002', [ no_stdin, cmd_prefix('sleep 1 |'),
+ omit_ways(['ghci']) ],
+ compile_and_run, [''])
+
+test('hSeek001', normal, compile_and_run, [''])
+test('hSeek002', normal, compile_and_run, ['-cpp'])
+test('hSeek003', normal, compile_and_run, ['-cpp'])
+test('hSeek004', extra_clean(['hSeek004.out']), compile_and_run, ['-cpp'])
+
+test('hSetBuffering002', set_stdin('hSetBuffering002.hs'), compile_and_run, [''])
+
+test('hSetBuffering003', compose(omit_ways(['ghci']),
+ set_stdin('hSetBuffering003.hs')),
+ compile_and_run, [''])
+
+test('hSetBuffering004', set_stdin('hSetBuffering004.hs'), compile_and_run, [''])
+
+test('ioeGetErrorString001', normal, compile_and_run, ['-cpp'])
+test('ioeGetFileName001', normal, compile_and_run, ['-cpp'])
+test('ioeGetHandle001', normal, compile_and_run, ['-cpp'])
+test('isEOF001', normal, compile_and_run, [''])
+
+test('misc001',
+ [extra_run_opts('misc001.hs misc001.out'),
+ extra_clean(['misc001.out'])],
+ compile_and_run, [''])
+
+test('openFile001', normal, compile_and_run, [''])
+test('openFile002', exit_code(1), compile_and_run, [''])
+test('openFile003', normal, compile_and_run, [''])
+test('openFile004', extra_clean(['openFile004.out']), compile_and_run, [''])
+test('openFile005',
+ [if_compiler_type('hugs', expect_fail),
+ extra_clean(['openFile005.out1', 'openFile005.out2'])],
+ compile_and_run, [''])
+test('openFile006', extra_clean(['openFile006.out']), compile_and_run, [''])
+test('openFile007',
+ [if_compiler_type('hugs', expect_fail),
+ extra_clean(['openFile007.out'])],
+ compile_and_run, [''])
+test('openFile008', cmd_prefix('ulimit -n 1024; '), compile_and_run, [''])
+
+test('putStr001', normal, compile_and_run, [''])
+test('readFile001',
+ [if_compiler_type('hugs', expect_fail),
+ extra_clean(['readFile001.out'])],
+ compile_and_run, [''])
+test('readwrite001',
+ extra_clean(['readwrite001.inout']),
+ compile_and_run,
+ ['-cpp'])
+
+
+test('readwrite002',
+ [omit_ways(['ghci']),
+ set_stdin('readwrite002.hs'),
+ extra_clean(['readwrite002.inout'])],
+ compile_and_run, ['-cpp'])
+
+test('readwrite003', extra_clean(['readwrite003.txt']), compile_and_run, [''])
+
+test('hGetBuf001', compose(only_compiler_types(['ghc']),
+ compose(skip_if_fast,
+ expect_fail_if_windows)), compile_and_run, ['-package unix'])
+
+test('hDuplicateTo001', extra_clean(['tmp']), compile_and_run, [''])
+
+test('countReaders001',
+ extra_clean(['countReaders001.txt']),
+ compile_and_run, [''])
+
+test('concio001', skip, run_command, ['$MAKE -s --no-print-directory test.concio001'])
+test('concio001.thr', skip, run_command, ['$MAKE -s --no-print-directory test.concio001.thr'])
+
+test('concio002', reqlib('process'), compile_and_run, [''])
+
+test('2122', extra_clean(['2122-test']), compile_and_run, [''])
+test('3307',
+ [extra_clean(['chinese-file-å°è¯´', 'chinese-name'])],
+ run_command,
+ ['$MAKE -s --no-print-directory 3307-test'])
+test('4855', normal, compile_and_run, [''])
+
+test('hSetEncoding001',extra_run_opts('hSetEncoding001.in'), compile_and_run, [''])
+test('decodingerror001',normal, compile_and_run, [''])
+
+test('encoding001',
+ extra_clean([
+ 'encoding001.utf16', 'encoding001.utf16.utf16be',
+ 'encoding001.utf16.utf16le', 'encoding001.utf16.utf32',
+ 'encoding001.utf16.utf32be', 'encoding001.utf16.utf32le',
+ 'encoding001.utf16.utf8', 'encoding001.utf16be',
+ 'encoding001.utf16be.utf16', 'encoding001.utf16be.utf16le',
+ 'encoding001.utf16be.utf32', 'encoding001.utf16be.utf32be',
+ 'encoding001.utf16be.utf32le', 'encoding001.utf16be.utf8',
+ 'encoding001.utf16le', 'encoding001.utf16le.utf16',
+ 'encoding001.utf16le.utf16be', 'encoding001.utf16le.utf32',
+ 'encoding001.utf16le.utf32be', 'encoding001.utf16le.utf32le',
+ 'encoding001.utf16le.utf8', 'encoding001.utf32',
+ 'encoding001.utf32.utf16', 'encoding001.utf32.utf16be',
+ 'encoding001.utf32.utf16le', 'encoding001.utf32.utf32be',
+ 'encoding001.utf32.utf32le', 'encoding001.utf32.utf8',
+ 'encoding001.utf32be', 'encoding001.utf32be.utf16',
+ 'encoding001.utf32be.utf16be', 'encoding001.utf32be.utf16le',
+ 'encoding001.utf32be.utf32', 'encoding001.utf32be.utf32le',
+ 'encoding001.utf32be.utf8', 'encoding001.utf32le',
+ 'encoding001.utf32le.utf16', 'encoding001.utf32le.utf16be',
+ 'encoding001.utf32le.utf16le', 'encoding001.utf32le.utf32',
+ 'encoding001.utf32le.utf32be', 'encoding001.utf32le.utf8',
+ 'encoding001.utf8', 'encoding001.utf8.utf16',
+ 'encoding001.utf8.utf16be', 'encoding001.utf8.utf16le',
+ 'encoding001.utf8.utf32', 'encoding001.utf8.utf32be',
+ 'encoding001.utf8.utf32le']),
+ compile_and_run, [''])
+
+test('encoding002', normal, compile_and_run, [''])
+
+test('environment001', extra_clean(['environment001']), run_command, ['$MAKE -s --no-print-directory environment001-test'])
+
+test('newline001', extra_clean(['newline001.out']), compile_and_run, [''])
+
+test('openTempFile001', normal, compile_and_run, [''])
+test('T4113', normal, compile_and_run, [''])
+
+test('T4144', normal, compile_and_run, [''])
+
+test('encodingerror001', normal, compile_and_run, [''])
+
+test('4808', exit_code(1), compile_and_run, [''])
+test('4895', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/IO/concio001.hs b/testsuite/tests/lib/IO/concio001.hs
new file mode 100644
index 0000000000..786a311ce5
--- /dev/null
+++ b/testsuite/tests/lib/IO/concio001.hs
@@ -0,0 +1,6 @@
+import Control.Concurrent
+
+main = do
+ forkIO $ do threadDelay 100000; putStrLn "child"
+ getLine
+ putStrLn "parent"
diff --git a/testsuite/tests/lib/IO/concio001.stdout b/testsuite/tests/lib/IO/concio001.stdout
new file mode 100644
index 0000000000..141a8cd80c
--- /dev/null
+++ b/testsuite/tests/lib/IO/concio001.stdout
@@ -0,0 +1,2 @@
+child
+parent
diff --git a/testsuite/tests/lib/IO/concio001.thr.stdout b/testsuite/tests/lib/IO/concio001.thr.stdout
new file mode 100644
index 0000000000..141a8cd80c
--- /dev/null
+++ b/testsuite/tests/lib/IO/concio001.thr.stdout
@@ -0,0 +1,2 @@
+child
+parent
diff --git a/testsuite/tests/lib/IO/concio002.hs b/testsuite/tests/lib/IO/concio002.hs
new file mode 100644
index 0000000000..60a2ed2a89
--- /dev/null
+++ b/testsuite/tests/lib/IO/concio002.hs
@@ -0,0 +1,14 @@
+import System.Process
+import System.IO
+import Control.Concurrent
+
+main = do
+ (hin,hout,herr,ph) <- runInteractiveProcess "cat" [] Nothing Nothing
+ forkIO $ do threadDelay 100000
+ putStrLn "child"
+ hFlush stdout
+ hPutStrLn hin "msg"
+ hFlush hin
+ putStrLn "parent1"
+ hGetLine hout >>= putStrLn
+ putStrLn "parent2"
diff --git a/testsuite/tests/lib/IO/concio002.stdout b/testsuite/tests/lib/IO/concio002.stdout
new file mode 100644
index 0000000000..32640aede5
--- /dev/null
+++ b/testsuite/tests/lib/IO/concio002.stdout
@@ -0,0 +1,4 @@
+parent1
+child
+msg
+parent2
diff --git a/testsuite/tests/lib/IO/countReaders001.hs b/testsuite/tests/lib/IO/countReaders001.hs
new file mode 100644
index 0000000000..2648ae77ae
--- /dev/null
+++ b/testsuite/tests/lib/IO/countReaders001.hs
@@ -0,0 +1,17 @@
+-- test for trac #629. We need to keep track of how many readers
+-- there are rather than closing the first read handle causing the
+-- lock to be released.
+
+import System.IO
+import System.IO.Error
+
+file = "countReaders001.txt"
+
+main = do
+ writeFile file "foo"
+
+ h1 <- openFile file ReadMode
+ h2 <- openFile file ReadMode
+ hClose h1
+ tryIOError (openFile file AppendMode) >>= print
+
diff --git a/testsuite/tests/lib/IO/countReaders001.stdout b/testsuite/tests/lib/IO/countReaders001.stdout
new file mode 100644
index 0000000000..41644bff37
--- /dev/null
+++ b/testsuite/tests/lib/IO/countReaders001.stdout
@@ -0,0 +1 @@
+Left countReaders001.txt: openFile: resource busy (file is locked)
diff --git a/testsuite/tests/lib/IO/countReaders001.stdout-i386-unknown-mingw32 b/testsuite/tests/lib/IO/countReaders001.stdout-i386-unknown-mingw32
new file mode 100644
index 0000000000..bf80d9dc12
--- /dev/null
+++ b/testsuite/tests/lib/IO/countReaders001.stdout-i386-unknown-mingw32
@@ -0,0 +1 @@
+Left countReaders001.txt: openFile: permission denied (Permission denied)
diff --git a/testsuite/tests/lib/IO/decodingerror001.hs b/testsuite/tests/lib/IO/decodingerror001.hs
new file mode 100644
index 0000000000..6c9dca1489
--- /dev/null
+++ b/testsuite/tests/lib/IO/decodingerror001.hs
@@ -0,0 +1,22 @@
+import Control.Monad
+import System.IO
+import System.IO.Error
+import GHC.IO.Encoding (utf8)
+import GHC.IO.Handle (hSetEncoding)
+
+testfiles = ["decodingerror001.in1", "decodingerror001.in2"]
+
+main = mapM_ alltests testfiles
+
+alltests file = mapM (test file) [NoBuffering,
+ LineBuffering,
+ BlockBuffering Nothing,
+ BlockBuffering (Just 9),
+ BlockBuffering (Just 23) ]
+
+test file bufmode = do
+ h <- openFile file ReadMode
+ hSetEncoding h utf8
+ hSetBuffering h bufmode
+ e <- try $ forever $ hGetChar h >>= putChar
+ print (e :: Either IOError ())
diff --git a/testsuite/tests/lib/IO/decodingerror001.in1 b/testsuite/tests/lib/IO/decodingerror001.in1
new file mode 100644
index 0000000000..7686e7b2f4
--- /dev/null
+++ b/testsuite/tests/lib/IO/decodingerror001.in1
@@ -0,0 +1 @@
+UTF8 error:€after error
diff --git a/testsuite/tests/lib/IO/decodingerror001.in2 b/testsuite/tests/lib/IO/decodingerror001.in2
new file mode 100644
index 0000000000..fe33bd3883
--- /dev/null
+++ b/testsuite/tests/lib/IO/decodingerror001.in2
@@ -0,0 +1 @@
+UTF8 incomplete sequence at end:ð \ No newline at end of file
diff --git a/testsuite/tests/lib/IO/decodingerror001.stdout b/testsuite/tests/lib/IO/decodingerror001.stdout
new file mode 100644
index 0000000000..21e5208c79
--- /dev/null
+++ b/testsuite/tests/lib/IO/decodingerror001.stdout
@@ -0,0 +1,10 @@
+UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence)
+UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence)
+UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence)
+UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence)
+UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence)
+UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding)
+UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding)
+UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding)
+UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding)
+UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding)
diff --git a/testsuite/tests/lib/IO/encoding001.hs b/testsuite/tests/lib/IO/encoding001.hs
new file mode 100644
index 0000000000..3135155feb
--- /dev/null
+++ b/testsuite/tests/lib/IO/encoding001.hs
@@ -0,0 +1,71 @@
+import Control.Monad
+import System.IO
+import GHC.IO.Encoding
+import GHC.IO.Handle
+import Data.Bits
+import Data.Word
+import Data.Char
+import System.FilePath
+import System.Exit
+
+file = "encoding001"
+
+encodings = [(utf8, "utf8"),
+ (utf8_bom,"utf8_bom"),
+ (utf16, "utf16"),
+ (utf16le,"utf16le"),
+ (utf16be,"utf16be"),
+ (utf32, "utf32"),
+ (utf32le,"utf32le"),
+ (utf32be,"utf32be")]
+
+main = do
+ -- make a UTF-32BE file
+ h <- openBinaryFile (file <.> "utf32be") WriteMode
+ let expand32 :: Word32 -> [Char]
+ expand32 x = [
+ chr (fromIntegral (x `shiftR` 24) .&. 0xff),
+ chr (fromIntegral (x `shiftR` 16) .&. 0xff),
+ chr (fromIntegral (x `shiftR` 8) .&. 0xff),
+ chr (fromIntegral x .&. 0xff) ]
+ hPutStr h (concatMap expand32 [ 0, 32 .. 0xD7ff ])
+ -- We avoid the private-use characters at 0xEF00..0xEFFF
+ -- that reserved for GHC's PEP383 roundtripping implementation.
+ --
+ -- The reason is that currently normal text containing those
+ -- characters will be mangled, even if we aren't using an encoding
+ -- created using //ROUNDTRIP.
+ hPutStr h (concatMap expand32 [ 0xE000, 0xE000+32 .. 0xEEFF ])
+ hPutStr h (concatMap expand32 [ 0xF000, 0xF000+32 .. 0x10FFFF ])
+ hClose h
+
+ -- convert the UTF-32BE file into each other encoding
+ forM_ encodings $ \(enc,name) -> do
+ when (name /= "utf32be") $ do
+ hin <- openFile (file <.> "utf32be") ReadMode
+ hSetEncoding hin utf32be
+ hout <- openFile (file <.> name) WriteMode
+ hSetEncoding hout enc
+ hGetContents hin >>= hPutStr hout
+ hClose hin
+ hClose hout
+
+ forM_ [ (from,to) | from <- encodings, to <- encodings, snd from /= snd to ]
+ $ \((fromenc,fromname),(toenc,toname)) -> do
+ hin <- openFile (file <.> fromname) ReadMode
+ hSetEncoding hin fromenc
+ hout <- openFile (file <.> toname <.> fromname) WriteMode
+ hSetEncoding hout toenc
+ hGetContents hin >>= hPutStr hout
+ hClose hin
+ hClose hout
+
+ h1 <- openBinaryFile (file <.> toname) ReadMode
+ h2 <- openBinaryFile (file <.> toname <.> fromname) ReadMode
+ str1 <- hGetContents h1
+ str2 <- hGetContents h2
+ when (str1 /= str2) $ do
+ putStrLn (file <.> toname ++ " and " ++ file <.> toname <.> fromname ++ " differ")
+ exitWith (ExitFailure 1)
+ hClose h1
+ hClose h2
diff --git a/testsuite/tests/lib/IO/encoding002.hs b/testsuite/tests/lib/IO/encoding002.hs
new file mode 100644
index 0000000000..65d60a3993
--- /dev/null
+++ b/testsuite/tests/lib/IO/encoding002.hs
@@ -0,0 +1,67 @@
+import Control.Monad
+
+import System.IO
+import Control.Exception
+
+import Foreign.Marshal.Array
+import Foreign.Ptr
+
+import GHC.Foreign
+import GHC.IO.Encoding (TextEncoding, mkTextEncoding)
+
+import Data.Char
+import Data.Word
+
+import Prelude hiding (catch)
+
+
+decode :: TextEncoding -> [Word8] -> IO String
+decode enc xs = withArrayLen xs (\sz p -> peekCStringLen enc (castPtr p, sz)) `catch` \e -> return (show (e :: IOException))
+
+encode :: TextEncoding -> String -> IO [Word8]
+encode enc cs = withCStringLen enc cs (\(p, sz) -> peekArray sz (castPtr p)) `catch` \e -> return (const [] (e :: IOException))
+
+asc :: Char -> Word8
+asc = fromIntegral . ord
+
+families = [ ([asc 'H', asc 'i', 0xED, 0xB2, 0x80, asc '!'],
+ ["UTF-8", "UTF-8//IGNORE", "UTF-8//TRANSLIT", "UTF-8//ROUNDTRIP"])
+ , ([asc 'H', 0, asc 'i', 0, 0xFF, 0xDF, 0xFF, 0xDF, asc '!', 0],
+ ["UTF-16LE", "UTF-16LE//IGNORE", "UTF-16LE//TRANSLIT", "UTF-16LE//ROUNDTRIP"])
+ , ([0, asc 'H', 0, asc 'i', 0xDF, 0xFF, 0xDF, 0xFF, 0, asc '!'],
+ ["UTF-16BE", "UTF-16BE//IGNORE", "UTF-16BE//TRANSLIT", "UTF-16BE//ROUNDTRIP"])
+ , ([asc 'H', 0, 0, 0, asc 'i', 0, 0, 0, 0xED, 0xB2, 0x80, 0, asc '!', 0, 0, 0],
+ ["UTF-32LE", "UTF-32LE//IGNORE", "UTF-32LE//TRANSLIT", "UTF-32LE//ROUNDTRIP"])
+ , ([0, 0, 0, asc 'H', 0, 0, 0, asc 'i', 0, 0x80, 0xB2, 0xED, 0, 0, 0, asc '!'],
+ ["UTF-32BE", "UTF-32BE//IGNORE", "UTF-32BE//TRANSLIT", "UTF-32BE//ROUNDTRIP"])
+ ]
+
+main = do
+ surrogate_enc <- mkTextEncoding "UTF-8//ROUNDTRIP"
+
+ -- Test that invalid input is correctly roundtripped as surrogates
+ -- This only works for the UTF-8 UTF since it is the only UTF which
+ -- is an ASCII superset.
+ putStrLn $ "== UTF-8: roundtripping"
+ let invalid_bytes = [asc 'H', asc 'i', 0xED, 0xB2, 0x80, asc '!']
+ surrogates <- decode surrogate_enc invalid_bytes
+ invalid_bytes' <- encode surrogate_enc surrogates
+ print invalid_bytes
+ print surrogates
+ print invalid_bytes'
+ print (invalid_bytes == invalid_bytes')
+ putStrLn ""
+
+ forM families $ \(invalid_bytes, enc_names) -> do
+ encs <- mapM mkTextEncoding enc_names
+ let name = head enc_names
+
+ -- How we deal with decoding errors in the various modes:
+ putStrLn $ "== " ++ name ++ ": decoding"
+ forM encs $ \enc -> decode enc invalid_bytes >>= print
+
+ -- How about encoding errors, particularly those from embedded surrogates?
+ putStrLn $ "== " ++ name ++ ": encoding"
+ forM encs $ \enc -> encode enc "Hi\xDC80!" >>= print
+
+ putStrLn ""
diff --git a/testsuite/tests/lib/IO/encoding002.stdout b/testsuite/tests/lib/IO/encoding002.stdout
new file mode 100644
index 0000000000..70addd37f5
--- /dev/null
+++ b/testsuite/tests/lib/IO/encoding002.stdout
@@ -0,0 +1,61 @@
+== UTF-8: roundtripping
+[72,105,237,178,128,33]
+"Hi\61421\61362\61312!"
+[72,105,237,178,128,33]
+True
+
+== UTF-8: decoding
+"recoverDecode: invalid argument (invalid byte sequence)"
+"Hi!"
+"Hi\65533\65533\65533!"
+"Hi\61421\61362\61312!"
+== UTF-8: encoding
+[]
+[72,105,33]
+[72,105,63,33]
+[72,105,128,33]
+
+== UTF-16LE: decoding
+"recoverDecode: invalid argument (invalid byte sequence)"
+"Hi\65503\8671"
+"Hi\65533\65503\8671\65533"
+"Hi\61439\65503\8671\NUL"
+== UTF-16LE: encoding
+[]
+[72,0,105,0,33,0]
+[72,0,105,0,63,0,33,0]
+[72,0,105,0,128,33,0]
+
+== UTF-16BE: decoding
+"recoverDecode: invalid argument (invalid byte sequence)"
+"Hi\65503\65280"
+"Hi\65533\65503\65280\65533"
+"Hi\61407\65503\65280!"
+== UTF-16BE: encoding
+[]
+[0,72,0,105,0,33]
+[0,72,0,105,0,63,0,33]
+[0,72,0,105,128,0,33]
+
+== UTF-32LE: decoding
+"recoverDecode: invalid argument (invalid byte sequence)"
+"Hi\8448"
+"Hi\65533\65533\65533\8448\65533"
+"Hi\61421\61362\61312\8448\NUL"
+== UTF-32LE: encoding
+[]
+[72,0,0,0,105,0,0,0,33,0,0,0]
+[72,0,0,0,105,0,0,0,63,0,0,0,33,0,0,0]
+[72,0,0,0,105,0,0,0,128,33,0,0,0]
+
+== UTF-32BE: decoding
+"recoverDecode: invalid argument (invalid byte sequence)"
+"Hi!"
+"Hi\65533\65533\65533\65533!"
+"Hi\NUL\61312\61362\61421!"
+== UTF-32BE: encoding
+[]
+[0,0,0,72,0,0,0,105,0,0,0,33]
+[0,0,0,72,0,0,0,105,0,0,0,63,0,0,0,33]
+[0,0,0,72,0,0,0,105,128,0,0,0,33]
+
diff --git a/testsuite/tests/lib/IO/encodingerror001.hs b/testsuite/tests/lib/IO/encodingerror001.hs
new file mode 100644
index 0000000000..327b490adb
--- /dev/null
+++ b/testsuite/tests/lib/IO/encodingerror001.hs
@@ -0,0 +1,27 @@
+import System.IO
+import System.IO.Error
+import Text.Printf
+import Control.Monad
+
+main = do
+ hSetEncoding stdout latin1
+ forM [NoBuffering,
+ LineBuffering,
+ BlockBuffering Nothing,
+ BlockBuffering (Just 3),
+ BlockBuffering (Just 9),
+ BlockBuffering (Just 32)] $ \b -> do
+ hSetBuffering stdout b
+ checkedPutStr "test 1\n"
+ checkedPutStr "Ä›\n" -- nothing gets written
+ checkedPutStr "test 2\n"
+ checkedPutStr "Hέllo\n" -- we should write at least the 'H'
+ checkedPutStr "test 3\n"
+ checkedPutStr "Hello αβγ\n" -- we should write at least the "Hello "
+
+checkedPutStr str = do
+ r <- try $ putStr str
+ case r of
+ Right _ -> return ()
+ Left e -> printf "Caught %s while trying to write %s\n"
+ (show e) (show str)
diff --git a/testsuite/tests/lib/IO/encodingerror001.stdout b/testsuite/tests/lib/IO/encodingerror001.stdout
new file mode 100644
index 0000000000..7406cd9168
--- /dev/null
+++ b/testsuite/tests/lib/IO/encodingerror001.stdout
@@ -0,0 +1,36 @@
+test 1
+Caught <stdout>: hPutChar: invalid argument (invalid character) while trying to write "\283\n"
+test 2
+HCaught <stdout>: hPutChar: invalid argument (invalid character) while trying to write "H\941llo\n"
+test 3
+Hello Caught <stdout>: hPutChar: invalid argument (invalid character) while trying to write "Hello \945\946\947\n"
+test 1
+Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "\283\n"
+test 2
+HCaught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "H\941llo\n"
+test 3
+Hello Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "Hello \945\946\947\n"
+test 1
+Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "\283\n"
+test 2
+HCaught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "H\941llo\n"
+test 3
+Hello Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "Hello \945\946\947\n"
+test 1
+Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "\283\n"
+test 2
+HCaught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "H\941llo\n"
+test 3
+Hello Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "Hello \945\946\947\n"
+test 1
+Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "\283\n"
+test 2
+HCaught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "H\941llo\n"
+test 3
+Hello Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "Hello \945\946\947\n"
+test 1
+Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "\283\n"
+test 2
+HCaught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "H\941llo\n"
+test 3
+Hello Caught <stdout>: commitBuffer: invalid argument (invalid character) while trying to write "Hello \945\946\947\n"
diff --git a/testsuite/tests/lib/IO/environment001.hs b/testsuite/tests/lib/IO/environment001.hs
new file mode 100644
index 0000000000..11d7912cdd
--- /dev/null
+++ b/testsuite/tests/lib/IO/environment001.hs
@@ -0,0 +1,16 @@
+import System.Environment
+
+main = do
+ var0 <- getEnv "GHC_TEST"
+ putStrLn var0
+ -- The length proves that we actually decoded it properly, not just read it
+ -- in as latin1 or something (#3308, #3307)
+ putStrLn ("Test 1: " ++ show (length var0))
+
+ [arg0] <- getArgs
+ putStrLn arg0
+ putStrLn ("Test 2: " ++ show (length arg0))
+
+ [arg1] <- withArgs ["你好!"] getArgs
+ putStrLn arg1
+ putStrLn ("Test 3: " ++ show (length arg1))
diff --git a/testsuite/tests/lib/IO/environment001.stdout b/testsuite/tests/lib/IO/environment001.stdout
new file mode 100644
index 0000000000..2434d0c14d
--- /dev/null
+++ b/testsuite/tests/lib/IO/environment001.stdout
@@ -0,0 +1,6 @@
+马克斯
+Test 1: 3
+说
+Test 2: 1
+你好!
+Test 3: 3
diff --git a/testsuite/tests/lib/IO/finalization001.hs b/testsuite/tests/lib/IO/finalization001.hs
new file mode 100644
index 0000000000..2bf6353453
--- /dev/null
+++ b/testsuite/tests/lib/IO/finalization001.hs
@@ -0,0 +1,26 @@
+--- !!! test for bug in handle finalization fixed in
+--- !!! 1.60 +1 -2 fptools/ghc/lib/std/PrelHandle.lhs
+--- !!! 1.15 +4 -10 fptools/ghc/lib/std/PrelIO.lhs
+
+module Main (main) where
+
+import System.IO
+
+doTest :: IO ()
+doTest = do
+ sd <- openFile "finalization001.hs" ReadWriteMode
+ result <- hGetContents sd
+ slurp result
+ hClose sd
+ if "" `elem` lines (filter (/= '\r') result)
+ then
+ putStrLn "ok"
+ else
+ putStrLn "fail"
+
+slurp :: String -> IO ()
+slurp [] = return ()
+slurp (x:xs) = x `seq` slurp xs
+
+main :: IO ()
+main = sequence_ (take 200 (repeat doTest))
diff --git a/testsuite/tests/lib/IO/finalization001.stdout b/testsuite/tests/lib/IO/finalization001.stdout
new file mode 100644
index 0000000000..ec04732f97
--- /dev/null
+++ b/testsuite/tests/lib/IO/finalization001.stdout
@@ -0,0 +1,200 @@
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
diff --git a/testsuite/tests/lib/IO/hClose001.hs b/testsuite/tests/lib/IO/hClose001.hs
new file mode 100644
index 0000000000..8d31447e95
--- /dev/null
+++ b/testsuite/tests/lib/IO/hClose001.hs
@@ -0,0 +1,8 @@
+import System.IO
+import System.IO.Error
+
+main = do
+ h <- openFile "hClose001.tmp" WriteMode
+ hPutStr h "junk"
+ hClose h
+ hPutStr h "junk" `catchIOError` \ err -> if isIllegalOperation err then putStr "Okay\n" else error "Not okay\n"
diff --git a/testsuite/tests/lib/IO/hClose001.stdout b/testsuite/tests/lib/IO/hClose001.stdout
new file mode 100644
index 0000000000..1ddd42bbe7
--- /dev/null
+++ b/testsuite/tests/lib/IO/hClose001.stdout
@@ -0,0 +1 @@
+Okay
diff --git a/testsuite/tests/lib/IO/hClose002.hs b/testsuite/tests/lib/IO/hClose002.hs
new file mode 100644
index 0000000000..ebf26b4663
--- /dev/null
+++ b/testsuite/tests/lib/IO/hClose002.hs
@@ -0,0 +1,32 @@
+import System.IO
+import Control.Exception
+
+import qualified GHC.IO.Device as IODevice
+import GHC.IO.Handle
+import GHC.IO.Handle.Internals
+import GHC.IO.Handle.Types
+import System.Posix.Internals
+
+main = do
+ h <- openFile "hClose002.tmp" WriteMode
+ -- close the FD without telling the IO library:
+ naughtyClose h
+ -- first hClose will raise an exception, but close the
+ -- Handle anyway:
+ showPossibleException (hClose h)
+ -- second hClose should success (Handle is already closed)
+ showPossibleException (hClose h)
+ -- this should succeed (checking that the lock on the file has
+ -- been released:
+ h <- openFile "hClose002.tmp" ReadMode
+ showPossibleException (hClose h)
+ showPossibleException (hClose h)
+
+showPossibleException :: IO () -> IO ()
+showPossibleException f = do e <- try f
+ print (e :: Either SomeException ())
+
+naughtyClose h =
+ withHandle_ "naughtyClose" h $ \ Handle__{haDevice=dev} -> do
+ IODevice.close dev
+
diff --git a/testsuite/tests/lib/IO/hClose002.stdout b/testsuite/tests/lib/IO/hClose002.stdout
new file mode 100644
index 0000000000..f26be4ab07
--- /dev/null
+++ b/testsuite/tests/lib/IO/hClose002.stdout
@@ -0,0 +1,4 @@
+Left hClose002.tmp: hClose: invalid argument (Bad file descriptor)
+Right ()
+Right ()
+Right ()
diff --git a/testsuite/tests/lib/IO/hClose002.stdout-i386-unknown-solaris2 b/testsuite/tests/lib/IO/hClose002.stdout-i386-unknown-solaris2
new file mode 100644
index 0000000000..39a24de031
--- /dev/null
+++ b/testsuite/tests/lib/IO/hClose002.stdout-i386-unknown-solaris2
@@ -0,0 +1,4 @@
+Left hClose002.tmp: hClose: invalid argument (Bad file number)
+Right ()
+Right ()
+Right ()
diff --git a/testsuite/tests/lib/IO/hClose003.hs b/testsuite/tests/lib/IO/hClose003.hs
new file mode 100644
index 0000000000..cbaf49d6db
--- /dev/null
+++ b/testsuite/tests/lib/IO/hClose003.hs
@@ -0,0 +1,42 @@
+-- Test for #3128, file descriptor leak when hClose fails
+
+import System.IO
+import Control.Exception
+import Data.Char
+
+import System.Posix
+import qualified GHC.IO.Device as IODevice
+import GHC.IO.Handle
+import GHC.IO.Handle.Internals
+import GHC.IO.Handle.Types
+import System.Posix.Internals
+
+main = do
+ (read,write) <- createPipe
+ hread <- fdToHandle read
+ hwrite <- fdToHandle write
+
+ -- close the FD without telling the IO library:
+ showPossibleException (hClose hread)
+ hIsOpen hread >>= print
+
+ -- put some data in the Handle's write buffer:
+ hPutStr hwrite "testing"
+ -- now try to close the Handle:
+ showPossibleException (hClose hwrite)
+ hIsOpen hwrite >>= print
+
+showPossibleException :: IO () -> IO ()
+showPossibleException f = do
+ e <- try f
+ putStrLn (sanitise (show (e :: Either SomeException ())))
+ where
+ -- we don't care which file descriptor it is
+ sanitise [] = []
+ sanitise (x:xs) = if isDigit x then ('X':(sanitise' xs)) else (x:(sanitise xs))
+ sanitise' [] = []
+ sanitise' (x:xs) = if isDigit x then (sanitise' xs) else (x:(sanitise xs))
+
+naughtyClose h =
+ withHandle_ "naughtyClose" h $ \ Handle__{haDevice=dev} -> do
+ IODevice.close dev
diff --git a/testsuite/tests/lib/IO/hClose003.stdout b/testsuite/tests/lib/IO/hClose003.stdout
new file mode 100644
index 0000000000..d12f84d7d7
--- /dev/null
+++ b/testsuite/tests/lib/IO/hClose003.stdout
@@ -0,0 +1,4 @@
+Right ()
+False
+Left <file descriptor: X>: hClose: resource vanished (Broken pipe)
+False
diff --git a/testsuite/tests/lib/IO/hDuplicateTo001.hs b/testsuite/tests/lib/IO/hDuplicateTo001.hs
new file mode 100644
index 0000000000..5a1484a012
--- /dev/null
+++ b/testsuite/tests/lib/IO/hDuplicateTo001.hs
@@ -0,0 +1,24 @@
+import GHC.Handle
+import GHC.IOBase
+import System.IO
+import Control.Concurrent.MVar
+import Data.Typeable
+import qualified GHC.IO.FD as FD
+
+main = do
+ h <- openFile "tmp" WriteMode
+ hDuplicateTo h stdout
+
+ fdh <- getfd h
+ fdstdout <- getfd stdout
+ hPutStrLn stderr ("h: " ++ show (fdh /= fdstdout) ++ "\nstdout: " ++ show fdstdout)
+
+ hClose h
+ putStrLn "bla"
+
+
+getfd h@(FileHandle _ mvar) = do
+ withMVar mvar $ \h__@Handle__{haDevice=dev} ->
+ case cast dev of
+ Just fd -> return (FD.fdFD fd)
+ Nothing -> error "getfd"
diff --git a/testsuite/tests/lib/IO/hDuplicateTo001.stderr b/testsuite/tests/lib/IO/hDuplicateTo001.stderr
new file mode 100644
index 0000000000..14a31438a6
--- /dev/null
+++ b/testsuite/tests/lib/IO/hDuplicateTo001.stderr
@@ -0,0 +1,2 @@
+h: True
+stdout: 1
diff --git a/testsuite/tests/lib/IO/hFileSize001.hs b/testsuite/tests/lib/IO/hFileSize001.hs
new file mode 100644
index 0000000000..62b3e88b9c
--- /dev/null
+++ b/testsuite/tests/lib/IO/hFileSize001.hs
@@ -0,0 +1,8 @@
+import System.IO
+
+-- !!! test hFileSize
+
+main = do
+ h <- openFile "hFileSize001.hs" ReadMode
+ sz <- hFileSize h
+ print sz
diff --git a/testsuite/tests/lib/IO/hFileSize001.stdout b/testsuite/tests/lib/IO/hFileSize001.stdout
new file mode 100644
index 0000000000..94361d49fd
--- /dev/null
+++ b/testsuite/tests/lib/IO/hFileSize001.stdout
@@ -0,0 +1 @@
+132
diff --git a/testsuite/tests/lib/IO/hFileSize001.stdout-mingw b/testsuite/tests/lib/IO/hFileSize001.stdout-mingw
new file mode 100644
index 0000000000..6a4573e805
--- /dev/null
+++ b/testsuite/tests/lib/IO/hFileSize001.stdout-mingw
@@ -0,0 +1 @@
+133
diff --git a/testsuite/tests/lib/IO/hFileSize002.hs b/testsuite/tests/lib/IO/hFileSize002.hs
new file mode 100644
index 0000000000..6c1ad2f57a
--- /dev/null
+++ b/testsuite/tests/lib/IO/hFileSize002.hs
@@ -0,0 +1,35 @@
+-- !!! Testing IO.hFileSize
+module Main(main) where
+
+import Control.Monad
+import System.Directory ( removeFile, doesFileExist )
+import System.IO
+
+main = do
+ sz <- hFileSize stdin `catch` (\ _ -> return (-1))
+ print sz
+ let fn = "hFileSize002.out"
+ f <- doesFileExist fn
+ when f (removeFile fn)
+ hdl <- openFile fn WriteMode
+ hPutStr hdl "file_size"
+ -- with default buffering
+ sz <- hFileSize hdl
+ print sz
+
+ hSetBuffering hdl NoBuffering
+ hPutStr hdl "file_size"
+ -- with no buffering
+ sz <- hFileSize hdl
+ print sz
+ hSetBuffering hdl LineBuffering
+ hPutStr hdl "file_size"
+ -- with line buffering
+ sz <- hFileSize hdl
+ print sz
+ hSetBuffering hdl (BlockBuffering (Just 4))
+ -- with block buffering
+ hPutStr hdl "file_size"
+ sz <- hFileSize hdl
+ print sz
+ hClose hdl
diff --git a/testsuite/tests/lib/IO/hFileSize002.stdout b/testsuite/tests/lib/IO/hFileSize002.stdout
new file mode 100644
index 0000000000..23dd734048
--- /dev/null
+++ b/testsuite/tests/lib/IO/hFileSize002.stdout
@@ -0,0 +1,5 @@
+-1
+9
+18
+27
+36
diff --git a/testsuite/tests/lib/IO/hFlush001.hs b/testsuite/tests/lib/IO/hFlush001.hs
new file mode 100644
index 0000000000..78c7b7eeb3
--- /dev/null
+++ b/testsuite/tests/lib/IO/hFlush001.hs
@@ -0,0 +1,31 @@
+-- !!! Flushing
+module Main(main) where
+
+import Control.Monad
+import System.Directory ( removeFile, doesFileExist )
+import System.IO
+
+main = do
+ hFlush stdin `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
+ putStr "Hello,"
+ hFlush stdout
+ putStr "Hello - "
+ hFlush stderr
+ hdl <- openFile "hFlush001.hs" ReadMode
+ hFlush hdl `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
+ hClose hdl
+ remove
+ hdl <- openFile "hFlush001.out" WriteMode
+ hFlush hdl
+ hClose hdl
+ remove
+ hdl <- openFile "hFlush001.out" AppendMode
+ hFlush hdl
+ hClose hdl
+ remove
+ hdl <- openFile "hFlush001.out" ReadWriteMode
+ hFlush hdl
+ hClose hdl
+ where remove = do
+ f <- doesFileExist "hFlush001.out"
+ when f (removeFile "hFlush001.out")
diff --git a/testsuite/tests/lib/IO/hFlush001.stdout b/testsuite/tests/lib/IO/hFlush001.stdout
new file mode 100644
index 0000000000..0954a7a0b4
--- /dev/null
+++ b/testsuite/tests/lib/IO/hFlush001.stdout
@@ -0,0 +1,2 @@
+No can do - flushing read-only handles isn't legal
+Hello,Hello - No can do - flushing read-only handles isn't legal
diff --git a/testsuite/tests/lib/IO/hGetBuf001.hs b/testsuite/tests/lib/IO/hGetBuf001.hs
new file mode 100644
index 0000000000..eea599ea74
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetBuf001.hs
@@ -0,0 +1,218 @@
+-- !!! Testing hGetBuf(NonBlocking), hPutBuf(NonBlocking)
+
+import System.Posix
+import System.IO
+import Control.Concurrent
+import Foreign
+import Foreign.C
+import System.Exit
+import Control.Exception
+import Control.Monad
+
+
+main = do
+ -- test should run quickly, but arrange to kill it if it hangs for any reason:
+ main_t <- myThreadId
+ forkIO $ do
+ threadDelay 10000000
+ throwTo main_t (ErrorCall "killed")
+
+ zipWithM_ ($)
+ [ f rbuf wbuf
+ | f <- [hGetBufTest, hGetBufNBTest, hGetBufSomeTest],
+ rbuf <- [buf1,buf2,buf3],
+ wbuf <- [buf1,buf2,buf3]
+ ]
+ [1..]
+
+msg = "hello!"
+msg_length = length msg
+
+buf1 = NoBuffering
+buf2 = BlockBuffering (Just 5)
+buf3 = BlockBuffering (Just 10)
+
+-- chosen to be larger than buf2 & smaller than buf3, so that we exercise
+-- all code paths:
+read_size = 8 :: Int
+
+-- ----------------------------------------------------------------------------
+
+-- hGetBuf/hPutBuf:
+-- - test that it always reads all the data that is available
+-- (with buffer size <, =, > message size).
+-- - test that at the EOF, it returns a short read.
+-- - the writing end is using hPutBuf, with various buffer sizes, and
+-- doing an hFlush at the end of each write.
+
+hGetBufTest rbuf wbuf n = do
+ (read,write) <- createPipe
+ hread <- fdToHandle read
+ hwrite <- fdToHandle write
+ m1 <- newEmptyMVar
+ m2 <- newEmptyMVar
+ finished <- newEmptyMVar
+ hSetBuffering hread rbuf
+ hSetBuffering hwrite wbuf
+ forkIO (readProc m1 m2 finished hread)
+ writeProc m1 m2 hwrite
+ takeMVar finished
+ putStrLn ("test " ++ show n ++ " OK")
+
+
+readProc :: MVar () -> MVar () -> MVar () -> Handle -> IO ()
+readProc m1 m2 finished h = do
+ buf <- mallocBytes 20
+ let
+ loop 0 = return ()
+ loop n = do putMVar m2 (); takeMVar m1
+ r <- hGetBuf h buf msg_length
+ if (r /= msg_length)
+ then do hPutStr stderr ("error: " ++ show r)
+ exitFailure
+ else do s <- peekCStringLen (buf,r)
+ hPutStr stdout (show n ++ " ")
+ loop (n-1)
+ loop 100
+ hPutStr stdout "\n"
+ putMVar m2 (); takeMVar m1
+ r <- hGetBuf h buf read_size -- EOF, should get short read
+ s <- peekCStringLen (buf,r)
+ putStrLn ("got " ++ show r ++ ": " ++ s)
+ r <- hGetBuf h buf read_size -- EOF, should get zero-length read
+ s <- peekCStringLen (buf,r)
+ putStrLn ("got " ++ show r ++ ": " ++ s)
+ hClose h
+ putMVar finished ()
+
+writeProc :: MVar () -> MVar () -> Handle -> IO ()
+writeProc m1 m2 h = do
+ let
+ loop 0 = return ()
+ loop n =
+ withCStringLen msg $ \ (s,len) -> do
+ takeMVar m2
+ hPutBuf h s len
+ hFlush h
+ putMVar m1 ()
+ loop (n-1)
+
+ loop 100
+ takeMVar m2
+ withCString "end" $ \s -> do
+ hPutBuf h s 3
+ putMVar m1 ()
+ hClose h
+
+-- -----------------------------------------------------------------------------
+-- hGetBufNonBlocking:
+
+hGetBufNBTest rbuf wbuf n = do
+ (read,write) <- createPipe
+ hread <- fdToHandle read
+ hwrite <- fdToHandle write
+ m1 <- newEmptyMVar
+ m2 <- newEmptyMVar
+ finished <- newEmptyMVar
+ hSetBuffering hread rbuf
+ hSetBuffering hwrite wbuf
+ forkIO (readProcNB m1 m2 finished hread)
+ writeProcNB m1 m2 hwrite
+ takeMVar finished
+ putStrLn ("test " ++ show n ++ " OK")
+
+
+readProcNB :: MVar () -> MVar () -> MVar () -> Handle -> IO ()
+readProcNB m1 m2 finished h = do
+ buf <- mallocBytes 20
+
+ -- first, test that we can do a non-blocking read:
+ r <- hGetBufNonBlocking h buf read_size
+ s <- peekCStringLen (buf,r)
+ putStrLn ("got " ++ show r ++ ": " ++ s)
+
+ let
+ loop 0 = return ()
+ loop n = do putMVar m2 (); takeMVar m1
+ r <- hGetBufNonBlocking h buf read_size
+ if (r /= msg_length)
+ then do hPutStr stderr ("error: " ++ show r)
+ exitFailure
+ else do s <- peekCStringLen (buf,r)
+ hPutStr stdout (show n ++ " ")
+ loop (n-1)
+ loop 100
+ hPutStr stdout "\n"
+ putMVar m2 (); takeMVar m1
+ r <- hGetBufNonBlocking h buf read_size -- EOF, should get short read
+ s <- peekCStringLen (buf,r)
+ putStrLn ("got " ++ show r ++ ": " ++ s)
+ r <- hGetBufNonBlocking h buf read_size -- EOF, should get zero-length read
+ s <- peekCStringLen (buf,r)
+ putStrLn ("got " ++ show r ++ ": " ++ s)
+ hClose h
+ putMVar finished ()
+
+writeProcNB :: MVar () -> MVar () -> Handle -> IO ()
+writeProcNB m1 m2 h = do
+ let
+ loop 0 = return ()
+ loop n =
+ withCStringLen msg $ \ (s,len) -> do
+ takeMVar m2
+ hPutBufNonBlocking h s len
+ hFlush h
+ putMVar m1 ()
+ loop (n-1)
+
+ loop 100
+ takeMVar m2
+ withCString "end" $ \s -> do
+ hPutBuf h s 3
+ hFlush h
+ putMVar m1 ()
+ hClose h
+
+-- -----------------------------------------------------------------------------
+-- hGetBufSome:
+
+hGetBufSomeTest rbuf wbuf n = do
+ (read,write) <- createPipe
+ hread <- fdToHandle read
+ hwrite <- fdToHandle write
+ m1 <- newEmptyMVar
+ m2 <- newEmptyMVar
+ finished <- newEmptyMVar
+ hSetBuffering hread rbuf
+ hSetBuffering hwrite wbuf
+ forkIO (readProcSome m1 m2 finished hread)
+ writeProcNB m1 m2 hwrite
+ takeMVar finished
+ putStrLn ("test " ++ show n ++ " OK")
+
+
+readProcSome :: MVar () -> MVar () -> MVar () -> Handle -> IO ()
+readProcSome m1 m2 finished h = do
+ buf <- mallocBytes 20
+
+ let
+ loop 0 = return ()
+ loop n = do putMVar m2 (); takeMVar m1
+ r <- hGetBufSome h buf read_size
+ if (r /= msg_length)
+ then do hPutStr stderr ("error: " ++ show r)
+ exitFailure
+ else do s <- peekCStringLen (buf,r)
+ hPutStr stdout (show n ++ " ")
+ loop (n-1)
+ loop 100
+ hPutStr stdout "\n"
+ putMVar m2 (); takeMVar m1
+ r <- hGetBufSome h buf read_size -- EOF, should get short read
+ s <- peekCStringLen (buf,r)
+ putStrLn ("got " ++ show r ++ ": " ++ s)
+ r <- hGetBufSome h buf read_size -- EOF, should get zero-length read
+ s <- peekCStringLen (buf,r)
+ putStrLn ("got " ++ show r ++ ": " ++ s)
+ hClose h
+ putMVar finished ()
diff --git a/testsuite/tests/lib/IO/hGetBuf001.stdout b/testsuite/tests/lib/IO/hGetBuf001.stdout
new file mode 100644
index 0000000000..694ff4eedf
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetBuf001.stdout
@@ -0,0 +1,117 @@
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 1 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 2 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 3 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 4 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 5 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 6 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 7 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 8 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 9 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 10 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 11 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 12 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 13 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 14 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 15 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 16 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 17 OK
+got 0:
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 18 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 19 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 20 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 21 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 22 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 23 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 24 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 25 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 26 OK
+100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
+got 3: end
+got 0:
+test 27 OK
diff --git a/testsuite/tests/lib/IO/hGetBuffering001.hs b/testsuite/tests/lib/IO/hGetBuffering001.hs
new file mode 100644
index 0000000000..83188b2796
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetBuffering001.hs
@@ -0,0 +1,21 @@
+import System.IO
+
+main =
+ sequence (map hIsOpen [stdin, stdout, stderr]) >>= \ opens ->
+ print opens >>
+ sequence (map hIsClosed [stdin, stdout, stderr]) >>= \ closeds ->
+ print closeds >>
+ sequence (map hIsReadable [stdin, stdout, stderr]) >>= \ readables ->
+ print readables >>
+ sequence (map hIsWritable [stdin, stdout, stderr]) >>= \ writables ->
+ print writables >>
+ sequence (map hIsBlockBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
+ print buffereds >>
+ sequence (map hIsLineBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
+ print buffereds >>
+ sequence (map hIsNotBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
+ print buffereds
+ where
+ hIsBlockBuffered h = hGetBuffering h >>= \ b -> return $ case b of { BlockBuffering _ -> True; _ -> False }
+ hIsLineBuffered h = hGetBuffering h >>= \ b -> return $ case b of { LineBuffering -> True; _ -> False }
+ hIsNotBuffered h = hGetBuffering h >>= \ b -> return $ case b of { NoBuffering -> True; _ -> False }
diff --git a/testsuite/tests/lib/IO/hGetBuffering001.stdout b/testsuite/tests/lib/IO/hGetBuffering001.stdout
new file mode 100644
index 0000000000..75b9a133d9
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetBuffering001.stdout
@@ -0,0 +1,7 @@
+[True,True,True]
+[False,False,False]
+[True,False,False]
+[False,True,True]
+[True,True,False]
+[False,False,False]
+[False,False,True]
diff --git a/testsuite/tests/lib/IO/hGetChar001.hs b/testsuite/tests/lib/IO/hGetChar001.hs
new file mode 100644
index 0000000000..f5ca666828
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetChar001.hs
@@ -0,0 +1,18 @@
+import System.IO
+
+main = do
+ hSetBuffering stdout NoBuffering
+ putStr "Enter an integer: "
+ x1 <- readLine
+ putStr "Enter another integer: "
+ x2 <- readLine
+ putStr ("Their sum is " ++ show (read x1 + read x2 :: Int) ++ "\n")
+
+ where readLine = do
+ eof <- isEOF
+ if eof then return [] else do
+ c <- getChar
+ if c `elem` ['\n','\r']
+ then return []
+ else do cs <- readLine
+ return (c:cs)
diff --git a/testsuite/tests/lib/IO/hGetChar001.stdin b/testsuite/tests/lib/IO/hGetChar001.stdin
new file mode 100644
index 0000000000..2510fcaec3
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetChar001.stdin
@@ -0,0 +1,2 @@
+42
+-7
diff --git a/testsuite/tests/lib/IO/hGetChar001.stdout b/testsuite/tests/lib/IO/hGetChar001.stdout
new file mode 100644
index 0000000000..47d4185c64
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetChar001.stdout
@@ -0,0 +1 @@
+Enter an integer: Enter another integer: Their sum is 35
diff --git a/testsuite/tests/lib/IO/hGetLine001.hs b/testsuite/tests/lib/IO/hGetLine001.hs
new file mode 100644
index 0000000000..b5950623ea
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine001.hs
@@ -0,0 +1,25 @@
+-- !!! testing hGetLine
+
+import System.IO
+
+-- one version of 'cat'
+main = do
+ let loop h = do b <- hIsEOF h
+ if b then return ()
+ else do l <- hGetLine h; putStrLn l; loop h
+ loop stdin
+
+ h <- openFile "hGetLine001.hs" ReadMode
+
+ hSetBinaryMode stdout True
+
+ hSetBuffering h NoBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h LineBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h (BlockBuffering (Just 83))
+ loop h
diff --git a/testsuite/tests/lib/IO/hGetLine001.stdout b/testsuite/tests/lib/IO/hGetLine001.stdout
new file mode 100644
index 0000000000..3e023db8f5
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine001.stdout
@@ -0,0 +1,100 @@
+-- !!! testing hGetLine
+
+import System.IO
+
+-- one version of 'cat'
+main = do
+ let loop h = do b <- hIsEOF h
+ if b then return ()
+ else do l <- hGetLine h; putStrLn l; loop h
+ loop stdin
+
+ h <- openFile "hGetLine001.hs" ReadMode
+
+ hSetBinaryMode stdout True
+
+ hSetBuffering h NoBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h LineBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h (BlockBuffering (Just 83))
+ loop h
+-- !!! testing hGetLine
+
+import System.IO
+
+-- one version of 'cat'
+main = do
+ let loop h = do b <- hIsEOF h
+ if b then return ()
+ else do l <- hGetLine h; putStrLn l; loop h
+ loop stdin
+
+ h <- openFile "hGetLine001.hs" ReadMode
+
+ hSetBinaryMode stdout True
+
+ hSetBuffering h NoBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h LineBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h (BlockBuffering (Just 83))
+ loop h
+-- !!! testing hGetLine
+
+import System.IO
+
+-- one version of 'cat'
+main = do
+ let loop h = do b <- hIsEOF h
+ if b then return ()
+ else do l <- hGetLine h; putStrLn l; loop h
+ loop stdin
+
+ h <- openFile "hGetLine001.hs" ReadMode
+
+ hSetBinaryMode stdout True
+
+ hSetBuffering h NoBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h LineBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h (BlockBuffering (Just 83))
+ loop h
+-- !!! testing hGetLine
+
+import System.IO
+
+-- one version of 'cat'
+main = do
+ let loop h = do b <- hIsEOF h
+ if b then return ()
+ else do l <- hGetLine h; putStrLn l; loop h
+ loop stdin
+
+ h <- openFile "hGetLine001.hs" ReadMode
+
+ hSetBinaryMode stdout True
+
+ hSetBuffering h NoBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h LineBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h (BlockBuffering (Just 83))
+ loop h
diff --git a/testsuite/tests/lib/IO/hGetLine002.hs b/testsuite/tests/lib/IO/hGetLine002.hs
new file mode 100644
index 0000000000..5c08b716d1
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine002.hs
@@ -0,0 +1,16 @@
+-- !!! testing hGetLine on a file without a final '\n'.
+
+-- According to the Haskell 98 report, getLine should discard a line without a
+-- closing newline character (see implementation of getLine).
+--
+-- However, we don't believe that this is the right behaviour.
+
+import System.IO
+
+main = catch loop (\e -> print e)
+
+loop = do
+ hSetBuffering stdin LineBuffering
+ l <- hGetLine stdin
+ putStrLn l
+ loop
diff --git a/testsuite/tests/lib/IO/hGetLine002.stdin b/testsuite/tests/lib/IO/hGetLine002.stdin
new file mode 100644
index 0000000000..808eafd54b
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine002.stdin
@@ -0,0 +1 @@
+this line doesn't end with a newline \ No newline at end of file
diff --git a/testsuite/tests/lib/IO/hGetLine002.stdout b/testsuite/tests/lib/IO/hGetLine002.stdout
new file mode 100644
index 0000000000..0ec29ade8f
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine002.stdout
@@ -0,0 +1,2 @@
+this line doesn't end with a newline
+<stdin>: hGetLine: end of file
diff --git a/testsuite/tests/lib/IO/hGetLine002.stdout-hugs b/testsuite/tests/lib/IO/hGetLine002.stdout-hugs
new file mode 100644
index 0000000000..ed871357b7
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine002.stdout-hugs
@@ -0,0 +1,2 @@
+this line doesn't end with a newline
+<stdin>: IO.hGetChar: end of file (end of file)
diff --git a/testsuite/tests/lib/IO/hGetLine003.hs b/testsuite/tests/lib/IO/hGetLine003.hs
new file mode 100644
index 0000000000..cc03c604aa
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine003.hs
@@ -0,0 +1,9 @@
+import System.IO
+
+main = f stdin
+ where f h = do p <- hIsEOF h
+ if p then putStrLn "done"
+ else do l <- hGetLine h
+ putStrLn l
+ f h
+
diff --git a/testsuite/tests/lib/IO/hGetLine003.stdin b/testsuite/tests/lib/IO/hGetLine003.stdin
new file mode 100644
index 0000000000..b8b74a4b1e
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine003.stdin
@@ -0,0 +1 @@
+this line doesn't end with a newline
diff --git a/testsuite/tests/lib/IO/hGetLine003.stdout b/testsuite/tests/lib/IO/hGetLine003.stdout
new file mode 100644
index 0000000000..6daac48252
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine003.stdout
@@ -0,0 +1,2 @@
+this line doesn't end with a newline
+done
diff --git a/testsuite/tests/lib/IO/hGetPosn001.hs b/testsuite/tests/lib/IO/hGetPosn001.hs
new file mode 100644
index 0000000000..5a0d7d4827
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetPosn001.hs
@@ -0,0 +1,28 @@
+-- !!! Test file positioning
+
+module Main(main) where
+
+import Control.Monad
+import System.Directory (removeFile, doesFileExist)
+import System.IO
+import System.IO.Error
+
+main = do
+ hIn <- openFile "hGetPosn001.in" ReadMode
+ f <- doesFileExist "hGetPosn001.out"
+ when f (removeFile "hGetPosn001.out")
+ hOut <- openFile "hGetPosn001.out" ReadWriteMode
+ bof <- hGetPosn hIn
+ putStrLn (show bof) -- you can show HandlePosns
+ copy hIn hOut
+ hSetPosn bof
+ copy hIn hOut
+ hSeek hOut AbsoluteSeek 0
+ stuff <- hGetContents hOut
+ putStr stuff
+
+copy :: Handle -> Handle -> IO ()
+copy hIn hOut =
+ try (hGetChar hIn) >>=
+ either (\ err -> if isEOFError err then return () else error "copy")
+ ( \ x -> hPutChar hOut x >> copy hIn hOut)
diff --git a/testsuite/tests/lib/IO/hGetPosn001.in b/testsuite/tests/lib/IO/hGetPosn001.in
new file mode 100644
index 0000000000..2e2537150f
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetPosn001.in
@@ -0,0 +1,2 @@
+123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
+ 1 2 3 4 5 6 7
diff --git a/testsuite/tests/lib/IO/hGetPosn001.stdout b/testsuite/tests/lib/IO/hGetPosn001.stdout
new file mode 100644
index 0000000000..10adafd933
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetPosn001.stdout
@@ -0,0 +1,5 @@
+{handle: hGetPosn001.in} at position 0
+123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
+ 1 2 3 4 5 6 7
+123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
+ 1 2 3 4 5 6 7
diff --git a/testsuite/tests/lib/IO/hGetPosn001.stdout-hugs b/testsuite/tests/lib/IO/hGetPosn001.stdout-hugs
new file mode 100644
index 0000000000..56e989c493
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetPosn001.stdout-hugs
@@ -0,0 +1,5 @@
+<handle> at position 0
+123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
+ 1 2 3 4 5 6 7
+123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
+ 1 2 3 4 5 6 7
diff --git a/testsuite/tests/lib/IO/hIsEOF001.hs b/testsuite/tests/lib/IO/hIsEOF001.hs
new file mode 100644
index 0000000000..2e5dbdcb0a
--- /dev/null
+++ b/testsuite/tests/lib/IO/hIsEOF001.hs
@@ -0,0 +1,7 @@
+-- !!! hIsEOF (on stdout)
+
+import System.IO ( hIsEOF, stdout )
+
+main = do
+ flg <- hIsEOF stdout `catch` \ _ -> putStrLn "hIsEOF failed" >> return False
+ print flg
diff --git a/testsuite/tests/lib/IO/hIsEOF001.stdout b/testsuite/tests/lib/IO/hIsEOF001.stdout
new file mode 100644
index 0000000000..76460ac50a
--- /dev/null
+++ b/testsuite/tests/lib/IO/hIsEOF001.stdout
@@ -0,0 +1,2 @@
+hIsEOF failed
+False
diff --git a/testsuite/tests/lib/IO/hIsEOF002.hs b/testsuite/tests/lib/IO/hIsEOF002.hs
new file mode 100644
index 0000000000..26f5abd9a7
--- /dev/null
+++ b/testsuite/tests/lib/IO/hIsEOF002.hs
@@ -0,0 +1,48 @@
+-- !!! test hIsEOF in various buffering situations
+
+import System.IO
+
+main = do
+ h <- openFile "hIsEOF002.hs" ReadMode
+ hSetBuffering h NoBuffering
+ hSeek h SeekFromEnd 0
+ hIsEOF h >>= print
+ hSeek h SeekFromEnd (-1)
+ hIsEOF h >>= print
+ hGetChar h >>= print
+
+ hSetBuffering h LineBuffering
+ hSeek h SeekFromEnd 0
+ hIsEOF h >>= print
+ hSeek h SeekFromEnd (-1)
+ hIsEOF h >>= print
+ hGetChar h >>= print
+
+ hSetBuffering h (BlockBuffering (Just 1))
+ hSeek h SeekFromEnd 0
+ hIsEOF h >>= print
+ hSeek h SeekFromEnd (-1)
+ hIsEOF h >>= print
+ hGetChar h >>= print
+
+ hSetBuffering h (BlockBuffering Nothing)
+ hSeek h SeekFromEnd 0
+ hIsEOF h >>= print
+ hSeek h SeekFromEnd (-1)
+ hIsEOF h >>= print
+ hGetChar h >>= print
+ hClose h
+
+ h <- openFile "hIsEOF002.out" WriteMode
+ hPutStrLn h "hello, world"
+ hClose h
+
+ h <- openFile "hIsEOF002.out" ReadWriteMode
+ hSetBuffering h NoBuffering
+ hSeek h SeekFromEnd 0
+ hIsEOF h >>= print
+ hPutChar h 'x'
+ hIsEOF h >>= print
+ hSeek h SeekFromEnd (-1)
+ hIsEOF h >>= print
+ hGetChar h >>= print
diff --git a/testsuite/tests/lib/IO/hIsEOF002.stdout b/testsuite/tests/lib/IO/hIsEOF002.stdout
new file mode 100644
index 0000000000..3aa5e1a64d
--- /dev/null
+++ b/testsuite/tests/lib/IO/hIsEOF002.stdout
@@ -0,0 +1,16 @@
+True
+False
+'\n'
+True
+False
+'\n'
+True
+False
+'\n'
+True
+False
+'\n'
+True
+True
+False
+'x'
diff --git a/testsuite/tests/lib/IO/hReady001.hs b/testsuite/tests/lib/IO/hReady001.hs
new file mode 100644
index 0000000000..00888dac2d
--- /dev/null
+++ b/testsuite/tests/lib/IO/hReady001.hs
@@ -0,0 +1,11 @@
+-- !!! hReady test
+
+ -- hReady should throw and EOF exception at the end of a file. Trac #1063.
+
+import System.IO
+
+main = do
+ h <- openFile "hReady001.hs" ReadMode
+ hReady h >>= print
+ hSeek h SeekFromEnd 0
+ (hReady h >> return ()) `catch` print
diff --git a/testsuite/tests/lib/IO/hReady001.stdout b/testsuite/tests/lib/IO/hReady001.stdout
new file mode 100644
index 0000000000..af35f80533
--- /dev/null
+++ b/testsuite/tests/lib/IO/hReady001.stdout
@@ -0,0 +1,2 @@
+True
+hReady001.hs: hWaitForInput: end of file
diff --git a/testsuite/tests/lib/IO/hReady002.hs b/testsuite/tests/lib/IO/hReady002.hs
new file mode 100644
index 0000000000..6db22a13fc
--- /dev/null
+++ b/testsuite/tests/lib/IO/hReady002.hs
@@ -0,0 +1,10 @@
+-- test for bug #4078
+import System.IO
+import Control.Concurrent
+import System.Exit
+
+main = do
+ m <- newEmptyMVar
+ forkIO $ do threadDelay 500000; putMVar m Nothing
+ forkIO $ do hReady stdin >>= putMVar m . Just
+ takeMVar m >>= print
diff --git a/testsuite/tests/lib/IO/hReady002.stdout b/testsuite/tests/lib/IO/hReady002.stdout
new file mode 100644
index 0000000000..6217d00e10
--- /dev/null
+++ b/testsuite/tests/lib/IO/hReady002.stdout
@@ -0,0 +1 @@
+Just False
diff --git a/testsuite/tests/lib/IO/hSeek001.hs b/testsuite/tests/lib/IO/hSeek001.hs
new file mode 100644
index 0000000000..d05068e955
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek001.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE CPP #-}
+-- !!! Test seeking
+
+import System.IO
+
+main = do
+ h <- openFile "hSeek001.in" ReadMode
+ True <- hIsSeekable h
+ hSeek h SeekFromEnd (-1)
+ z <- hGetChar h
+ putStr (z:"\n")
+ hSeek h SeekFromEnd (-3)
+ x <- hGetChar h
+ putStr (x:"\n")
+ hSeek h RelativeSeek (-2)
+ w <- hGetChar h
+ putStr (w:"\n")
+ hSeek h RelativeSeek 2
+ z <- hGetChar h
+ putStr (z:"\n")
+ hSeek h AbsoluteSeek (0)
+ a <- hGetChar h
+ putStr (a:"\n")
+ hSeek h AbsoluteSeek (10)
+ k <- hGetChar h
+ putStr (k:"\n")
+ hSeek h AbsoluteSeek (25)
+ z <- hGetChar h
+ putStr (z:"\n")
+ hClose h
diff --git a/testsuite/tests/lib/IO/hSeek001.in b/testsuite/tests/lib/IO/hSeek001.in
new file mode 100644
index 0000000000..e85d5b4528
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek001.in
@@ -0,0 +1 @@
+abcdefghijklmnopqrstuvwxyz \ No newline at end of file
diff --git a/testsuite/tests/lib/IO/hSeek001.stdout b/testsuite/tests/lib/IO/hSeek001.stdout
new file mode 100644
index 0000000000..ab6c1d751b
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek001.stdout
@@ -0,0 +1,7 @@
+z
+x
+w
+z
+a
+k
+z
diff --git a/testsuite/tests/lib/IO/hSeek002.hs b/testsuite/tests/lib/IO/hSeek002.hs
new file mode 100644
index 0000000000..8c9153cfaa
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek002.hs
@@ -0,0 +1,25 @@
+-- !!! Testing EOF (and the clearing of it)
+
+module Main(main) where
+
+import System.IO
+import System.Directory ( removeFile )
+
+main :: IO ()
+main = do
+ hdl <- openFile "hSeek002.hs" ReadMode
+ flg <- hIsEOF hdl
+ print flg
+ hSeek hdl SeekFromEnd 0
+ flg <- hIsEOF hdl
+ print flg
+ hSeek hdl SeekFromEnd (-1)
+ flg <- hIsEOF hdl
+ print flg
+ hGetChar hdl
+ flg <- hIsEOF hdl
+ print flg
+ hSeek hdl SeekFromEnd (-1)
+ flg <- hIsEOF hdl
+ print flg
+ hClose hdl
diff --git a/testsuite/tests/lib/IO/hSeek002.stdout b/testsuite/tests/lib/IO/hSeek002.stdout
new file mode 100644
index 0000000000..8069fe32b0
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek002.stdout
@@ -0,0 +1,5 @@
+False
+True
+False
+True
+False
diff --git a/testsuite/tests/lib/IO/hSeek003.hs b/testsuite/tests/lib/IO/hSeek003.hs
new file mode 100644
index 0000000000..03400573c4
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek003.hs
@@ -0,0 +1,51 @@
+-- !!! file positions (hGetPosn and hSetPosn)
+
+module Main(main) where
+
+import System.IO
+import Control.Monad ( sequence )
+
+testPosns :: Handle -> BufferMode -> IO ()
+testPosns hdl bmo = do
+ hSetBuffering hdl bmo
+ putStrLn ("Testing positioning with buffer mode set to: " ++ show bmo)
+ testPositioning hdl
+
+bmo_ls = [NoBuffering, LineBuffering, BlockBuffering Nothing,
+ BlockBuffering (Just 511),BlockBuffering (Just 3), BlockBuffering (Just 11)]
+
+main = do
+ hdl <- openFile "hSeek003.hs" ReadMode
+ sequence (zipWith testPosns (repeat hdl) bmo_ls)
+ hClose hdl
+
+testPositioning hdl = do
+ hSeek hdl AbsoluteSeek 0 -- go to the beginning of the file again.
+ ps <- getFilePosns 10 hdl
+ hSeek hdl AbsoluteSeek 0
+ putStr "First ten chars: "
+ ls <- hGetChars 10 hdl
+ putStrLn ls
+ -- go to the end
+ hSeek hdl SeekFromEnd 0
+ ls <- sequence (map (\ p -> hSetPosn p >> hGetChar hdl) ps)
+ putStr "First ten chars: "
+ putStrLn ls
+
+ -- position ourselves in the middle.
+ sz <- hFileSize hdl
+ hSeek hdl AbsoluteSeek (sz `div` 2)
+ ls <- sequence (map (\ p -> hSetPosn p >> hGetChar hdl) ps)
+ putStr "First ten chars: "
+ putStrLn ls
+
+hGetChars :: Int -> Handle -> IO String
+hGetChars n h = sequence (replicate n (hGetChar h))
+
+getFilePosns :: Int -> Handle -> IO [HandlePosn]
+getFilePosns 0 h = return []
+getFilePosns x h = do
+ p <- hGetPosn h
+ hGetChar h
+ ps <- getFilePosns (x-1) h
+ return (p:ps)
diff --git a/testsuite/tests/lib/IO/hSeek003.stdout b/testsuite/tests/lib/IO/hSeek003.stdout
new file mode 100644
index 0000000000..7c765c5bc5
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek003.stdout
@@ -0,0 +1,24 @@
+Testing positioning with buffer mode set to: NoBuffering
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+Testing positioning with buffer mode set to: LineBuffering
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+Testing positioning with buffer mode set to: BlockBuffering Nothing
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+Testing positioning with buffer mode set to: BlockBuffering (Just 511)
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+Testing positioning with buffer mode set to: BlockBuffering (Just 3)
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+Testing positioning with buffer mode set to: BlockBuffering (Just 11)
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
+First ten chars: -- !!! fil
diff --git a/testsuite/tests/lib/IO/hSeek004.hs b/testsuite/tests/lib/IO/hSeek004.hs
new file mode 100644
index 0000000000..9ad7c13e7f
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek004.hs
@@ -0,0 +1,8 @@
+-- !!! can't seek an AppendMode handle
+
+import System.IO
+import System.IO.Error
+
+main = do
+ h <- openFile "hSeek004.out" AppendMode
+ try (hSeek h AbsoluteSeek 0) >>= print
diff --git a/testsuite/tests/lib/IO/hSeek004.stdout b/testsuite/tests/lib/IO/hSeek004.stdout
new file mode 100644
index 0000000000..d2671a6361
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek004.stdout
@@ -0,0 +1 @@
+Left hSeek004.out: hSeek: illegal operation (handle is not seekable)
diff --git a/testsuite/tests/lib/IO/hSeek004.stdout-mingw b/testsuite/tests/lib/IO/hSeek004.stdout-mingw
new file mode 100644
index 0000000000..7d8e7076ee
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSeek004.stdout-mingw
@@ -0,0 +1,5 @@
+Left illegal operation
+Action: hSeek
+Handle: {loc=hSeek004.out,type=writable (append),binary=True,buffering=block (512)}
+Reason: handle is not seekable
+File: hSeek004.out
diff --git a/testsuite/tests/lib/IO/hSetBuffering002.hs b/testsuite/tests/lib/IO/hSetBuffering002.hs
new file mode 100644
index 0000000000..3f553029da
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetBuffering002.hs
@@ -0,0 +1,6 @@
+import System.IO
+
+main =
+ hSetBuffering stdin NoBuffering >>
+ hSetBuffering stdout NoBuffering >>
+ interact id
diff --git a/testsuite/tests/lib/IO/hSetBuffering002.stdout b/testsuite/tests/lib/IO/hSetBuffering002.stdout
new file mode 100644
index 0000000000..3f553029da
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetBuffering002.stdout
@@ -0,0 +1,6 @@
+import System.IO
+
+main =
+ hSetBuffering stdin NoBuffering >>
+ hSetBuffering stdout NoBuffering >>
+ interact id
diff --git a/testsuite/tests/lib/IO/hSetBuffering003.hs b/testsuite/tests/lib/IO/hSetBuffering003.hs
new file mode 100644
index 0000000000..74d399e4ff
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetBuffering003.hs
@@ -0,0 +1,79 @@
+-- !!! Reconfiguring the buffering of a handle
+module Main(main) where
+
+import System.IO
+
+queryBuffering :: String -> Handle -> IO ()
+queryBuffering handle_nm handle = do
+ bufm <- hGetBuffering handle
+ putStrLn ("Buffering for " ++ handle_nm ++ " is: " ++ show bufm)
+
+main = do
+ queryBuffering "stdin" stdin
+ queryBuffering "stdout" stdout
+ queryBuffering "stderr" stderr
+
+ -- twiddling the setting for stdin.
+ hSetBuffering stdin NoBuffering
+ queryBuffering "stdin" stdin
+ hSetBuffering stdin LineBuffering
+ queryBuffering "stdin" stdin
+ hSetBuffering stdin (BlockBuffering (Just 2))
+ queryBuffering "stdin" stdin
+ hSetBuffering stdin (BlockBuffering Nothing)
+ queryBuffering "stdin" stdin
+ let bmo = BlockBuffering (Just (-3))
+ hSetBuffering stdin bmo `catch` \ _ -> putStrLn ("Caught illegal op: hSetBuffering stdin " ++ showParen True (showsPrec 9 bmo) [])
+
+ putChar '\n'
+
+ -- twiddling the buffering for stdout
+ hPutStr stdout "Hello stdout 1"
+ hSetBuffering stdout NoBuffering
+ queryBuffering "stdout" stdout
+ hPutStr stdout "Hello stdout 2"
+ hSetBuffering stdout LineBuffering
+ queryBuffering "stdout" stdout
+ hPutStr stdout "Hello stdout 3"
+ hSetBuffering stdout (BlockBuffering (Just 2))
+ queryBuffering "stdout" stdout
+ hPutStr stdout "Hello stdout 4"
+ hSetBuffering stdout (BlockBuffering Nothing)
+ queryBuffering "stdout" stdout
+ hPutStr stdout "Hello stdout 5"
+ let bmo = BlockBuffering (Just (-3))
+ hSetBuffering stdout bmo `catch` \ _ -> putStrLn ("Caught illegal op: hSetBuffering stdout " ++ showParen True (showsPrec 9 bmo) [])
+
+ putChar '\n'
+
+ -- twiddling the buffering for stderr
+ hPutStr stderr "Hello stderr 1"
+ hSetBuffering stderr NoBuffering
+ queryBuffering "stderr" stderr
+ hPutStr stderr "Hello stderr 2"
+ hSetBuffering stderr LineBuffering
+ queryBuffering "stderr" stderr
+ hPutStr stderr "Hello stderr 3"
+ hSetBuffering stderr (BlockBuffering (Just 2))
+ queryBuffering "stderr" stderr
+ hPutStr stderr "Hello stderr 4"
+ hSetBuffering stderr (BlockBuffering Nothing)
+ queryBuffering "stderr" stderr
+ hPutStr stderr "Hello stderr 5"
+ let bmo = BlockBuffering (Just (-3))
+ hSetBuffering stderr bmo `catch` \ _ -> putStrLn ("Caught illegal op: hSetBuffering stderr " ++ showParen True (showsPrec 9 bmo) [])
+
+ ls <- hGetContents stdin
+ ls' <- putLine ls
+ hSetBuffering stdin NoBuffering
+ putLine ls'
+ return ()
+
+putLine :: String -> IO String
+putLine [] = return []
+putLine (x:xs) = do
+ putChar x
+ case x of
+ '\n' -> return xs
+ _ -> putLine xs
+
diff --git a/testsuite/tests/lib/IO/hSetBuffering003.stderr b/testsuite/tests/lib/IO/hSetBuffering003.stderr
new file mode 100644
index 0000000000..a4cf8779b4
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetBuffering003.stderr
@@ -0,0 +1 @@
+Hello stderr 1Hello stderr 2Hello stderr 3Hello stderr 4Hello stderr 5 \ No newline at end of file
diff --git a/testsuite/tests/lib/IO/hSetBuffering003.stdout b/testsuite/tests/lib/IO/hSetBuffering003.stdout
new file mode 100644
index 0000000000..7768773198
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetBuffering003.stdout
@@ -0,0 +1,22 @@
+Buffering for stdin is: BlockBuffering Nothing
+Buffering for stdout is: BlockBuffering Nothing
+Buffering for stderr is: NoBuffering
+Buffering for stdin is: NoBuffering
+Buffering for stdin is: LineBuffering
+Buffering for stdin is: BlockBuffering (Just 2)
+Buffering for stdin is: BlockBuffering Nothing
+Caught illegal op: hSetBuffering stdin (BlockBuffering (Just (-3)))
+
+Hello stdout 1Buffering for stdout is: NoBuffering
+Hello stdout 2Buffering for stdout is: LineBuffering
+Hello stdout 3Buffering for stdout is: BlockBuffering (Just 2)
+Hello stdout 4Buffering for stdout is: BlockBuffering Nothing
+Hello stdout 5Caught illegal op: hSetBuffering stdout (BlockBuffering (Just (-3)))
+
+Buffering for stderr is: NoBuffering
+Buffering for stderr is: LineBuffering
+Buffering for stderr is: BlockBuffering (Just 2)
+Buffering for stderr is: BlockBuffering Nothing
+Caught illegal op: hSetBuffering stderr (BlockBuffering (Just (-3)))
+-- !!! Reconfiguring the buffering of a handle
+module Main(main) where
diff --git a/testsuite/tests/lib/IO/hSetBuffering004.hs b/testsuite/tests/lib/IO/hSetBuffering004.hs
new file mode 100644
index 0000000000..eaee6826d2
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetBuffering004.hs
@@ -0,0 +1,9 @@
+-- test for #2678
+module Main (main) where
+
+import System.IO
+
+main :: IO ()
+main = do hSetBuffering stdin NoBuffering
+ hLookAhead stdin >>= print
+ hSetBuffering stdin LineBuffering
diff --git a/testsuite/tests/lib/IO/hSetBuffering004.stdout b/testsuite/tests/lib/IO/hSetBuffering004.stdout
new file mode 100644
index 0000000000..7766eec971
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetBuffering004.stdout
@@ -0,0 +1 @@
+'-'
diff --git a/testsuite/tests/lib/IO/hSetEncoding001.hs b/testsuite/tests/lib/IO/hSetEncoding001.hs
new file mode 100644
index 0000000000..95f570d094
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetEncoding001.hs
@@ -0,0 +1,49 @@
+import System.IO
+import GHC.IO.Handle
+import GHC.IO.Encoding
+import System.Environment
+
+-- Test switching encodings
+-- The test file is built by the Makefile
+
+main = do
+ [file] <- getArgs
+ test file NoBuffering
+ test file (BlockBuffering Nothing)
+ test file (BlockBuffering (Just 5))
+
+test file buf = do
+ hSetEncoding stdout utf8
+ h <- openBinaryFile file ReadMode
+ hSetBuffering stdout buf
+ putStrLn "no encoding:"
+ getUntilX h
+ hSetEncoding h utf8
+ putStrLn "UTF8:"
+ getUntilX h
+ hSetEncoding h utf16le
+ putStrLn "UTF16LE:"
+ getUntilX h
+ hSetEncoding h utf16be
+ putStrLn "UTF16BE:"
+ getUntilX h
+ hSetEncoding h utf16
+ putStrLn "UTF16:"
+ getUntilX h
+ hSetEncoding h utf32
+ putStrLn "UTF32:"
+ getUntilX h
+ hSetEncoding h utf32le
+ putStrLn "UTF32LE:"
+ getUntilX h
+ hSetEncoding h utf32be
+ putStrLn "UTF32BE:"
+ getUntilX h
+ hSetEncoding h utf8_bom
+ putStrLn "UTF8-BOM:"
+ getUntilX h
+ hIsEOF h >>= print
+
+getUntilX h = do
+ c <- hGetChar h
+ if c == 'X' then return () else do putChar c; getUntilX h
diff --git a/testsuite/tests/lib/IO/hSetEncoding001.in b/testsuite/tests/lib/IO/hSetEncoding001.in
new file mode 100644
index 0000000000..03f297441d
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetEncoding001.in
Binary files differ
diff --git a/testsuite/tests/lib/IO/hSetEncoding001.stdout b/testsuite/tests/lib/IO/hSetEncoding001.stdout
new file mode 100644
index 0000000000..a1d38ffd77
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetEncoding001.stdout
@@ -0,0 +1,90 @@
+no encoding:
+c0 | À à Â Ã Ä Ã… Æ Ç È É Ê Ë ÃŒ à Î Ã
+d0 | à Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü à Þ ß
+e0 | à á â ã ä å æ ç è é ê ë ì í î ï
+f0 | ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
+UTF8:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16LE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16BE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32LE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32BE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF8-BOM:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+True
+no encoding:
+c0 | À à Â Ã Ä Ã… Æ Ç È É Ê Ë ÃŒ à Î Ã
+d0 | à Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü à Þ ß
+e0 | à á â ã ä å æ ç è é ê ë ì í î ï
+f0 | ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
+UTF8:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16LE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16BE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32LE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32BE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF8-BOM:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+True
+no encoding:
+c0 | À à Â Ã Ä Ã… Æ Ç È É Ê Ë ÃŒ à Î Ã
+d0 | à Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü à Þ ß
+e0 | à á â ã ä å æ ç è é ê ë ì í î ï
+f0 | ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
+UTF8:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16LE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16BE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF16:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32LE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF32BE:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+UTF8-BOM:
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+True
diff --git a/testsuite/tests/lib/IO/hSetEncoding002.hs b/testsuite/tests/lib/IO/hSetEncoding002.hs
new file mode 100644
index 0000000000..35c4e1ce19
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetEncoding002.hs
@@ -0,0 +1,13 @@
+-- test for #4066
+
+import System.IO
+
+import GHC.IO.FD as FD (stdout)
+import GHC.IO.Handle.FD as FD (fdToHandle)
+import GHC.IO.Handle ( mkDuplexHandle )
+
+main = do
+ h <- mkDuplexHandle FD.stdout "stdout" Nothing noNewlineTranslation
+ hSetEncoding h utf8
+ hPutStrLn h "ö"
+ hClose h
diff --git a/testsuite/tests/lib/IO/hSetEncoding002.stdout b/testsuite/tests/lib/IO/hSetEncoding002.stdout
new file mode 100644
index 0000000000..d3b4b915a1
--- /dev/null
+++ b/testsuite/tests/lib/IO/hSetEncoding002.stdout
@@ -0,0 +1 @@
+ö
diff --git a/testsuite/tests/lib/IO/ioeGetErrorString001.hs b/testsuite/tests/lib/IO/ioeGetErrorString001.hs
new file mode 100644
index 0000000000..5621136a55
--- /dev/null
+++ b/testsuite/tests/lib/IO/ioeGetErrorString001.hs
@@ -0,0 +1,13 @@
+-- !!! test ioeGetErrorString
+
+import System.IO
+import System.IO.Error
+import Data.Maybe
+
+main = do
+ h <- openFile "ioeGetErrorString001.hs" ReadMode
+ hSeek h SeekFromEnd 0
+ (hGetChar h >> return ()) `catch`
+ \e -> if isEOFError e
+ then print (ioeGetErrorString e)
+ else putStrLn "failed."
diff --git a/testsuite/tests/lib/IO/ioeGetErrorString001.stdout b/testsuite/tests/lib/IO/ioeGetErrorString001.stdout
new file mode 100644
index 0000000000..0b8daea55a
--- /dev/null
+++ b/testsuite/tests/lib/IO/ioeGetErrorString001.stdout
@@ -0,0 +1 @@
+"end of file"
diff --git a/testsuite/tests/lib/IO/ioeGetFileName001.hs b/testsuite/tests/lib/IO/ioeGetFileName001.hs
new file mode 100644
index 0000000000..12c70c98b4
--- /dev/null
+++ b/testsuite/tests/lib/IO/ioeGetFileName001.hs
@@ -0,0 +1,12 @@
+-- !!! test ioeGetFileName
+
+import System.IO
+import System.IO.Error
+
+main = do
+ h <- openFile "ioeGetFileName001.hs" ReadMode
+ hSeek h SeekFromEnd 0
+ (hGetChar h >> return ()) `catch`
+ \e -> if isEOFError e
+ then print (ioeGetFileName e)
+ else putStrLn "failed."
diff --git a/testsuite/tests/lib/IO/ioeGetFileName001.stdout b/testsuite/tests/lib/IO/ioeGetFileName001.stdout
new file mode 100644
index 0000000000..7377ad409d
--- /dev/null
+++ b/testsuite/tests/lib/IO/ioeGetFileName001.stdout
@@ -0,0 +1 @@
+Just "ioeGetFileName001.hs"
diff --git a/testsuite/tests/lib/IO/ioeGetHandle001.hs b/testsuite/tests/lib/IO/ioeGetHandle001.hs
new file mode 100644
index 0000000000..a9ef58a8ca
--- /dev/null
+++ b/testsuite/tests/lib/IO/ioeGetHandle001.hs
@@ -0,0 +1,13 @@
+-- !!! test ioeGetHandle
+
+import System.IO
+import System.IO.Error
+import Data.Maybe
+
+main = do
+ h <- openFile "ioeGetHandle001.hs" ReadMode
+ hSeek h SeekFromEnd 0
+ (hGetChar h >> return ()) `catch`
+ \e -> if isEOFError e && fromJust (ioeGetHandle e) == h
+ then putStrLn "ok."
+ else putStrLn "failed."
diff --git a/testsuite/tests/lib/IO/ioeGetHandle001.stdout b/testsuite/tests/lib/IO/ioeGetHandle001.stdout
new file mode 100644
index 0000000000..90b5016eff
--- /dev/null
+++ b/testsuite/tests/lib/IO/ioeGetHandle001.stdout
@@ -0,0 +1 @@
+ok.
diff --git a/testsuite/tests/lib/IO/isEOF001.hs b/testsuite/tests/lib/IO/isEOF001.hs
new file mode 100644
index 0000000000..bb205703f8
--- /dev/null
+++ b/testsuite/tests/lib/IO/isEOF001.hs
@@ -0,0 +1,3 @@
+import System.IO
+
+main = isEOF >>= print
diff --git a/testsuite/tests/lib/IO/isEOF001.stdout b/testsuite/tests/lib/IO/isEOF001.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/lib/IO/isEOF001.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/lib/IO/latin1 b/testsuite/tests/lib/IO/latin1
new file mode 100644
index 0000000000..a634257fbf
--- /dev/null
+++ b/testsuite/tests/lib/IO/latin1
@@ -0,0 +1,5 @@
+c0 | À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï
+d0 | Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß
+e0 | à á â ã ä å æ ç è é ê ë ì í î ï
+f0 | ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
+X \ No newline at end of file
diff --git a/testsuite/tests/lib/IO/misc001.hs b/testsuite/tests/lib/IO/misc001.hs
new file mode 100644
index 0000000000..9f9f3e98d0
--- /dev/null
+++ b/testsuite/tests/lib/IO/misc001.hs
@@ -0,0 +1,24 @@
+import System.IO
+
+import Data.Char (toUpper)
+import System.Directory (removeFile, doesFileExist)
+import System.Environment (getArgs)
+
+main = do
+ [f1,f2] <- getArgs
+ h1 <- openFile f1 ReadMode
+ f <- doesFileExist f2
+ if f then removeFile f2 else return ()
+ h2 <- openFile f2 WriteMode
+ copyFile h1 h2
+ hClose h1
+ hClose h2
+
+copyFile h1 h2 = do
+ eof <- hIsEOF h1
+ if eof
+ then return ()
+ else do
+ c <- hGetChar h1
+ c <- hPutChar h2 (toUpper c)
+ copyFile h1 h2
diff --git a/testsuite/tests/lib/IO/misc001.stdout b/testsuite/tests/lib/IO/misc001.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/IO/misc001.stdout
diff --git a/testsuite/tests/lib/IO/newline001.hs b/testsuite/tests/lib/IO/newline001.hs
new file mode 100644
index 0000000000..b12a65bcaa
--- /dev/null
+++ b/testsuite/tests/lib/IO/newline001.hs
@@ -0,0 +1,121 @@
+import System.IO
+import GHC.IO.Handle
+import Control.Monad
+import Data.List
+
+newlines = ["\n","\r","\r\n","\n\r","\n\n","\r\r"]
+
+-- make sure the file ends in '\r': that's a tricky case for CRLF
+-- conversion, because the IO library has to check whether there's a
+-- following \n before returning the \r.
+content = concat [ show i ++ t | (i,t) <- zip [1..100] (cycle newlines) ]
+
+filename = "newline001.out"
+
+fromCRLF [] = []
+fromCRLF ('\r':'\n':cs) = '\n' : fromCRLF cs
+fromCRLF (c:cs) = c : fromCRLF cs
+
+toCRLF [] = []
+toCRLF ('\n':cs) = '\r':'\n': toCRLF cs
+toCRLF (c:cs) = c : toCRLF cs
+
+main = do
+ h <- openBinaryFile filename WriteMode
+ hPutStr h content
+ hClose h
+ testinput NoBuffering
+ testinput LineBuffering
+ testinput (BlockBuffering Nothing)
+ testinput (BlockBuffering (Just 3))
+ testinput (BlockBuffering (Just 7))
+ testinput (BlockBuffering (Just 16))
+ testoutput NoBuffering
+ testoutput LineBuffering
+ testoutput (BlockBuffering Nothing)
+ testoutput (BlockBuffering (Just 3))
+ testoutput (BlockBuffering (Just 7))
+ testoutput (BlockBuffering (Just 16))
+
+testinput b = do
+ h <- openFile filename ReadMode
+ hSetBuffering h b
+ hSetNewlineMode h noNewlineTranslation
+ str <- hGetContents h
+ check "in1" b str content
+ hClose h
+
+ h <- openFile filename ReadMode
+ hSetBuffering h b
+ hSetNewlineMode h noNewlineTranslation
+ str <- read_chars h
+ check "in2" b str content
+ hClose h
+
+ h <- openFile filename ReadMode
+ hSetBuffering h b
+ hSetNewlineMode h noNewlineTranslation
+ str <- read_lines h
+ check "in3" b str content
+ hClose h
+
+ h <- openFile filename ReadMode
+ hSetBuffering h b
+ hSetNewlineMode h NewlineMode{ inputNL=CRLF, outputNL=LF }
+ str <- hGetContents h
+ check "in4" b str (fromCRLF content)
+ hClose h
+
+ h <- openFile filename ReadMode
+ hSetBuffering h b
+ hSetNewlineMode h NewlineMode{ inputNL=CRLF, outputNL=LF }
+ str <- read_chars h
+ check "in5" b str (fromCRLF content)
+ hClose h
+
+ h <- openFile filename ReadMode
+ hSetBuffering h b
+ hSetNewlineMode h NewlineMode{ inputNL=CRLF, outputNL=LF }
+ str <- read_lines h
+ check "in6" b str (fromCRLF content)
+ hClose h
+
+testoutput b = do
+ h <- openFile filename WriteMode
+ hSetBuffering h b
+ hSetNewlineMode h NewlineMode{ inputNL=LF, outputNL=CRLF }
+ hPutStr h content
+ hClose h
+ h <- openBinaryFile filename ReadMode
+ str <- hGetContents h
+ check "out1" b (toCRLF content) str
+ hClose h
+
+ h <- openFile filename WriteMode
+ hSetBuffering h b
+ hSetNewlineMode h NewlineMode{ inputNL=LF, outputNL=CRLF }
+ mapM_ (hPutChar h) content
+ hClose h
+ h <- openBinaryFile filename ReadMode
+ str <- hGetContents h
+ check "out2" b (toCRLF content) str
+ hClose h
+
+check s b str1 str2 = do
+ when (str1 /= str2) $ error ("failed: " ++ s ++ ", " ++ show b ++ '\n':show str1 ++ '\n':show str2)
+
+read_chars :: Handle -> IO String
+read_chars h = loop h ""
+ where loop h acc = do
+ b <- hIsEOF h
+ if b then return (reverse acc) else do
+ c <- hGetChar h
+ loop h (c:acc)
+
+read_lines :: Handle -> IO String
+read_lines h = loop h []
+ where loop h acc = do
+ b <- hIsEOF h
+ if b then return (intercalate "\n" (reverse acc)) else do
+ l <- hGetLine h
+ loop h (l : acc)
diff --git a/testsuite/tests/lib/IO/openFile001.hs b/testsuite/tests/lib/IO/openFile001.hs
new file mode 100644
index 0000000000..f34f093d38
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile001.hs
@@ -0,0 +1,11 @@
+-- !!! test that a file opened in ReadMode can't be written to
+
+import System.IO
+import System.IO.Error
+
+main = do
+ hIn <- openFile "openFile001.hs" ReadMode
+ hPutStr hIn "test" `catchIOError` \ err ->
+ if isIllegalOperation err
+ then putStrLn "ok."
+ else error "Oh dear\n"
diff --git a/testsuite/tests/lib/IO/openFile001.stdout b/testsuite/tests/lib/IO/openFile001.stdout
new file mode 100644
index 0000000000..90b5016eff
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile001.stdout
@@ -0,0 +1 @@
+ok.
diff --git a/testsuite/tests/lib/IO/openFile002.hs b/testsuite/tests/lib/IO/openFile002.hs
new file mode 100644
index 0000000000..83822621f6
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile002.hs
@@ -0,0 +1,6 @@
+import Data.Char
+import System.IO
+
+-- !!! Open a non-existent file for reading (should fail)
+
+main = openFile "nonexistent" ReadMode
diff --git a/testsuite/tests/lib/IO/openFile002.stderr b/testsuite/tests/lib/IO/openFile002.stderr
new file mode 100644
index 0000000000..b011f34146
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile002.stderr
@@ -0,0 +1 @@
+openFile002: nonexistent: openFile: does not exist (No such file or directory)
diff --git a/testsuite/tests/lib/IO/openFile002.stderr-hugs b/testsuite/tests/lib/IO/openFile002.stderr-hugs
new file mode 100644
index 0000000000..aa76710e44
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile002.stderr-hugs
@@ -0,0 +1 @@
+openFile002: nonexistent: IO.openFile: does not exist (file does not exist)
diff --git a/testsuite/tests/lib/IO/openFile003.hs b/testsuite/tests/lib/IO/openFile003.hs
new file mode 100644
index 0000000000..81b69c40ec
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile003.hs
@@ -0,0 +1,14 @@
+import System.IO
+import System.IO.Error
+
+-- !!! Open a directory (should fail)
+
+main = do
+ r <- tryIOError (openFile "." ReadMode)
+ print r
+ r <- tryIOError (openFile "." WriteMode)
+ print r
+ r <- tryIOError (openFile "." AppendMode)
+ print r
+ r <- tryIOError (openFile "." ReadWriteMode)
+ print r
diff --git a/testsuite/tests/lib/IO/openFile003.stdout b/testsuite/tests/lib/IO/openFile003.stdout
new file mode 100644
index 0000000000..57288459bd
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile003.stdout
@@ -0,0 +1,4 @@
+Left .: openFile: inappropriate type (is a directory)
+Left .: openFile: inappropriate type (Is a directory)
+Left .: openFile: inappropriate type (Is a directory)
+Left .: openFile: inappropriate type (Is a directory)
diff --git a/testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-mingw32 b/testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-mingw32
new file mode 100644
index 0000000000..08eaf891f1
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-mingw32
@@ -0,0 +1,4 @@
+Left .: openFile: permission denied (Permission denied)
+Left .: openFile: permission denied (Permission denied)
+Left .: openFile: permission denied (Permission denied)
+Left .: openFile: permission denied (Permission denied)
diff --git a/testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-solaris2 b/testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-solaris2
new file mode 100644
index 0000000000..2cbf46b25f
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile003.stdout-i386-unknown-solaris2
@@ -0,0 +1,4 @@
+Left .: openFile: inappropriate type (is a directory)
+Left .: openFile: invalid argument (Invalid argument)
+Left .: openFile: invalid argument (Invalid argument)
+Left .: openFile: invalid argument (Invalid argument)
diff --git a/testsuite/tests/lib/IO/openFile003.stdout-mingw b/testsuite/tests/lib/IO/openFile003.stdout-mingw
new file mode 100644
index 0000000000..f7d4410620
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile003.stdout-mingw
@@ -0,0 +1,16 @@
+Left permission denied
+Action: openFile
+Reason: Permission denied
+File: .
+Left permission denied
+Action: openFile
+Reason: Permission denied
+File: .
+Left permission denied
+Action: openFile
+Reason: Permission denied
+File: .
+Left permission denied
+Action: openFile
+Reason: Permission denied
+File: .
diff --git a/testsuite/tests/lib/IO/openFile003.stdout-mips-sgi-irix b/testsuite/tests/lib/IO/openFile003.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..2cbf46b25f
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile003.stdout-mips-sgi-irix
@@ -0,0 +1,4 @@
+Left .: openFile: inappropriate type (is a directory)
+Left .: openFile: invalid argument (Invalid argument)
+Left .: openFile: invalid argument (Invalid argument)
+Left .: openFile: invalid argument (Invalid argument)
diff --git a/testsuite/tests/lib/IO/openFile003.stdout-sparc-sun-solaris2 b/testsuite/tests/lib/IO/openFile003.stdout-sparc-sun-solaris2
new file mode 100644
index 0000000000..2cbf46b25f
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile003.stdout-sparc-sun-solaris2
@@ -0,0 +1,4 @@
+Left .: openFile: inappropriate type (is a directory)
+Left .: openFile: invalid argument (Invalid argument)
+Left .: openFile: invalid argument (Invalid argument)
+Left .: openFile: invalid argument (Invalid argument)
diff --git a/testsuite/tests/lib/IO/openFile004.hs b/testsuite/tests/lib/IO/openFile004.hs
new file mode 100644
index 0000000000..4124abb0de
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile004.hs
@@ -0,0 +1,23 @@
+-- !!! Open a non-existent file for writing
+
+import Control.Monad
+import Data.Char
+import System.Directory
+import System.IO
+
+file = "openFile004.out"
+
+main = do
+ b <- doesFileExist file
+ when b (removeFile file)
+
+ h <- openFile file WriteMode
+ hPutStr h "hello world\n"
+ hClose h
+
+ h <- openFile file ReadMode
+ let loop = do
+ b <- hIsEOF h
+ if b then return ()
+ else do c <- hGetChar h; putChar c; loop
+ loop
diff --git a/testsuite/tests/lib/IO/openFile004.stdout b/testsuite/tests/lib/IO/openFile004.stdout
new file mode 100644
index 0000000000..3b18e512db
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile004.stdout
@@ -0,0 +1 @@
+hello world
diff --git a/testsuite/tests/lib/IO/openFile005.hs b/testsuite/tests/lib/IO/openFile005.hs
new file mode 100644
index 0000000000..d8a8f83453
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile005.hs
@@ -0,0 +1,45 @@
+-- !!! test multiple-reader single-writer locking semantics
+
+import System.IO
+import System.IO.Error
+
+file1 = "openFile005.out1"
+file2 = "openFile005.out2"
+
+main = do
+ putStrLn "two writes (should fail)"
+ h <- openFile file1 WriteMode
+ tryIOError (openFile file1 WriteMode) >>= print
+ hClose h
+
+ putStrLn "write and an append (should fail)"
+ h <- openFile file1 WriteMode
+ tryIOError (openFile file1 AppendMode) >>= print
+ hClose h
+
+ putStrLn "read/write and a write (should fail)"
+ h <- openFile file1 ReadWriteMode
+ tryIOError (openFile file1 WriteMode) >>= print
+ hClose h
+
+ putStrLn "read and a read/write (should fail)"
+ h <- openFile file1 ReadMode
+ tryIOError (openFile file1 ReadWriteMode) >>= print
+ hClose h
+
+ putStrLn "write and a read (should fail)"
+ h <- openFile file1 WriteMode
+ tryIOError (openFile file1 ReadMode) >>= print
+ hClose h
+
+ putStrLn "two writes, different files (silly, but should succeed)"
+ h1 <- openFile file1 WriteMode
+ h2 <- openFile file2 WriteMode
+ hClose h1
+ hClose h2
+
+ putStrLn "two reads, should succeed"
+ h1 <- openFile file1 ReadMode
+ h2 <- openFile file1 ReadMode
+ hClose h1
+ hClose h2
diff --git a/testsuite/tests/lib/IO/openFile005.stdout b/testsuite/tests/lib/IO/openFile005.stdout
new file mode 100644
index 0000000000..1a4b843be0
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile005.stdout
@@ -0,0 +1,12 @@
+two writes (should fail)
+Left openFile005.out1: openFile: resource busy (file is locked)
+write and an append (should fail)
+Left openFile005.out1: openFile: resource busy (file is locked)
+read/write and a write (should fail)
+Left openFile005.out1: openFile: resource busy (file is locked)
+read and a read/write (should fail)
+Left openFile005.out1: openFile: resource busy (file is locked)
+write and a read (should fail)
+Left openFile005.out1: openFile: resource busy (file is locked)
+two writes, different files (silly, but should succeed)
+two reads, should succeed
diff --git a/testsuite/tests/lib/IO/openFile005.stdout-i386-unknown-mingw32 b/testsuite/tests/lib/IO/openFile005.stdout-i386-unknown-mingw32
new file mode 100644
index 0000000000..bf227989a9
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile005.stdout-i386-unknown-mingw32
@@ -0,0 +1,12 @@
+two writes (should fail)
+Left openFile005.out1: openFile: permission denied (Permission denied)
+write and an append (should fail)
+Left openFile005.out1: openFile: permission denied (Permission denied)
+read/write and a write (should fail)
+Left openFile005.out1: openFile: permission denied (Permission denied)
+read and a read/write (should fail)
+Left openFile005.out1: openFile: permission denied (Permission denied)
+write and a read (should fail)
+Left openFile005.out1: openFile: permission denied (Permission denied)
+two writes, different files (silly, but should succeed)
+two reads, should succeed
diff --git a/testsuite/tests/lib/IO/openFile006.hs b/testsuite/tests/lib/IO/openFile006.hs
new file mode 100644
index 0000000000..63cfea1a87
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile006.hs
@@ -0,0 +1,14 @@
+-- !!! opening a file in WriteMode better truncate it
+
+import System.IO
+
+main = do
+ h <- openFile "openFile006.out" AppendMode
+ hPutStr h "hello, world"
+ size <- hFileSize h
+ print size
+ hClose h
+
+ h <- openFile "openFile006.out" WriteMode
+ size <- hFileSize h
+ print size
diff --git a/testsuite/tests/lib/IO/openFile006.stdout b/testsuite/tests/lib/IO/openFile006.stdout
new file mode 100644
index 0000000000..368283eb3d
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile006.stdout
@@ -0,0 +1,2 @@
+12
+0
diff --git a/testsuite/tests/lib/IO/openFile007.hs b/testsuite/tests/lib/IO/openFile007.hs
new file mode 100644
index 0000000000..e39ed6538f
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile007.hs
@@ -0,0 +1,18 @@
+-- !!! check that we don't truncate files if the open fails
+
+import Control.Monad
+import System.IO
+import System.IO.Error
+
+tmp = "openFile007.out"
+
+main = do
+ h <- openFile tmp WriteMode
+ hPutStrLn h "hello, world"
+
+ -- second open in write mode better fail, but better not truncate the file
+ tryIOError (openFile tmp WriteMode) >>= print
+
+ hClose h
+ s <- readFile tmp -- make sure our "hello, world" is still there
+ putStr s
diff --git a/testsuite/tests/lib/IO/openFile007.stdout b/testsuite/tests/lib/IO/openFile007.stdout
new file mode 100644
index 0000000000..49669047ff
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile007.stdout
@@ -0,0 +1,2 @@
+Left openFile007.out: openFile: resource busy (file is locked)
+hello, world
diff --git a/testsuite/tests/lib/IO/openFile007.stdout-i386-unknown-mingw32 b/testsuite/tests/lib/IO/openFile007.stdout-i386-unknown-mingw32
new file mode 100644
index 0000000000..26f0afe2b2
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile007.stdout-i386-unknown-mingw32
@@ -0,0 +1,2 @@
+Left openFile007.out: openFile: permission denied (Permission denied)
+hello, world
diff --git a/testsuite/tests/lib/IO/openFile008.hs b/testsuite/tests/lib/IO/openFile008.hs
new file mode 100644
index 0000000000..9c1a1c47f8
--- /dev/null
+++ b/testsuite/tests/lib/IO/openFile008.hs
@@ -0,0 +1,22 @@
+import System.IO
+import System.Cmd
+import System.FilePath
+import Text.Printf
+import System.Directory
+import Control.Monad
+
+testdir = "openFile008_testdir"
+
+-- Test repeated opening/closing of 1000 files. This is useful for guaging
+-- the performance of open/close and file locking.
+main = do
+ system ("rm -rf " ++ testdir)
+ createDirectory testdir
+ let filenames = [testdir </> printf "file%03d" (n::Int) | n <- [1..1000]]
+
+ forM_ [1..50] $ \_ -> do
+ hs <- mapM (\f -> openFile f WriteMode) filenames
+ mapM_ hClose hs
+
+ mapM_ removeFile filenames
+ removeDirectory testdir
diff --git a/testsuite/tests/lib/IO/openTempFile001.hs b/testsuite/tests/lib/IO/openTempFile001.hs
new file mode 100644
index 0000000000..36598e6d5b
--- /dev/null
+++ b/testsuite/tests/lib/IO/openTempFile001.hs
@@ -0,0 +1,13 @@
+module Main where
+
+import System.IO
+import Control.Exception
+import System.Directory
+
+main = bracket
+ (openTempFile "." "test.txt")
+ (\(f,_) -> removeFile f)
+ (\(f,h) -> do hPutStrLn h $ "\xa9" -- Copyright symbol
+ hClose h
+ s <- readFile f
+ if (s /= "\xa9\n") then error ("failed: " ++ s) else return ())
diff --git a/testsuite/tests/lib/IO/putStr001.hs b/testsuite/tests/lib/IO/putStr001.hs
new file mode 100644
index 0000000000..48b3add3f3
--- /dev/null
+++ b/testsuite/tests/lib/IO/putStr001.hs
@@ -0,0 +1,6 @@
+-- !!! Testing output on stdout
+
+-- stdout is buffered, so test if its buffer
+-- is flushed upon program termination.
+
+main = putStr "Hello, world\n"
diff --git a/testsuite/tests/lib/IO/putStr001.stdout b/testsuite/tests/lib/IO/putStr001.stdout
new file mode 100644
index 0000000000..a5c1966771
--- /dev/null
+++ b/testsuite/tests/lib/IO/putStr001.stdout
@@ -0,0 +1 @@
+Hello, world
diff --git a/testsuite/tests/lib/IO/readFile001.hs b/testsuite/tests/lib/IO/readFile001.hs
new file mode 100644
index 0000000000..e4a2b34cb7
--- /dev/null
+++ b/testsuite/tests/lib/IO/readFile001.hs
@@ -0,0 +1,26 @@
+-- !!! readFile test
+
+import System.IO
+import System.IO.Error
+
+source = "readFile001.hs"
+filename = "readFile001.out"
+
+main = do
+ s <- readFile source
+ h <- openFile filename WriteMode
+ hPutStrLn h s
+ hClose h
+ s <- readFile filename
+
+ -- This open should fail, because the readFile hasn't been forced
+ -- and the file is therefore still locked.
+ tryIOError (openFile filename WriteMode) >>= print
+
+ putStrLn s
+
+ -- should be able to open it for writing now, because we've forced the
+ -- whole file.
+ h <- openFile filename WriteMode
+
+ print h
diff --git a/testsuite/tests/lib/IO/readFile001.stdout b/testsuite/tests/lib/IO/readFile001.stdout
new file mode 100644
index 0000000000..cfb75708f9
--- /dev/null
+++ b/testsuite/tests/lib/IO/readFile001.stdout
@@ -0,0 +1,30 @@
+Left readFile001.out: openFile: resource busy (file is locked)
+-- !!! readFile test
+
+import System.IO
+import System.IO.Error
+
+source = "readFile001.hs"
+filename = "readFile001.out"
+
+main = do
+ s <- readFile source
+ h <- openFile filename WriteMode
+ hPutStrLn h s
+ hClose h
+ s <- readFile filename
+
+ -- This open should fail, because the readFile hasn't been forced
+ -- and the file is therefore still locked.
+ tryIOError (openFile filename WriteMode) >>= print
+
+ putStrLn s
+
+ -- should be able to open it for writing now, because we've forced the
+ -- whole file.
+ h <- openFile filename WriteMode
+
+ print h
+
+
+{handle: readFile001.out}
diff --git a/testsuite/tests/lib/IO/readFile001.stdout-i386-unknown-mingw32 b/testsuite/tests/lib/IO/readFile001.stdout-i386-unknown-mingw32
new file mode 100644
index 0000000000..d086f3a209
--- /dev/null
+++ b/testsuite/tests/lib/IO/readFile001.stdout-i386-unknown-mingw32
@@ -0,0 +1,30 @@
+Left readFile001.out: openFile: permission denied (Permission denied)
+-- !!! readFile test
+
+import System.IO
+import System.IO.Error
+
+source = "readFile001.hs"
+filename = "readFile001.out"
+
+main = do
+ s <- readFile source
+ h <- openFile filename WriteMode
+ hPutStrLn h s
+ hClose h
+ s <- readFile filename
+
+ -- This open should fail, because the readFile hasn't been forced
+ -- and the file is therefore still locked.
+ tryIOError (openFile filename WriteMode) >>= print
+
+ putStrLn s
+
+ -- should be able to open it for writing now, because we've forced the
+ -- whole file.
+ h <- openFile filename WriteMode
+
+ print h
+
+
+{handle: readFile001.out}
diff --git a/testsuite/tests/lib/IO/readwrite001.hs b/testsuite/tests/lib/IO/readwrite001.hs
new file mode 100644
index 0000000000..4a94ef10eb
--- /dev/null
+++ b/testsuite/tests/lib/IO/readwrite001.hs
@@ -0,0 +1,23 @@
+-- !!! RW files
+
+module Main(main) where
+
+import System.IO
+import System.Directory ( removeFile, doesFileExist )
+import Control.Monad
+
+main = do
+ f <- doesFileExist "readwrite001.inout"
+ when f (removeFile "readwrite001.inout")
+ hdl <- openFile "readwrite001.inout" ReadWriteMode
+ hSetBuffering hdl LineBuffering
+ hPutStr hdl "as"
+ hSeek hdl AbsoluteSeek 0
+ ch <- hGetChar hdl
+ print ch
+ hPutStr hdl "ase"
+ hSeek hdl AbsoluteSeek 0
+ putChar '\n'
+ ls <- hGetContents hdl
+ putStrLn ls
+
diff --git a/testsuite/tests/lib/IO/readwrite001.stdout b/testsuite/tests/lib/IO/readwrite001.stdout
new file mode 100644
index 0000000000..e33ba0613d
--- /dev/null
+++ b/testsuite/tests/lib/IO/readwrite001.stdout
@@ -0,0 +1,3 @@
+'a'
+
+aase
diff --git a/testsuite/tests/lib/IO/readwrite002.hs b/testsuite/tests/lib/IO/readwrite002.hs
new file mode 100644
index 0000000000..4bb607e395
--- /dev/null
+++ b/testsuite/tests/lib/IO/readwrite002.hs
@@ -0,0 +1,49 @@
+-- !!! Testing RW handles
+
+import System.IO
+import System.IO.Error
+import System.Directory (removeFile, doesFileExist)
+import Control.Monad
+import System.Cmd
+
+-- This test is weird, full marks to whoever dreamt it up!
+
+main :: IO ()
+main = do
+ let username = "readwrite002.inout"
+ f <- doesFileExist username
+ when f (removeFile username)
+ cd <- openFile username ReadWriteMode
+
+ -- binary mode needed, otherwise newline translation gives
+ -- unpredictable results.
+ hSetBinaryMode cd True
+
+-- Leva buffering on to make things more interesting:
+-- hSetBuffering stdin NoBuffering
+-- hSetBuffering stdout NoBuffering
+-- hSetBuffering cd NoBuffering
+ hPutStr cd speakString
+ hSeek cd AbsoluteSeek 0
+ speak cd `catch` \ err -> if isEOFError err then putStrLn "\nCaught EOF" else ioError err
+ hSeek cd AbsoluteSeek 0
+ hSetBuffering cd LineBuffering
+ speak cd `catch` \ err -> if isEOFError err then putStrLn "\nCaught EOF" else ioError err
+ return ()
+ hSeek cd AbsoluteSeek 0
+ hSetBuffering cd (BlockBuffering Nothing)
+ speak cd `catch` \ err -> if isEOFError err then putStrLn "\nCaught EOF" else ioError err
+
+speakString = "##############################\n"
+
+speak cd = do
+ (do
+ ready <- hReady cd
+ if ready then
+ hGetChar cd >>= putChar
+ else
+ return ()
+ ready <- hReady stdin
+ if ready then (do { ch <- getChar; hPutChar cd ch})
+ else return ())
+ speak cd
diff --git a/testsuite/tests/lib/IO/readwrite002.stdout b/testsuite/tests/lib/IO/readwrite002.stdout
new file mode 100644
index 0000000000..9aed0284d7
--- /dev/null
+++ b/testsuite/tests/lib/IO/readwrite002.stdout
@@ -0,0 +1,9 @@
+###############
+
+Caught EOF
+###############
+
+Caught EOF
+###############
+
+Caught EOF
diff --git a/testsuite/tests/lib/IO/readwrite003.hs b/testsuite/tests/lib/IO/readwrite003.hs
new file mode 100644
index 0000000000..d7ee78d637
--- /dev/null
+++ b/testsuite/tests/lib/IO/readwrite003.hs
@@ -0,0 +1,12 @@
+import System.IO
+
+file = "readwrite003.txt"
+
+main = do
+ writeFile file "ab\ncd\nef\ngh"
+ h <- openFile file ReadWriteMode
+ hGetLine h
+ hPutStrLn h "yz"
+ hClose h
+ h <- openBinaryFile file ReadMode
+ hGetContents h >>= putStr
diff --git a/testsuite/tests/lib/IO/readwrite003.stdout b/testsuite/tests/lib/IO/readwrite003.stdout
new file mode 100644
index 0000000000..6b4522804e
--- /dev/null
+++ b/testsuite/tests/lib/IO/readwrite003.stdout
@@ -0,0 +1,4 @@
+ab
+yz
+ef
+gh \ No newline at end of file
diff --git a/testsuite/tests/lib/IO/utf8-test b/testsuite/tests/lib/IO/utf8-test
new file mode 100644
index 0000000000..7d0f35a448
--- /dev/null
+++ b/testsuite/tests/lib/IO/utf8-test
@@ -0,0 +1,3 @@
+(∘) :: ∀ α β γ . (β → γ) → (α → β) → (α → γ)
+ð‘Žð‘ð‘ð‘‘ð‘’ð‘“ð‘”ð‘–ð‘—ð‘˜ð‘™ð‘šð‘›ð‘œð‘ð‘žð‘Ÿð‘ ð‘¡ð‘¢ð‘£ð‘¤ð‘¥ð‘¦ð‘§
+X \ No newline at end of file
diff --git a/testsuite/tests/lib/IOExts/Makefile b/testsuite/tests/lib/IOExts/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/IOExts/all.T b/testsuite/tests/lib/IOExts/all.T
new file mode 100644
index 0000000000..518c8cccbd
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/all.T
@@ -0,0 +1,15 @@
+test('echo001', set_stdin("echo001.hs"), compile_and_run, [''])
+
+test('hTell001', normal, compile_and_run, [''])
+
+test('hTell002', normal, compile_and_run, [''])
+
+test('performGC001', normal, compile_and_run, [''])
+
+# optimisation screws up this test because some of the traces get commoned up
+test('trace001', normal, compile_and_run, [''])
+
+test('hGetBuf002', normal, compile_and_run, [''])
+test('hGetBuf003', normal, compile_and_run, [''])
+test('hPutBuf001', normal, compile_and_run, [''])
+test('hPutBuf002', extra_clean(['hPutBuf002.out']), compile_and_run, [''])
diff --git a/testsuite/tests/lib/IOExts/echo001.hs b/testsuite/tests/lib/IOExts/echo001.hs
new file mode 100644
index 0000000000..7c803589bf
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/echo001.hs
@@ -0,0 +1,13 @@
+module Main(main) where
+
+import System.IO
+import Data.Char
+
+main = do
+ isT <- hIsTerminalDevice stdin
+ flg <- if not isT then return False else hGetEcho stdin
+ print flg
+ if not isT then hSetEcho stdin False else return ()
+ hSetBuffering stdin NoBuffering
+ interact (map toUpper)
+
diff --git a/testsuite/tests/lib/IOExts/echo001.stdout b/testsuite/tests/lib/IOExts/echo001.stdout
new file mode 100644
index 0000000000..a9d7699954
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/echo001.stdout
@@ -0,0 +1,14 @@
+False
+MODULE MAIN(MAIN) WHERE
+
+IMPORT SYSTEM.IO
+IMPORT DATA.CHAR
+
+MAIN = DO
+ IST <- HISTERMINALDEVICE STDIN
+ FLG <- IF NOT IST THEN RETURN FALSE ELSE HGETECHO STDIN
+ PRINT FLG
+ IF NOT IST THEN HSETECHO STDIN FALSE ELSE RETURN ()
+ HSETBUFFERING STDIN NOBUFFERING
+ INTERACT (MAP TOUPPER)
+
diff --git a/testsuite/tests/lib/IOExts/hGetBuf002.hs b/testsuite/tests/lib/IOExts/hGetBuf002.hs
new file mode 100644
index 0000000000..525eeb8e36
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hGetBuf002.hs
@@ -0,0 +1,22 @@
+import System.IO
+import Foreign
+import Foreign.C
+
+main = do test True; test False
+
+test blocking = do
+ h <- openBinaryFile "hGetBuf002.hs" ReadMode
+
+ let sz = 42
+ loop = do
+ b <- allocaBytes sz $ \ptr -> do
+ r <- (if blocking then hGetBuf else hGetBufNonBlocking) h ptr sz
+ if (r == 0)
+ then return True
+ else do s <- peekCStringLen (ptr,r)
+ putStr s
+ return False
+ if b then return () else loop -- tail call
+
+ loop
+
diff --git a/testsuite/tests/lib/IOExts/hGetBuf002.stdout b/testsuite/tests/lib/IOExts/hGetBuf002.stdout
new file mode 100644
index 0000000000..9cbe498c5c
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hGetBuf002.stdout
@@ -0,0 +1,44 @@
+import System.IO
+import Foreign
+import Foreign.C
+
+main = do test True; test False
+
+test blocking = do
+ h <- openBinaryFile "hGetBuf002.hs" ReadMode
+
+ let sz = 42
+ loop = do
+ b <- allocaBytes sz $ \ptr -> do
+ r <- (if blocking then hGetBuf else hGetBufNonBlocking) h ptr sz
+ if (r == 0)
+ then return True
+ else do s <- peekCStringLen (ptr,r)
+ putStr s
+ return False
+ if b then return () else loop -- tail call
+
+ loop
+
+import System.IO
+import Foreign
+import Foreign.C
+
+main = do test True; test False
+
+test blocking = do
+ h <- openBinaryFile "hGetBuf002.hs" ReadMode
+
+ let sz = 42
+ loop = do
+ b <- allocaBytes sz $ \ptr -> do
+ r <- (if blocking then hGetBuf else hGetBufNonBlocking) h ptr sz
+ if (r == 0)
+ then return True
+ else do s <- peekCStringLen (ptr,r)
+ putStr s
+ return False
+ if b then return () else loop -- tail call
+
+ loop
+
diff --git a/testsuite/tests/lib/IOExts/hGetBuf003.hs b/testsuite/tests/lib/IOExts/hGetBuf003.hs
new file mode 100644
index 0000000000..6eefdf90e8
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hGetBuf003.hs
@@ -0,0 +1,26 @@
+import System.IO
+import Foreign
+import Foreign.C
+import Control.Monad
+
+main = do test True; test False
+
+test blocking = do
+ h <- openBinaryFile "hGetBuf003.hs" ReadMode
+
+ let sz = 42
+ loop = do
+ -- mix ordinary char buffering with hGetBuf
+ eof <- hIsEOF h
+ when (not eof) $ hGetChar h >>= putChar
+ b <- allocaBytes sz $ \ptr -> do
+ r <- (if blocking then hGetBuf else hGetBufNonBlocking) h ptr sz
+ if (r == 0)
+ then return True
+ else do s <- peekCStringLen (ptr,r)
+ putStr s
+ return False
+ if b then return () else loop -- tail call
+
+ loop
+
diff --git a/testsuite/tests/lib/IOExts/hGetBuf003.stdout b/testsuite/tests/lib/IOExts/hGetBuf003.stdout
new file mode 100644
index 0000000000..ffeb291563
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hGetBuf003.stdout
@@ -0,0 +1,52 @@
+import System.IO
+import Foreign
+import Foreign.C
+import Control.Monad
+
+main = do test True; test False
+
+test blocking = do
+ h <- openBinaryFile "hGetBuf003.hs" ReadMode
+
+ let sz = 42
+ loop = do
+ -- mix ordinary char buffering with hGetBuf
+ eof <- hIsEOF h
+ when (not eof) $ hGetChar h >>= putChar
+ b <- allocaBytes sz $ \ptr -> do
+ r <- (if blocking then hGetBuf else hGetBufNonBlocking) h ptr sz
+ if (r == 0)
+ then return True
+ else do s <- peekCStringLen (ptr,r)
+ putStr s
+ return False
+ if b then return () else loop -- tail call
+
+ loop
+
+import System.IO
+import Foreign
+import Foreign.C
+import Control.Monad
+
+main = do test True; test False
+
+test blocking = do
+ h <- openBinaryFile "hGetBuf003.hs" ReadMode
+
+ let sz = 42
+ loop = do
+ -- mix ordinary char buffering with hGetBuf
+ eof <- hIsEOF h
+ when (not eof) $ hGetChar h >>= putChar
+ b <- allocaBytes sz $ \ptr -> do
+ r <- (if blocking then hGetBuf else hGetBufNonBlocking) h ptr sz
+ if (r == 0)
+ then return True
+ else do s <- peekCStringLen (ptr,r)
+ putStr s
+ return False
+ if b then return () else loop -- tail call
+
+ loop
+
diff --git a/testsuite/tests/lib/IOExts/hPutBuf001.hs b/testsuite/tests/lib/IOExts/hPutBuf001.hs
new file mode 100644
index 0000000000..fa7e076d41
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hPutBuf001.hs
@@ -0,0 +1,7 @@
+import System.IO
+import Foreign
+import Foreign.C
+
+main = do
+ hSetBinaryMode stdout True
+ withCStringLen "hello world\n" $ \(ptr,len) -> hPutBuf stdout ptr len
diff --git a/testsuite/tests/lib/IOExts/hPutBuf001.stdout b/testsuite/tests/lib/IOExts/hPutBuf001.stdout
new file mode 100644
index 0000000000..3b18e512db
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hPutBuf001.stdout
@@ -0,0 +1 @@
+hello world
diff --git a/testsuite/tests/lib/IOExts/hPutBuf002.hs b/testsuite/tests/lib/IOExts/hPutBuf002.hs
new file mode 100644
index 0000000000..a7ea2eed03
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hPutBuf002.hs
@@ -0,0 +1,9 @@
+import System.IO
+import Foreign
+import Foreign.C
+
+-- !!! this test failed to write anything in GHC 5.00.2
+main = do
+ h <- openBinaryFile "hPutBuf002.out" ReadWriteMode
+ withCStringLen "hello world\n" $ \(ptr,len) -> hPutBuf h ptr len
+ hFileSize h >>= print
diff --git a/testsuite/tests/lib/IOExts/hPutBuf002.stdout b/testsuite/tests/lib/IOExts/hPutBuf002.stdout
new file mode 100644
index 0000000000..48082f72f0
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hPutBuf002.stdout
@@ -0,0 +1 @@
+12
diff --git a/testsuite/tests/lib/IOExts/hTell001.hs b/testsuite/tests/lib/IOExts/hTell001.hs
new file mode 100644
index 0000000000..6b26eecb97
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hTell001.hs
@@ -0,0 +1,63 @@
+-- !!! Testing hGetPosn and hSetPosn
+module Main(main) where
+
+import System.IO
+
+getPosnAndPrint h = do
+ x <- hTell h
+ v <- hGetChar h
+ putStrLn ("At position: " ++ show x ++ ", found: " ++ show v)
+ return x
+
+recordDoAndRepos h a = do
+ x <- getPosnAndPrint h
+ a
+ hSeek h AbsoluteSeek x
+ getPosnAndPrint h
+ return ()
+
+recordDoAndRepos2 h a = do
+ x <- getPosnAndPrint h
+ a
+ hSeek h AbsoluteSeek x
+ getPosnAndPrint h
+ return ()
+
+recordDoAndRepos3 h a = do
+ x <- getPosnAndPrint h
+ a
+ hSeek h SeekFromEnd (negate (x + 1))
+ getPosnAndPrint h
+ return ()
+
+file = "hTell001.hs"
+
+main :: IO ()
+main = do
+ h <- openBinaryFile file ReadMode
+ recordDoAndRepos h $
+ recordDoAndRepos h $
+ recordDoAndRepos h $
+ recordDoAndRepos h $
+ recordDoAndRepos h $
+ putStrLn ""
+ hClose h
+ putStrLn "\nUsing hSeek/AbsoluteSeek: "
+ h <- openBinaryFile file ReadMode
+ recordDoAndRepos2 h $
+ recordDoAndRepos2 h $
+ recordDoAndRepos2 h $
+ recordDoAndRepos2 h $
+ recordDoAndRepos2 h $
+ putStrLn ""
+
+ hClose h
+ putStrLn "\nUsing hSeek/SeekFromEnd: "
+ putStrLn "(Don't worry if you're seeing differing numbers here, it might be down to '\\n' vs '\\r\\n')"
+ h <- openBinaryFile file ReadMode
+ recordDoAndRepos3 h $
+ recordDoAndRepos3 h $
+ recordDoAndRepos3 h $
+ recordDoAndRepos3 h $
+ recordDoAndRepos3 h $
+ putStrLn ""
diff --git a/testsuite/tests/lib/IOExts/hTell001.stdout b/testsuite/tests/lib/IOExts/hTell001.stdout
new file mode 100644
index 0000000000..7e22e69a93
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hTell001.stdout
@@ -0,0 +1,38 @@
+At position: 0, found: '-'
+At position: 1, found: '-'
+At position: 2, found: ' '
+At position: 3, found: '!'
+At position: 4, found: '!'
+
+At position: 4, found: '!'
+At position: 3, found: '!'
+At position: 2, found: ' '
+At position: 1, found: '-'
+At position: 0, found: '-'
+
+Using hSeek/AbsoluteSeek:
+At position: 0, found: '-'
+At position: 1, found: '-'
+At position: 2, found: ' '
+At position: 3, found: '!'
+At position: 4, found: '!'
+
+At position: 4, found: '!'
+At position: 3, found: '!'
+At position: 2, found: ' '
+At position: 1, found: '-'
+At position: 0, found: '-'
+
+Using hSeek/SeekFromEnd:
+(Don't worry if you're seeing differing numbers here, it might be down to '\n' vs '\r\n')
+At position: 0, found: '-'
+At position: 1, found: '-'
+At position: 2, found: ' '
+At position: 3, found: '!'
+At position: 4, found: '!'
+
+At position: 1376, found: 'n'
+At position: 1377, found: ' '
+At position: 1378, found: '"'
+At position: 1379, found: '"'
+At position: 1380, found: '\n'
diff --git a/testsuite/tests/lib/IOExts/hTell002.hs b/testsuite/tests/lib/IOExts/hTell002.hs
new file mode 100644
index 0000000000..b790db8fe8
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hTell002.hs
@@ -0,0 +1,33 @@
+-- !!! Testing hSeek
+module Main(main) where
+
+import System.Directory
+import System.IO
+
+main :: IO ()
+main = do
+ h <- openFile "tst-seek" WriteMode
+ hSetEncoding h utf8 -- hSeek/hTell work with Unicode streams
+ hPutStr h "test string1"
+ -- seek to EOF should be cool..
+ hSeek h SeekFromEnd 0
+ hPutStr h "test string2"
+ -- seek past EOF should now also be cool..
+ hSeek h SeekFromEnd 3
+ hPutStr h "test string3"
+ hSeek h AbsoluteSeek 13
+ hPutStr h "test string4"
+ x <- hTell h
+ print x
+ hSeek h AbsoluteSeek 30
+ x1 <- hTell h
+ hPutStr h "人間虫" -- we should be able to output Unicode too
+ x2 <- hTell h
+ print (x2 - x1)
+ hPutStr h "filler"
+ hClose h
+ h <- openFile "tst-seek" ReadMode
+ hSetEncoding h utf8
+ str <- hGetContents h
+ putStrLn str
+ removeFile "tst-seek"
diff --git a/testsuite/tests/lib/IOExts/hTell002.stdout b/testsuite/tests/lib/IOExts/hTell002.stdout
new file mode 100644
index 0000000000..52696f8a2c
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/hTell002.stdout
Binary files differ
diff --git a/testsuite/tests/lib/IOExts/performGC001.hs b/testsuite/tests/lib/IOExts/performGC001.hs
new file mode 100644
index 0000000000..f14dab004c
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/performGC001.hs
@@ -0,0 +1,5 @@
+-- !!! test System.Mem.performGC
+
+import System.Mem
+
+main = performGC
diff --git a/testsuite/tests/lib/IOExts/performGC001.stdout b/testsuite/tests/lib/IOExts/performGC001.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/performGC001.stdout
diff --git a/testsuite/tests/lib/IOExts/trace001.hs b/testsuite/tests/lib/IOExts/trace001.hs
new file mode 100644
index 0000000000..2ed61d486e
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/trace001.hs
@@ -0,0 +1,10 @@
+import System.IO
+import Debug.Trace
+
+main = do
+ hPutStr stderr
+ (trace (trace (trace (trace (trace (trace (trace
+ "one" "fish") "two") "fish") "red") "fish") "blue") "fish")
+ hPutStr stdout
+ (trace (trace (trace (trace (trace (trace (trace
+ "ONE" "FISH") "TWO") "FISH") "RED") "FISH") "BLUE") "FISH")
diff --git a/testsuite/tests/lib/IOExts/trace001.stderr b/testsuite/tests/lib/IOExts/trace001.stderr
new file mode 100644
index 0000000000..dfe965af21
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/trace001.stderr
@@ -0,0 +1,14 @@
+one
+fish
+two
+fish
+red
+fish
+blue
+fishONE
+FISH
+TWO
+FISH
+RED
+FISH
+BLUE
diff --git a/testsuite/tests/lib/IOExts/trace001.stdout b/testsuite/tests/lib/IOExts/trace001.stdout
new file mode 100644
index 0000000000..23ddbb4550
--- /dev/null
+++ b/testsuite/tests/lib/IOExts/trace001.stdout
@@ -0,0 +1 @@
+FISH \ No newline at end of file
diff --git a/testsuite/tests/lib/IORef/Makefile b/testsuite/tests/lib/IORef/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/IORef/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/IORef/all.T b/testsuite/tests/lib/IORef/all.T
new file mode 100644
index 0000000000..cb41d73fa1
--- /dev/null
+++ b/testsuite/tests/lib/IORef/all.T
@@ -0,0 +1,4 @@
+test('ioref001', compose(skip_if_fast,extra_run_opts('+RTS -K64m -RTS')), \
+ compile_and_run, ['+RTS -K64m -RTS'])
+
+# need to add -K32m to the compiler opts, so that GHCi gets it too
diff --git a/testsuite/tests/lib/IORef/ioref001.hs b/testsuite/tests/lib/IORef/ioref001.hs
new file mode 100644
index 0000000000..837b82e0c1
--- /dev/null
+++ b/testsuite/tests/lib/IORef/ioref001.hs
@@ -0,0 +1,9 @@
+
+module Main where
+
+import Data.IORef
+
+loop r 0 = return ()
+loop r c = loop r (c-1) >> writeIORef r 42
+
+main = newIORef 0 >>= \r -> loop r 1000000 >> putStrLn "done"
diff --git a/testsuite/tests/lib/IORef/ioref001.stdout b/testsuite/tests/lib/IORef/ioref001.stdout
new file mode 100644
index 0000000000..19f86f493a
--- /dev/null
+++ b/testsuite/tests/lib/IORef/ioref001.stdout
@@ -0,0 +1 @@
+done
diff --git a/testsuite/tests/lib/Lex/Makefile b/testsuite/tests/lib/Lex/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Lex/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Lex/all.T b/testsuite/tests/lib/Lex/all.T
new file mode 100644
index 0000000000..8c198fb90c
--- /dev/null
+++ b/testsuite/tests/lib/Lex/all.T
@@ -0,0 +1,2 @@
+test('lexNum', normal, compile_and_run, [''])
+
diff --git a/testsuite/tests/lib/Lex/lexNum.hs b/testsuite/tests/lib/Lex/lexNum.hs
new file mode 100644
index 0000000000..fb63034b52
--- /dev/null
+++ b/testsuite/tests/lib/Lex/lexNum.hs
@@ -0,0 +1,28 @@
+module Main where
+
+testStrings
+ = [ "0x3y",
+ "0X3abx",
+ "0o39y",
+ "0O334z",
+
+ "NaN",
+ "Infinity",
+
+ "34yy",
+ "34.4x",
+ "034.4x",
+ "31.45e-6y",
+ "49.2v",
+ "049.2v",
+ "35e-3x",
+ "035e-3x",
+ "35e+3y",
+ "83.3e-22",
+ "083.3e-22"
+ ]
+
+main = mapM test testStrings
+
+test s = print (lex s)
+
diff --git a/testsuite/tests/lib/Lex/lexNum.stdout b/testsuite/tests/lib/Lex/lexNum.stdout
new file mode 100644
index 0000000000..92cb063178
--- /dev/null
+++ b/testsuite/tests/lib/Lex/lexNum.stdout
@@ -0,0 +1,17 @@
+[("0x3","y")]
+[("0X3ab","x")]
+[("0o3","9y")]
+[("0O334","z")]
+[("NaN","")]
+[("Infinity","")]
+[("34","yy")]
+[("34.4","x")]
+[("034.4","x")]
+[("31.45e-6","y")]
+[("49.2","v")]
+[("049.2","v")]
+[("35e-3","x")]
+[("035e-3","x")]
+[("35e+3","y")]
+[("83.3e-22","")]
+[("083.3e-22","")]
diff --git a/testsuite/tests/lib/Makefile b/testsuite/tests/lib/Makefile
new file mode 100644
index 0000000000..9a36a1c5fe
--- /dev/null
+++ b/testsuite/tests/lib/Makefile
@@ -0,0 +1,3 @@
+TOP=../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Numeric/Makefile b/testsuite/tests/lib/Numeric/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Numeric/all.T b/testsuite/tests/lib/Numeric/all.T
new file mode 100644
index 0000000000..d6237fbee8
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/all.T
@@ -0,0 +1,10 @@
+test('num001', normal, compile_and_run, [''])
+test('num002', normal, compile_and_run, [''])
+test('num003', normal, compile_and_run, [''])
+test('num004', normal, compile_and_run, [''])
+test('num005', normal, compile_and_run, [''])
+test('num006', normal, compile_and_run, [''])
+test('num007', normal, compile_and_run, [''])
+test('num008', normal, compile_and_run, [''])
+test('num009', compose(skip_if_fast, if_os('darwin', expect_broken(2370))), compile_and_run, [''])
+test('num010', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Numeric/num001.hs b/testsuite/tests/lib/Numeric/num001.hs
new file mode 100644
index 0000000000..8a8c97a11b
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num001.hs
@@ -0,0 +1,6 @@
+module Main(main) where
+
+import Numeric
+import Data.Ratio
+
+main = print ((fromRat (132874 % 23849))::Double)
diff --git a/testsuite/tests/lib/Numeric/num001.stdout b/testsuite/tests/lib/Numeric/num001.stdout
new file mode 100644
index 0000000000..6d2f0c7a77
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num001.stdout
@@ -0,0 +1 @@
+5.571470501907837
diff --git a/testsuite/tests/lib/Numeric/num002.hs b/testsuite/tests/lib/Numeric/num002.hs
new file mode 100644
index 0000000000..31ea76ced9
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.hs
@@ -0,0 +1,20 @@
+-- Testing showInt, lightly.
+
+module Main(main) where
+
+import Numeric
+
+showSignedInt :: Integral a => a -> String
+showSignedInt x = showSigned (showInt) 0 x ""
+
+main =
+ do
+ putStrLn (showInt (343023920121::Integer) [])
+ putStrLn (showInt (3430239::Int) [])
+ putStrLn (showInt (1212 :: Int) [])
+ putStrLn (showSignedInt (591125662431 `div` (517::Int)))
+ -- showInt just works over naturals, wrap it up inside
+ -- a use of Numeric.showSigned to show negative nums.
+ putStrLn (showSignedInt (-111::Int))
+ putStrLn (showInt (232189458241::Integer) [])
+
diff --git a/testsuite/tests/lib/Numeric/num002.stdout b/testsuite/tests/lib/Numeric/num002.stdout
new file mode 100644
index 0000000000..ce14dec313
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+-3055754
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-alpha-dec-osf3
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-mips-sgi-irix
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-ws-64 b/testsuite/tests/lib/Numeric/num002.stdout-ws-64
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-ws-64
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..b81876f763
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num002.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/testsuite/tests/lib/Numeric/num003.hs b/testsuite/tests/lib/Numeric/num003.hs
new file mode 100644
index 0000000000..368be2599a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.hs
@@ -0,0 +1,20 @@
+-- Testing readInt, lightly.
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+main =
+ let
+ rd :: ReadS Integer
+ rd = readSigned (readInt 10 (isDigit) (digitToInt))
+ in
+ do
+ print (rd (show (343023920121::Integer)))
+ print (rd (show (3430239::Int)))
+ print (rd (show (1212 :: Int)))
+ print (rd (show (591125662431 `div` (517::Int))))
+ print (rd (show (-111::Int)))
+ print (rd (show (232189458241::Integer)))
+
diff --git a/testsuite/tests/lib/Numeric/num003.stdout b/testsuite/tests/lib/Numeric/num003.stdout
new file mode 100644
index 0000000000..1266b608b3
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(-3055754,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-alpha-dec-osf3
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-mips-sgi-irix
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-ws-64 b/testsuite/tests/lib/Numeric/num003.stdout-ws-64
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-ws-64
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..ae95d2aa0a
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num003.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.hs b/testsuite/tests/lib/Numeric/num004.hs
new file mode 100644
index 0000000000..0eb2bee5b0
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.hs
@@ -0,0 +1,20 @@
+-- Exercising Numeric.readSigned a bit
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+main =
+ let
+ rd :: ReadS Integer
+ rd = readSigned (readInt 10 (isDigit) (digitToInt))
+ in
+ do
+ print (rd (show (343023920121::Integer)))
+ print (rd (show (3430239::Int)))
+ print (rd (show (-0 :: Int)))
+ print (rd (show (591125662431 `div` (517::Int))))
+ print (rd (show (-111::Int)))
+ print (rd (show (232189458241::Integer)))
+
diff --git a/testsuite/tests/lib/Numeric/num004.stdout b/testsuite/tests/lib/Numeric/num004.stdout
new file mode 100644
index 0000000000..12610a153d
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(-3055754,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-alpha-dec-osf3
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-mips-sgi-irix
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-ws-64 b/testsuite/tests/lib/Numeric/num004.stdout-ws-64
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-ws-64
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..150f98e1ea
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num004.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.hs b/testsuite/tests/lib/Numeric/num005.hs
new file mode 100644
index 0000000000..ef647a6967
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.hs
@@ -0,0 +1,23 @@
+-- Exercising Numeric.readSigned a bit
+--
+module Main(main) where
+
+import Numeric
+
+main =
+ let
+ ls = ["3489348394032498320438240938403","0","-1","1","34323","2L","012","0x23","3243ab"]
+ present str f ls =
+ sequence (map (\ v -> putStr ('\n':str ++
+ ' ': v ++
+ " = " ++
+ (show (f v)))) ls)
+ in
+ do
+ present "(readDec::ReadS Integer)" (readDec::ReadS Integer) ls
+ present "(readDec::ReadS Int)" (readDec::ReadS Int) ls
+ present "(readOct::ReadS Integer)" (readOct::ReadS Integer) ls
+ present "(readOct::ReadS Int)" (readOct::ReadS Int) ls
+ present "(readHex::ReadS Integer)" (readHex::ReadS Integer) ls
+ present "(readHex::ReadS Int)" (readHex::ReadS Int) ls
+ putStrLn ""
diff --git a/testsuite/tests/lib/Numeric/num005.stdout b/testsuite/tests/lib/Numeric/num005.stdout
new file mode 100644
index 0000000000..f6ba218eb8
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(-1268053597,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(1083409411,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf3 b/testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-alpha-dec-osf3
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix b/testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-mips-sgi-irix
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-ws-64 b/testsuite/tests/lib/Numeric/num005.stdout-ws-64
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-ws-64
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..35678af82f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num005.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/testsuite/tests/lib/Numeric/num006.hs b/testsuite/tests/lib/Numeric/num006.hs
new file mode 100644
index 0000000000..f421ed72a2
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num006.hs
@@ -0,0 +1,28 @@
+-- Exercising the showing of positive numbers at various bases.
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+--showDec :: Integral a => a -> ShowS
+showDec = showInt
+
+{-
+--showBinary :: Integral a => a -> ShowS
+showBinary n r =
+ showString "0b" $
+ showIntAtBase 2 (toChr) n r
+ where toChr d = chr (ord '0' + fromIntegral d)
+-}
+
+main =
+ do
+ print (map (\ x -> showOct x []) [1..32])
+ print (map (\ x -> showDec x []) [1..32])
+ print (map (\ x -> showHex x []) [1..32])
+-- print (map (\ x -> showBinary x []) [1..32])
+ putStrLn (showOct (241324784::Int) [])
+ putStrLn (showDec (241324784::Int) [])
+ putStrLn (showHex (241324784::Int) [])
+--- putStrLn (showBinary (241324784::Int) [])
diff --git a/testsuite/tests/lib/Numeric/num006.stdout b/testsuite/tests/lib/Numeric/num006.stdout
new file mode 100644
index 0000000000..e0c45403ec
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num006.stdout
@@ -0,0 +1,6 @@
+["1","2","3","4","5","6","7","10","11","12","13","14","15","16","17","20","21","22","23","24","25","26","27","30","31","32","33","34","35","36","37","40"]
+["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"]
+["1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20"]
+1630451360
+241324784
+e6252f0
diff --git a/testsuite/tests/lib/Numeric/num007.hs b/testsuite/tests/lib/Numeric/num007.hs
new file mode 100644
index 0000000000..1c40ecfdbd
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num007.hs
@@ -0,0 +1,17 @@
+-- Exercising the reading of positive numbers at various bases.
+--
+module Main(main) where
+
+import Numeric
+
+main =
+ do
+ putStrLn (show (readOct "00000111"))
+ putStrLn (show (readDec "00000111"))
+ putStrLn (show (readHex "00000111"))
+ putStrLn (show (readOct "-24"))
+ putStrLn (show (readDec "-24"))
+ putStrLn (show (readHex "-24"))
+ putStrLn (show ((readOct ::ReadS Integer) "3248784372843778438743"))
+ putStrLn (show ((readDec ::ReadS Integer) "3248784372843778438743"))
+ putStrLn (show ((readHex ::ReadS Integer) "3248784372843778438743"))
diff --git a/testsuite/tests/lib/Numeric/num007.stdout b/testsuite/tests/lib/Numeric/num007.stdout
new file mode 100644
index 0000000000..ef60021827
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num007.stdout
@@ -0,0 +1,9 @@
+[(73,"")]
+[(111,"")]
+[(273,"")]
+[]
+[]
+[]
+[(212,"8784372843778438743")]
+[(3248784372843778438743,"")]
+[(60788519836879239998834499,"")]
diff --git a/testsuite/tests/lib/Numeric/num008.hs b/testsuite/tests/lib/Numeric/num008.hs
new file mode 100644
index 0000000000..36158240b4
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num008.hs
@@ -0,0 +1,57 @@
+-- showing/reading floats
+--
+module Main(main) where
+
+import Numeric
+
+main = do
+ let dbls = map (shEFloat (Just 7)) doubles
+ ++ map (shEFloat (Just 0)) doubles
+ ++ map (shEFloat Nothing) doubles
+ ++ map (shFFloat (Just 7)) doubles
+ ++ map (shFFloat (Just 0)) doubles
+ ++ map (shFFloat Nothing) doubles
+ ++ map (shGFloat (Just 7)) doubles
+ ++ map (shGFloat (Just 0)) doubles
+ ++ map (shGFloat Nothing) doubles
+
+ flts = map (shEFloat (Just 7)) floats
+ ++ map (shEFloat (Just 0)) floats
+ ++ map (shEFloat Nothing) floats
+ ++ map (shFFloat (Just 7)) floats
+ ++ map (shFFloat (Just 0)) floats
+ ++ map (shFFloat Nothing) floats
+ ++ map (shGFloat (Just 7)) floats
+ ++ map (shGFloat (Just 0)) floats
+ ++ map (shGFloat Nothing) floats
+
+ putStrLn (unlines dbls)
+ putStrLn (unlines flts)
+ print (map read dbls :: [Double])
+ print (map read flts :: [Double])
+
+shEFloat p f = showEFloat p f ""
+shFFloat p f = showFFloat p f ""
+shGFloat p f = showGFloat p f ""
+
+doubles :: [ Double ]
+doubles = [ 0.0
+ , 420
+ , 42
+ , 4.2
+ , 0.42
+ , 0.042
+ , 1.82173691287639817263897126389712638972163
+ , 1.82173691287639817263897126389712638972163e-300
+ ]
+
+floats :: [ Float ]
+floats = [ 0.0
+ , 420
+ , 42
+ , 4.2
+ , 0.42
+ , 0.042
+ , 1.82173691287639817263897126389712638972163
+ , 1.82173691287639817263897126389712638972163e-300
+ ]
diff --git a/testsuite/tests/lib/Numeric/num008.stdout b/testsuite/tests/lib/Numeric/num008.stdout
new file mode 100644
index 0000000000..5086442f0f
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num008.stdout
@@ -0,0 +1,148 @@
+0.0000000e0
+4.2000000e2
+4.2000000e1
+4.2000000e0
+4.2000000e-1
+4.2000000e-2
+1.8217369e0
+1.8217369e-300
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8e0
+1.8e-300
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8217369128763983e0
+1.821736912876398e-300
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+0.0420000
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+0
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+0.042
+1.8217369128763983
+0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001821736912876398
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+4.2000000e-2
+1.8217369
+1.8217369e-300
+0
+420
+42
+4
+0
+4.2e-2
+2
+1.8e-300
+0.0
+420.0
+42.0
+4.2
+0.42
+4.2e-2
+1.8217369128763983
+1.821736912876398e-300
+
+0.0000000e0
+4.2000000e2
+4.2000000e1
+4.2000000e0
+4.2000000e-1
+4.2000000e-2
+1.8217369e0
+0.0000000e0
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8e0
+0.0e0
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8217369e0
+0.0e0
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+0.0420000
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+0
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+0.042
+1.8217369
+0.0
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+4.2000000e-2
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+4.2e-2
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+4.2e-2
+1.8217369
+0.0
+
+[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300]
+[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0]
diff --git a/testsuite/tests/lib/Numeric/num009.hs b/testsuite/tests/lib/Numeric/num009.hs
new file mode 100644
index 0000000000..6910f2f840
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num009.hs
@@ -0,0 +1,39 @@
+-- trac #2059
+
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+module Main(main) where
+
+import Control.Monad
+import Foreign.C
+
+main = do let d = 1e20 :: Double
+ f = 1e20 :: Float
+ test "sind" sind sin d
+ test "sinf" sinf sin f
+ test "cosd" cosd cos d
+ test "cosf" cosf cos f
+ test "tand" tand tan d
+ test "tanf" tanf tan f
+ putStrLn "Done"
+
+test :: (RealFloat a, Floating a, RealFloat b, Floating b)
+ => String -> (a -> a) -> (b -> b) -> b -> IO ()
+test s f g x = do let y = realToFrac (f (realToFrac x))
+ z = g x
+ unless (y == z) $ do
+ putStrLn s
+ print y
+ print z
+ print $ decodeFloat y
+ print $ decodeFloat z
+
+foreign import ccall "math.h sin" sind :: CDouble -> CDouble
+foreign import ccall "math.h sinf" sinf :: CFloat -> CFloat
+
+foreign import ccall "math.h cos" cosd :: CDouble -> CDouble
+foreign import ccall "math.h cosf" cosf :: CFloat -> CFloat
+
+foreign import ccall "math.h tan" tand :: CDouble -> CDouble
+foreign import ccall "math.h tanf" tanf :: CFloat -> CFloat
+
diff --git a/testsuite/tests/lib/Numeric/num009.stdout b/testsuite/tests/lib/Numeric/num009.stdout
new file mode 100644
index 0000000000..a965a70ed4
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num009.stdout
@@ -0,0 +1 @@
+Done
diff --git a/testsuite/tests/lib/Numeric/num010.hs b/testsuite/tests/lib/Numeric/num010.hs
new file mode 100644
index 0000000000..bf1d5a2734
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num010.hs
@@ -0,0 +1,29 @@
+
+module Main(main) where
+
+main = sequence_ [ f x y | x <- [0,
+ 1000,
+ 1000000000000, -- > 2^32
+ 1000000000000000000000000, -- > 2^64
+ -1000,
+ -1000000000000, -- < -2^32
+ -1000000000000000000000000] -- < -2^64
+ , y <- [0, -10, 10] ]
+
+f :: Integer -> Int -> IO ()
+f x y = do putStrLn "------------------------"
+ print x
+ print y
+ let d :: Double
+ d = encodeFloat x y
+ (xd, yd) = decodeFloat d
+ let f :: Float
+ f = encodeFloat x y
+ (xf, yf) = decodeFloat f
+ print d
+ print xd
+ print yd
+ print f
+ print xf
+ print yf
+
diff --git a/testsuite/tests/lib/Numeric/num010.stdout b/testsuite/tests/lib/Numeric/num010.stdout
new file mode 100644
index 0000000000..877d35c722
--- /dev/null
+++ b/testsuite/tests/lib/Numeric/num010.stdout
@@ -0,0 +1,189 @@
+------------------------
+0
+0
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+0
+-10
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+0
+10
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+1000
+0
+1000.0
+8796093022208000
+-43
+1000.0
+16384000
+-14
+------------------------
+1000
+-10
+0.9765625
+8796093022208000
+-53
+0.9765625
+16384000
+-24
+------------------------
+1000
+10
+1024000.0
+8796093022208000
+-33
+1024000.0
+16384000
+-4
+------------------------
+1000000000000
+0
+1.0e12
+8192000000000000
+-13
+1.0e12
+15258789
+16
+------------------------
+1000000000000
+-10
+9.765625e8
+8192000000000000
+-23
+9.765625e8
+15258789
+6
+------------------------
+1000000000000
+10
+1.024e15
+8192000000000000
+-3
+1.024e15
+15258789
+26
+------------------------
+1000000000000000000000000
+0
+1.0e24
+7450580596923828
+27
+1.0e24
+13877788
+56
+------------------------
+1000000000000000000000000
+-10
+9.765625e20
+7450580596923828
+17
+9.765625e20
+13877788
+46
+------------------------
+1000000000000000000000000
+10
+1.024e27
+7450580596923828
+37
+1.024e27
+13877788
+66
+------------------------
+-1000
+0
+-1000.0
+-8796093022208000
+-43
+-1000.0
+-16384000
+-14
+------------------------
+-1000
+-10
+-0.9765625
+-8796093022208000
+-53
+-0.9765625
+-16384000
+-24
+------------------------
+-1000
+10
+-1024000.0
+-8796093022208000
+-33
+-1024000.0
+-16384000
+-4
+------------------------
+-1000000000000
+0
+-1.0e12
+-8192000000000000
+-13
+-1.0e12
+-15258789
+16
+------------------------
+-1000000000000
+-10
+-9.765625e8
+-8192000000000000
+-23
+-9.765625e8
+-15258789
+6
+------------------------
+-1000000000000
+10
+-1.024e15
+-8192000000000000
+-3
+-1.024e15
+-15258789
+26
+------------------------
+-1000000000000000000000000
+0
+-1.0e24
+-7450580596923828
+27
+-1.0e24
+-13877788
+56
+------------------------
+-1000000000000000000000000
+-10
+-9.765625e20
+-7450580596923828
+17
+-9.765625e20
+-13877788
+46
+------------------------
+-1000000000000000000000000
+10
+-1.024e27
+-7450580596923828
+37
+-1.024e27
+-13877788
+66
diff --git a/testsuite/tests/lib/OldException/Makefile b/testsuite/tests/lib/OldException/Makefile
new file mode 100644
index 0000000000..4a268530f1
--- /dev/null
+++ b/testsuite/tests/lib/OldException/Makefile
@@ -0,0 +1,4 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
diff --git a/testsuite/tests/lib/OldException/OldException001.hs b/testsuite/tests/lib/OldException/OldException001.hs
new file mode 100644
index 0000000000..150dc2aba7
--- /dev/null
+++ b/testsuite/tests/lib/OldException/OldException001.hs
@@ -0,0 +1,22 @@
+
+-- trace #2913
+
+{-# LANGUAGE DeriveDataTypeable #-}
+
+import qualified Control.Exception as New
+import qualified Control.OldException as Old
+
+import Data.Typeable
+
+data MyException = MyException
+ deriving (Eq, Show, Typeable)
+
+instance New.Exception MyException
+
+main :: IO ()
+main = (New.throwIO MyException
+ `Old.catch`
+ (\e -> do putStrLn ("Old got " ++ show e)
+ Old.throw e)
+ ) `New.catch` (\e -> putStrLn ("New got " ++ show (e :: MyException)))
+
diff --git a/testsuite/tests/lib/OldException/OldException001.stdout b/testsuite/tests/lib/OldException/OldException001.stdout
new file mode 100644
index 0000000000..ba73072274
--- /dev/null
+++ b/testsuite/tests/lib/OldException/OldException001.stdout
@@ -0,0 +1,2 @@
+Old got exception :: SomeException
+New got MyException
diff --git a/testsuite/tests/lib/OldException/all.T b/testsuite/tests/lib/OldException/all.T
new file mode 100644
index 0000000000..55459823eb
--- /dev/null
+++ b/testsuite/tests/lib/OldException/all.T
@@ -0,0 +1,3 @@
+
+test('OldException001', normal, compile_and_run, [''])
+
diff --git a/testsuite/tests/lib/PrettyPrint/Makefile b/testsuite/tests/lib/PrettyPrint/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/PrettyPrint/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/PrettyPrint/T3911.hs b/testsuite/tests/lib/PrettyPrint/T3911.hs
new file mode 100644
index 0000000000..01ccb22b01
--- /dev/null
+++ b/testsuite/tests/lib/PrettyPrint/T3911.hs
@@ -0,0 +1,23 @@
+
+module Main where
+
+import Text.PrettyPrint.HughesPJ
+
+xs :: [Doc]
+xs = [text "hello",
+ nest 10 (text "world")]
+
+d1 :: Doc
+d1 = vcat xs
+
+d2 :: Doc
+d2 = foldr ($$) empty xs
+
+d3 :: Doc
+d3 = foldr ($+$) empty xs
+
+main :: IO ()
+main = do print d1
+ print d2
+ print d3
+
diff --git a/testsuite/tests/lib/PrettyPrint/T3911.stdout b/testsuite/tests/lib/PrettyPrint/T3911.stdout
new file mode 100644
index 0000000000..7677e8d6f4
--- /dev/null
+++ b/testsuite/tests/lib/PrettyPrint/T3911.stdout
@@ -0,0 +1,4 @@
+hello world
+hello world
+hello
+ world
diff --git a/testsuite/tests/lib/PrettyPrint/all.T b/testsuite/tests/lib/PrettyPrint/all.T
new file mode 100644
index 0000000000..5189843c15
--- /dev/null
+++ b/testsuite/tests/lib/PrettyPrint/all.T
@@ -0,0 +1,2 @@
+test('pp1', compose(expect_broken(1062), only_ways(['normal'])), compile_and_run, [''])
+test('T3911', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/PrettyPrint/pp1.hs b/testsuite/tests/lib/PrettyPrint/pp1.hs
new file mode 100644
index 0000000000..55cfba9d27
--- /dev/null
+++ b/testsuite/tests/lib/PrettyPrint/pp1.hs
@@ -0,0 +1,18 @@
+-- This code used to print an infinite string, by calling 'spaces'
+-- with a negative argument. There's a patch in the library now,
+-- which makes 'spaces' do somehthing sensible when called with a negative
+-- argument, but it really should not happen at all.
+
+
+module Main where
+
+import Text.PrettyPrint.HughesPJ
+
+
+ncat x y = nest 4 $ cat [ x, y ]
+
+d1 = foldl1 ncat $ take 50 $ repeat $ char 'a'
+d2 = parens $ sep [ d1, text "+" , d1 ]
+
+main = print d2
+
diff --git a/testsuite/tests/lib/PrettyPrint/pp1.stdout b/testsuite/tests/lib/PrettyPrint/pp1.stdout
new file mode 100644
index 0000000000..6915311150
--- /dev/null
+++ b/testsuite/tests/lib/PrettyPrint/pp1.stdout
@@ -0,0 +1,4 @@
+This output is not what is expected, becuase the
+test "works" now, by virtue of a hack in HughesPJ.spaces.
+I'm leaving this strange output here to remind us to look
+at the root cause of the problem. Sometime. \ No newline at end of file
diff --git a/testsuite/tests/lib/Regex/Makefile b/testsuite/tests/lib/Regex/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Regex/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Regex/all.T b/testsuite/tests/lib/Regex/all.T
new file mode 100644
index 0000000000..c69bfd665a
--- /dev/null
+++ b/testsuite/tests/lib/Regex/all.T
@@ -0,0 +1,3 @@
+test('regex001', reqlib('regex-posix'), compile_and_run, ['-package regex-posix'])
+test('regex002', reqlib('regex-posix'), compile_and_run, ['-package regex-posix'])
+test('regex003', reqlib('regex-posix'), compile_and_run, ['-package regex-posix'])
diff --git a/testsuite/tests/lib/Regex/regex001.hs b/testsuite/tests/lib/Regex/regex001.hs
new file mode 100644
index 0000000000..1c9393c1b2
--- /dev/null
+++ b/testsuite/tests/lib/Regex/regex001.hs
@@ -0,0 +1,11 @@
+module Main where
+
+import Control.Exception
+import Text.Regex.Posix
+
+-- caused GHC 6.0 to crash, due to regfree'ing the regex after a
+-- failed regcomp.
+main = sequence_
+ [ try ("abc" =~~ "[[[" :: IO Bool) :: IO (Either IOException Bool)
+ | _ <- [1..10000] ]
+
diff --git a/testsuite/tests/lib/Regex/regex002.hs b/testsuite/tests/lib/Regex/regex002.hs
new file mode 100644
index 0000000000..9a87a85618
--- /dev/null
+++ b/testsuite/tests/lib/Regex/regex002.hs
@@ -0,0 +1,13 @@
+import Text.Regex.Base
+import Text.Regex.Posix((=~),(=~~)) -- or DFA or PCRE or PosixRE
+import qualified Data.ByteString.Char8 as B(ByteString,pack)
+
+main = let b :: Bool
+ b = ("abaca" =~ "(.)a")
+ c :: [MatchArray]
+ c = ("abaca" =~ "(.)a")
+ d :: Maybe (String,String,String,[String])
+ d = ("abaca" =~~ "(.)a")
+ in do print b
+ print c
+ print d
diff --git a/testsuite/tests/lib/Regex/regex002.stdout b/testsuite/tests/lib/Regex/regex002.stdout
new file mode 100644
index 0000000000..99b5656f91
--- /dev/null
+++ b/testsuite/tests/lib/Regex/regex002.stdout
@@ -0,0 +1,3 @@
+True
+[array (0,1) [(0,(1,2)),(1,(1,1))],array (0,1) [(0,(3,2)),(1,(3,1))]]
+Just ("a","ba","ca",["b"])
diff --git a/testsuite/tests/lib/Regex/regex003.hs b/testsuite/tests/lib/Regex/regex003.hs
new file mode 100644
index 0000000000..0aa51fe7aa
--- /dev/null
+++ b/testsuite/tests/lib/Regex/regex003.hs
@@ -0,0 +1,43 @@
+import Text.Regex.Base
+import Text.Regex.Posix(Regex,(=~),(=~~)) -- or DFA or PCRE or PosixRE
+import qualified Data.ByteString.Char8 as B(ByteString,pack)
+
+-- Show mixing of ByteString and String as well as polymorphism:
+
+main = let x :: (RegexContext Regex String target) => target
+ x = ("abaca" =~ B.pack "(.)a")
+ x' :: (RegexContext Regex String target,Monad m) => m target
+ x' = ("abaca" =~~ "(.)a")
+ y :: (RegexContext Regex B.ByteString target) => target
+ y = (B.pack "abaca" =~ "(.)a")
+ y' :: (RegexContext Regex B.ByteString target,Monad m) => m target
+ y' = (B.pack "abaca" =~~ B.pack "(.)a")
+ in do print (x :: Bool)
+ print (x :: Int)
+ print (x :: [MatchArray])
+ print (x' :: Maybe (String,String,String,[String]))
+ print (y :: Bool)
+ print (y :: Int)
+ print (y :: [MatchArray])
+ print (y' :: Maybe (B.ByteString,B.ByteString,B.ByteString,[B.ByteString]))
+
+{- Output is, except for replacing Full with DFA (which has no capture)
+True
+2
+[array (0,1) [(0,(1,2)),(1,(1,1))],array (0,1) [(0,(3,2)),(1,(3,1))]]
+Just ("a","ba","ca",["b"])
+True
+2
+[array (0,1) [(0,(1,2)),(1,(1,1))],array (0,1) [(0,(3,2)),(1,(3,1))]]
+Just ("a","ba","ca",["b"])
+-}
+{- The output for DFA is
+True
+2
+[array (0,0) [(0,(1,2))],array (0,0) [(0,(3,2))]]
+Just ("a","ba","ca",[])
+True
+2
+[array (0,0) [(0,(1,2))],array (0,0) [(0,(3,2))]]
+Just ("a","ba","ca",[])
+-}
diff --git a/testsuite/tests/lib/Regex/regex003.stdout b/testsuite/tests/lib/Regex/regex003.stdout
new file mode 100644
index 0000000000..49d7499e91
--- /dev/null
+++ b/testsuite/tests/lib/Regex/regex003.stdout
@@ -0,0 +1,8 @@
+True
+2
+[array (0,1) [(0,(1,2)),(1,(1,1))],array (0,1) [(0,(3,2)),(1,(3,1))]]
+Just ("a","ba","ca",["b"])
+True
+2
+[array (0,1) [(0,(1,2)),(1,(1,1))],array (0,1) [(0,(3,2)),(1,(3,1))]]
+Just ("a","ba","ca",["b"])
diff --git a/testsuite/tests/lib/Show/Makefile b/testsuite/tests/lib/Show/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Show/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Show/all.T b/testsuite/tests/lib/Show/all.T
new file mode 100644
index 0000000000..0e98a0e5a9
--- /dev/null
+++ b/testsuite/tests/lib/Show/all.T
@@ -0,0 +1,2 @@
+test('showDouble', normal, compile_and_run, [''])
+
diff --git a/testsuite/tests/lib/Show/showDouble.hs b/testsuite/tests/lib/Show/showDouble.hs
new file mode 100644
index 0000000000..399af28450
--- /dev/null
+++ b/testsuite/tests/lib/Show/showDouble.hs
@@ -0,0 +1,41 @@
+
+module Main (main) where
+
+main :: IO ()
+main = do let xs = [p0, p01, p3, p31, n0, n01, n3, n31, pinf, ninf, nan]
+ mapM_ print xs
+ mapM_ (print . Just) xs
+
+p0 :: Double
+p0 = 0
+
+p01 :: Double
+p01 = 0.1
+
+p3 :: Double
+p3 = 3
+
+p31 :: Double
+p31 = 3.1
+
+n0 :: Double
+n0 = -0
+
+n01 :: Double
+n01 = -0.1
+
+n3 :: Double
+n3 = -3
+
+n31 :: Double
+n31 = -3.1
+
+pinf :: Double
+pinf = 1 / 0
+
+ninf :: Double
+ninf = - 1 / 0
+
+nan :: Double
+nan = 0 / 0
+
diff --git a/testsuite/tests/lib/Show/showDouble.stdout b/testsuite/tests/lib/Show/showDouble.stdout
new file mode 100644
index 0000000000..fb1b4de5e4
--- /dev/null
+++ b/testsuite/tests/lib/Show/showDouble.stdout
@@ -0,0 +1,22 @@
+0.0
+0.1
+3.0
+3.1
+-0.0
+-0.1
+-3.0
+-3.1
+Infinity
+-Infinity
+NaN
+Just 0.0
+Just 0.1
+Just 3.0
+Just 3.1
+Just (-0.0)
+Just (-0.1)
+Just (-3.0)
+Just (-3.1)
+Just Infinity
+Just (-Infinity)
+Just NaN
diff --git a/testsuite/tests/lib/System/Makefile b/testsuite/tests/lib/System/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/System/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/System/all.T b/testsuite/tests/lib/System/all.T
new file mode 100644
index 0000000000..996946fd69
--- /dev/null
+++ b/testsuite/tests/lib/System/all.T
@@ -0,0 +1,8 @@
+
+test('exitWith001', exit_code(42), compile_and_run, [''])
+test('getArgs001', normal, compile_and_run, [''])
+test('getEnv001', normal, compile_and_run, [''])
+
+test('system001', if_platform("i386-unknown-mingw32", expect_fail), \
+ compile_and_run, [''])
+
diff --git a/testsuite/tests/lib/System/exitWith001.hs b/testsuite/tests/lib/System/exitWith001.hs
new file mode 100644
index 0000000000..38dc38a9d5
--- /dev/null
+++ b/testsuite/tests/lib/System/exitWith001.hs
@@ -0,0 +1,3 @@
+import System.Exit (exitWith, ExitCode(..))
+
+main = exitWith (ExitFailure 42)
diff --git a/testsuite/tests/lib/System/exitWith001.stdout b/testsuite/tests/lib/System/exitWith001.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/System/exitWith001.stdout
diff --git a/testsuite/tests/lib/System/getArgs001.hs b/testsuite/tests/lib/System/getArgs001.hs
new file mode 100644
index 0000000000..4b8df9101b
--- /dev/null
+++ b/testsuite/tests/lib/System/getArgs001.hs
@@ -0,0 +1,9 @@
+import System.Environment (getProgName, getArgs)
+
+main =
+ getProgName >>= \ argv0 ->
+ putStr argv0 >>
+ getArgs >>= \ argv ->
+ sequence (map (\ x -> putChar ' ' >> putStr x) argv) >>
+ putChar '\n'
+
diff --git a/testsuite/tests/lib/System/getArgs001.stdout b/testsuite/tests/lib/System/getArgs001.stdout
new file mode 100644
index 0000000000..e732087713
--- /dev/null
+++ b/testsuite/tests/lib/System/getArgs001.stdout
@@ -0,0 +1 @@
+getArgs001
diff --git a/testsuite/tests/lib/System/getEnv001.hs b/testsuite/tests/lib/System/getEnv001.hs
new file mode 100644
index 0000000000..745f8eaa7f
--- /dev/null
+++ b/testsuite/tests/lib/System/getEnv001.hs
@@ -0,0 +1,15 @@
+
+import System.Environment (getEnv)
+import System.IO.Error (catchIOError, isDoesNotExistError)
+
+main :: IO ()
+main = do
+ term <- getEnv "PATH"
+ putStrLn "Got $PATH"
+ fish <- getEnv "One fish, two fish, red fish, blue fish" `catchIOError` getEnv_except
+ putStrLn fish
+
+getEnv_except :: IOError -> IO String
+getEnv_except ioe
+ | isDoesNotExistError ioe = return ""
+ | otherwise = ioError ioe
diff --git a/testsuite/tests/lib/System/getEnv001.stdout b/testsuite/tests/lib/System/getEnv001.stdout
new file mode 100644
index 0000000000..b191cc3dd1
--- /dev/null
+++ b/testsuite/tests/lib/System/getEnv001.stdout
@@ -0,0 +1,2 @@
+Got $PATH
+
diff --git a/testsuite/tests/lib/System/system001.hs b/testsuite/tests/lib/System/system001.hs
new file mode 100644
index 0000000000..4237d526af
--- /dev/null
+++ b/testsuite/tests/lib/System/system001.hs
@@ -0,0 +1,14 @@
+-- Not run on mingw, because of /dev/null use
+
+import System.Cmd (system)
+import System.Exit (ExitCode(..), exitWith)
+
+main =
+ system "cat dog 1>/dev/null 2>&1" >>= \ ec ->
+ case ec of
+ ExitSuccess -> putStr "What?!?\n" >> ioError (userError "dog succeeded")
+ ExitFailure _ ->
+ system "cat system001.hs 2>/dev/null" >>= \ ec ->
+ case ec of
+ ExitSuccess -> exitWith ExitSuccess
+ ExitFailure _ -> putStr "What?!?\n" >> ioError (userError "cat failed")
diff --git a/testsuite/tests/lib/System/system001.stdout b/testsuite/tests/lib/System/system001.stdout
new file mode 100644
index 0000000000..4237d526af
--- /dev/null
+++ b/testsuite/tests/lib/System/system001.stdout
@@ -0,0 +1,14 @@
+-- Not run on mingw, because of /dev/null use
+
+import System.Cmd (system)
+import System.Exit (ExitCode(..), exitWith)
+
+main =
+ system "cat dog 1>/dev/null 2>&1" >>= \ ec ->
+ case ec of
+ ExitSuccess -> putStr "What?!?\n" >> ioError (userError "dog succeeded")
+ ExitFailure _ ->
+ system "cat system001.hs 2>/dev/null" >>= \ ec ->
+ case ec of
+ ExitSuccess -> exitWith ExitSuccess
+ ExitFailure _ -> putStr "What?!?\n" >> ioError (userError "cat failed")
diff --git a/testsuite/tests/lib/Text.Printf/1548.hs b/testsuite/tests/lib/Text.Printf/1548.hs
new file mode 100644
index 0000000000..68cec0548f
--- /dev/null
+++ b/testsuite/tests/lib/Text.Printf/1548.hs
@@ -0,0 +1,11 @@
+import Text.Printf
+
+main = do
+ printf "%.*f\n" (2::Int) ((1/3) :: Double)
+ -- (expected: "0.33")
+
+ printf "%.3s\n" "foobar"
+ -- (expected: "foo")
+
+ printf "%10.5d\n" (4::Int)
+ -- (expected: " 00004")
diff --git a/testsuite/tests/lib/Text.Printf/1548.stdout b/testsuite/tests/lib/Text.Printf/1548.stdout
new file mode 100644
index 0000000000..4976334b4f
--- /dev/null
+++ b/testsuite/tests/lib/Text.Printf/1548.stdout
@@ -0,0 +1,3 @@
+0.33
+foo
+ 00004
diff --git a/testsuite/tests/lib/Text.Printf/Makefile b/testsuite/tests/lib/Text.Printf/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Text.Printf/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Text.Printf/all.T b/testsuite/tests/lib/Text.Printf/all.T
new file mode 100644
index 0000000000..aa26ff2d96
--- /dev/null
+++ b/testsuite/tests/lib/Text.Printf/all.T
@@ -0,0 +1 @@
+test('1548', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Time/Makefile b/testsuite/tests/lib/Time/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/Time/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/Time/all.T b/testsuite/tests/lib/Time/all.T
new file mode 100644
index 0000000000..25b40820c0
--- /dev/null
+++ b/testsuite/tests/lib/Time/all.T
@@ -0,0 +1,3 @@
+test('time002', normal, compile_and_run, [''])
+test('time003', normal, compile_and_run, [''])
+test('time004', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/Time/time002.hs b/testsuite/tests/lib/Time/time002.hs
new file mode 100644
index 0000000000..e2f9bcb7a7
--- /dev/null
+++ b/testsuite/tests/lib/Time/time002.hs
@@ -0,0 +1,16 @@
+import System.Time
+
+-- !!! check that we can read the current ClockTime, convert it
+-- !!! to CalendarTime and back again, and that all three times when
+-- !!! converted to strings compare equal.
+
+main = do
+ t <- getClockTime
+ let clock = show t
+ c <- toCalendarTime t
+ let cal = calendarTimeToString c
+ let t2 = toClockTime c
+ clock2 = show t2
+ if (clock == cal && clock == clock2)
+ then putStrLn "Ok."
+ else putStrLn "Failed."
diff --git a/testsuite/tests/lib/Time/time002.stdout b/testsuite/tests/lib/Time/time002.stdout
new file mode 100644
index 0000000000..587579af91
--- /dev/null
+++ b/testsuite/tests/lib/Time/time002.stdout
@@ -0,0 +1 @@
+Ok.
diff --git a/testsuite/tests/lib/Time/time003.hs b/testsuite/tests/lib/Time/time003.hs
new file mode 100644
index 0000000000..4dda0e466f
--- /dev/null
+++ b/testsuite/tests/lib/Time/time003.hs
@@ -0,0 +1,24 @@
+import System.Time
+
+main :: IO ()
+main = do
+ time <- getClockTime
+ print (plausible (show time))
+ let (CalendarTime year month mday hour min sec psec
+ wday yday timezone gmtoff isdst) = toUTCTime time
+ time2 = wdays !! fromEnum wday ++
+ (' ' : months !! fromEnum month) ++
+ (' ' : shows2 mday (' ' : shows2 hour (':' : shows2 min (':' : shows2 sec
+ (' ' : timezone ++ ' ' : shows year "\n")))))
+ print (plausible time2)
+
+ where
+ wdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+ months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ shows2 x = showString (pad2 x)
+ pad2 x = case show x of
+ c@[_] -> '0' : c
+ cs -> cs
+
+ plausible str = filter (== ':') str == "::" \ No newline at end of file
diff --git a/testsuite/tests/lib/Time/time003.stdout b/testsuite/tests/lib/Time/time003.stdout
new file mode 100644
index 0000000000..dbde422651
--- /dev/null
+++ b/testsuite/tests/lib/Time/time003.stdout
@@ -0,0 +1,2 @@
+True
+True
diff --git a/testsuite/tests/lib/Time/time004.hs b/testsuite/tests/lib/Time/time004.hs
new file mode 100644
index 0000000000..9a281a10da
--- /dev/null
+++ b/testsuite/tests/lib/Time/time004.hs
@@ -0,0 +1,10 @@
+import System.Time
+
+main :: IO ()
+main = do
+ time <- getClockTime
+ let (CalendarTime year month mday hour min sec psec
+ wday yday timezone gmtoff isdst) = toUTCTime time
+ time' = toClockTime (CalendarTime (year - 1) month mday hour min sec psec
+ wday yday timezone gmtoff isdst)
+ print (length (show time) == length (show time'))
diff --git a/testsuite/tests/lib/Time/time004.stdout b/testsuite/tests/lib/Time/time004.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/lib/Time/time004.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/lib/exceptions/Makefile b/testsuite/tests/lib/exceptions/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/exceptions/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/exceptions/all.T b/testsuite/tests/lib/exceptions/all.T
new file mode 100644
index 0000000000..04b3a7fce4
--- /dev/null
+++ b/testsuite/tests/lib/exceptions/all.T
@@ -0,0 +1 @@
+test('exceptions001', normal, compile_and_run, [''])
diff --git a/testsuite/tests/lib/exceptions/exceptions001.hs b/testsuite/tests/lib/exceptions/exceptions001.hs
new file mode 100644
index 0000000000..f5fcbf0087
--- /dev/null
+++ b/testsuite/tests/lib/exceptions/exceptions001.hs
@@ -0,0 +1,7 @@
+
+-- trac #2508
+
+import System.Exit
+import Control.OldException
+
+main = exitWith ExitSuccess `finally` return ()
diff --git a/testsuite/tests/lib/haskell98/Makefile b/testsuite/tests/lib/haskell98/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/haskell98/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/haskell98/all.T b/testsuite/tests/lib/haskell98/all.T
new file mode 100644
index 0000000000..85e226fdb7
--- /dev/null
+++ b/testsuite/tests/lib/haskell98/all.T
@@ -0,0 +1 @@
+test('instance-leaks', normal, compile, ['-hide-all-packages -package haskell98'])
diff --git a/testsuite/tests/lib/haskell98/instance-leaks.hs b/testsuite/tests/lib/haskell98/instance-leaks.hs
new file mode 100644
index 0000000000..131d42cbd9
--- /dev/null
+++ b/testsuite/tests/lib/haskell98/instance-leaks.hs
@@ -0,0 +1,27 @@
+-- Check that the instances in Control.Monad.Instances do not leak
+-- into any Haskell 98 modules.
+module Main where
+
+-- import all Haskell 98 modules
+import Array
+import Char
+import Complex
+import CPUTime
+import Directory
+import IO
+import Ix
+import List
+import Locale
+import Maybe
+import Monad
+import Numeric
+import Random
+import Ratio
+import System
+import Time
+
+-- This will fail if any of the Haskell 98 modules indirectly import
+-- Control.Monad.Instances
+instance Functor ((->) r) where fmap = (.)
+
+main = undefined
diff --git a/testsuite/tests/lib/integer/Makefile b/testsuite/tests/lib/integer/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/integer/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/integer/all.T b/testsuite/tests/lib/integer/all.T
new file mode 100644
index 0000000000..a3568e7606
--- /dev/null
+++ b/testsuite/tests/lib/integer/all.T
@@ -0,0 +1,3 @@
+test('integerBits', normal, compile_and_run, [''])
+test('integerConversions', normal, compile_and_run, [''])
+
diff --git a/testsuite/tests/lib/integer/integerBits.hs b/testsuite/tests/lib/integer/integerBits.hs
new file mode 100644
index 0000000000..d5538dd544
--- /dev/null
+++ b/testsuite/tests/lib/integer/integerBits.hs
@@ -0,0 +1,134 @@
+
+module Main (main) where
+
+import Data.Bits
+
+{-
+Do some bitwise operations on some large numbers.
+These number are designed so that they are likely to exercise all the
+interesting split-up cases for implementations that implement Integer
+as some sort of sequence of roughly word-sized values. They are
+essentially random apart from that.
+-}
+
+px, py, nx, ny :: Integer
+px = 0x03A4B5C281F6E9D7029C3FE81D6A4B75
+nx = -0x03A4B5C281F6E9D7029C3FE81D6A4B75
+py = 0x069AF53C4D1BE728
+ny = -0x069AF53C4D1BE728
+ -- \.. 64 bits ../\.. 64 bits ../
+
+{-
+px = 0 0000001110100100101101011100001010000001111101101110100111010111 0000001010011100001111111110100000011101011010100100101101110101
+py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000011010011010111101010011110001001101000110111110011100101000
+px and py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000001010011000001101010010100000001101000010100100001100100000
+
+px = 0 0000001110100100101101011100001010000001111101101110100111010111 0000001010011100001111111110100000011101011010100100101101110101
+ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111100101100101000010101100001110110010111001000001100011011000
+px and ny = 0 0000001110100100101101011100001010000001111101101110100111010111 0000000000000100000010101100000000010000011000000000100001010000
+
+nx = 1 1111110001011011010010100011110101111110000010010001011000101000 1111110101100011110000000001011111100010100101011011010010001011
+py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000011010011010111101010011110001001101000110111110011100101000
+nx and py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000010000000010110000000001010001000000000100011010010000001000
+
+nx = 1 1111110001011011010010100011110101111110000010010001011000101000 1111110101100011110000000001011111100010100101011011010010001011
+ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111100101100101000010101100001110110010111001000001100011011000
+nx and ny = 1 1111110001011011010010100011110101111110000010010001011000101000 1111100101100001000000000000001110100010100001000001000010001000
+ = neg 0 0000001110100100101101011100001010000001111101101110100111010111 0000011010011110111111111111110001011101011110111110111101111000
+
+px = 0 0000001110100100101101011100001010000001111101101110100111010111 0000001010011100001111111110100000011101011010100100101101110101
+py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000011010011010111101010011110001001101000110111110011100101000
+px or py = 0 0000001110100100101101011100001010000001111101101110100111010111 0000011010011110111111111111110001011101011110111110111101111101
+
+px = 0 0000001110100100101101011100001010000001111101101110100111010111 0000001010011100001111111110100000011101011010100100101101110101
+ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111100101100101000010101100001110110010111001000001100011011000
+px or ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111101111111101001111111110101110111111111011100101101111111101
+ = neg 0 0000000000000000000000000000000000000000000000000000000000000000 0000010000000010110000000001010001000000000100011010010000000011
+
+nx = 1 1111110001011011010010100011110101111110000010010001011000101000 1111110101100011110000000001011111100010100101011011010010001011
+py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000011010011010111101010011110001001101000110111110011100101000
+nx or py = 1 1111110001011011010010100011110101111110000010010001011000101000 1111111111111011111101010011111111101111100111111111011110101011
+ = neg 0 0000001110100100101101011100001010000001111101101110100111010111 0000000000000100000010101100000000010000011000000000100001010101
+
+nx = 1 1111110001011011010010100011110101111110000010010001011000101000 1111110101100011110000000001011111100010100101011011010010001011
+ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111100101100101000010101100001110110010111001000001100011011000
+nx or ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111110101100111110010101101011111110010111101011011110011011011
+ = neg 0 0000000000000000000000000000000000000000000000000000000000000000 0000001010011000001101010010100000001101000010100100001100100101
+
+px = 0 0000001110100100101101011100001010000001111101101110100111010111 0000001010011100001111111110100000011101011010100100101101110101
+py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000011010011010111101010011110001001101000110111110011100101000
+px xor py = 0 0000001110100100101101011100001010000001111101101110100111010111 0000010000000110110010101101010001010000011100011010110001011101
+
+px = 0 0000001110100100101101011100001010000001111101101110100111010111 0000001010011100001111111110100000011101011010100100101101110101
+ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111100101100101000010101100001110110010111001000001100011011000
+px xor ny = 1 1111110001011011010010100011110101111110000010010001011000101000 1111101111111001001101010010101110101111100011100101001110101101
+ = neg 0 0000001110100100101101011100001010000001111101101110100111010111 0000010000000110110010101101010001010000011100011010110001010011
+
+nx = 1 1111110001011011010010100011110101111110000010010001011000101000 1111110101100011110000000001011111100010100101011011010010001011
+py = 0 0000000000000000000000000000000000000000000000000000000000000000 0000011010011010111101010011110001001101000110111110011100101000
+nx xor py = 1 1111110001011011010010100011110101111110000010010001011000101000 1111101111111001001101010010101110101111100011100101001110100011
+ = neg 0 0000001110100100101101011100001010000001111101101110100111010111 0000010000000110110010101101010001010000011100011010110001011101
+
+nx = 1 1111110001011011010010100011110101111110000010010001011000101000 1111110101100011110000000001011111100010100101011011010010001011
+ny = 1 1111111111111111111111111111111111111111111111111111111111111111 1111100101100101000010101100001110110010111001000001100011011000
+nx xor ny = 0 0000001110100100101101011100001010000001111101101110100111010111 0000010000000110110010101101010001010000011100011010110001010011
+
+-}
+
+px_and_py :: Integer
+px_and_py = 0x29835280D0A4320
+
+px_and_ny :: Integer
+px_and_ny = 0x3A4B5C281F6E9D700040AC010600850
+
+nx_and_py :: Integer
+nx_and_py = 0x402C0144011A408
+
+nx_and_ny :: Integer
+nx_and_ny = -0x3A4B5C281F6E9D7069EFFFC5D7BEF78
+
+px_or_py :: Integer
+px_or_py = 0x3A4B5C281F6E9D7069EFFFC5D7BEF7D
+
+px_or_ny :: Integer
+px_or_ny = -0x402C0144011A403
+
+nx_or_py :: Integer
+nx_or_py = -0x3A4B5C281F6E9D700040AC010600855
+
+nx_or_ny :: Integer
+nx_or_ny = -0x29835280D0A4325
+
+px_xor_py :: Integer
+px_xor_py = 0x3A4B5C281F6E9D70406CAD45071AC5D
+
+px_xor_ny :: Integer
+px_xor_ny = -0x3A4B5C281F6E9D70406CAD45071AC53
+
+nx_xor_py :: Integer
+nx_xor_py = -0x3A4B5C281F6E9D70406CAD45071AC5D
+
+nx_xor_ny :: Integer
+nx_xor_ny = 0x3A4B5C281F6E9D70406CAD45071AC53
+
+main :: IO ()
+main = do putStrLn "Start"
+ test "px and py" px_and_py (px .&. py)
+ test "px and ny" px_and_ny (px .&. ny)
+ test "nx and py" nx_and_py (nx .&. py)
+ test "nx and ny" nx_and_ny (nx .&. ny)
+ test "px or py" px_or_py (px .|. py)
+ test "px or ny" px_or_ny (px .|. ny)
+ test "nx or py" nx_or_py (nx .|. py)
+ test "nx or ny" nx_or_ny (nx .|. ny)
+ test "px xor py" px_xor_py (px `xor` py)
+ test "px xor ny" px_xor_ny (px `xor` ny)
+ test "nx xor py" nx_xor_py (nx `xor` py)
+ test "nx xor ny" nx_xor_ny (nx `xor` ny)
+ putStrLn "End"
+
+test :: String -> Integer -> Integer -> IO ()
+test what want got
+ | want == got = return ()
+ | otherwise = print (what, want, got)
+
diff --git a/testsuite/tests/lib/integer/integerBits.stdout b/testsuite/tests/lib/integer/integerBits.stdout
new file mode 100644
index 0000000000..621e83f953
--- /dev/null
+++ b/testsuite/tests/lib/integer/integerBits.stdout
@@ -0,0 +1,2 @@
+Start
+End
diff --git a/testsuite/tests/lib/integer/integerConversions.hs b/testsuite/tests/lib/integer/integerConversions.hs
new file mode 100644
index 0000000000..9b10bbdff2
--- /dev/null
+++ b/testsuite/tests/lib/integer/integerConversions.hs
@@ -0,0 +1,80 @@
+
+module Main (main) where
+
+import Data.Int
+import Data.Word
+
+around :: Integer -> [Integer]
+around i = [i - 2, i - 1, i, i + 1, i + 2]
+
+dump :: Show a => String -> [a] -> IO ()
+dump s xs = do putStrLn "===================================="
+ putStrLn s
+ mapM_ print xs
+
+main :: IO ()
+main = do let xs :: [[Integer]]
+ xs = [around 0,
+ around (2^30),
+ around (2^31),
+ around (2^32),
+ around (2^33),
+ around (2^34),
+ around (2^62),
+ around (2^63),
+ around (2^64),
+ around (2^65),
+ around (2^66),
+ around (-(2^30)),
+ around (-(2^31)),
+ around (-(2^32)),
+ around (-(2^33)),
+ around (-(2^34)),
+ around (-(2^62)),
+ around (-(2^63)),
+ around (-(2^64)),
+ around (-(2^65)),
+ around (-(2^66))]
+ xsInt :: [[Int]]
+ xsInt = map (map fromInteger) xs
+ xsIntInteger :: [[Integer]]
+ xsIntInteger = map (map toInteger) xsInt
+ xsInt32 :: [[Int32]]
+ xsInt32 = map (map fromInteger) xs
+ xsInt32Integer :: [[Integer]]
+ xsInt32Integer = map (map toInteger) xsInt32
+ xsInt64 :: [[Int64]]
+ xsInt64 = map (map fromInteger) xs
+ xsInt64Integer :: [[Integer]]
+ xsInt64Integer = map (map toInteger) xsInt64
+ xsWord :: [[Word]]
+ xsWord = map (map fromInteger) xs
+ xsWordInteger :: [[Integer]]
+ xsWordInteger = map (map toInteger) xsWord
+ xsWord32 :: [[Word32]]
+ xsWord32 = map (map fromInteger) xs
+ xsWord32Integer :: [[Integer]]
+ xsWord32Integer = map (map toInteger) xsWord32
+ xsWord64 :: [[Word64]]
+ xsWord64 = map (map fromInteger) xs
+ xsWord64Integer :: [[Integer]]
+ xsWord64Integer = map (map toInteger) xsWord64
+ dump "xs" xs
+ dump "xsInt" xsInt
+ dump "xsIntInteger" xsIntInteger
+ dump "xsInt32" xsInt32
+ dump "xsInt32Integer" xsInt32Integer
+ dump "xsInt64" xsInt64
+ dump "xsInt64Integer" xsInt64Integer
+ dump "xsWord" xsWord
+ dump "xsWordInteger" xsWordInteger
+ dump "xsWord32" xsWord32
+ dump "xsWord32Integer" xsWord32Integer
+ dump "xsWord64" xsWord64
+ dump "xsWord64Integer" xsWord64Integer
+
+test :: String -> Integer -> Integer -> IO ()
+test what want got
+ | want == got = return ()
+ | otherwise = print (what, want, got)
+
diff --git a/testsuite/tests/lib/integer/integerConversions.stdout b/testsuite/tests/lib/integer/integerConversions.stdout
new file mode 100644
index 0000000000..18af7927e1
--- /dev/null
+++ b/testsuite/tests/lib/integer/integerConversions.stdout
@@ -0,0 +1,299 @@
+====================================
+xs
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,18446744073709551616,18446744073709551617,18446744073709551618]
+[36893488147419103230,36893488147419103231,36893488147419103232,36893488147419103233,36893488147419103234]
+[73786976294838206462,73786976294838206463,73786976294838206464,73786976294838206465,73786976294838206466]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[-9223372036854775810,-9223372036854775809,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-18446744073709551618,-18446744073709551617,-18446744073709551616,-18446744073709551615,-18446744073709551614]
+[-36893488147419103234,-36893488147419103233,-36893488147419103232,-36893488147419103231,-36893488147419103230]
+[-73786976294838206466,-73786976294838206465,-73786976294838206464,-73786976294838206463,-73786976294838206462]
+====================================
+xsInt
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsIntInteger
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt32
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt32Integer
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt64
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt64Integer
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsWord
+[4294967294,4294967295,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[3221225470,3221225471,3221225472,3221225473,3221225474]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+====================================
+xsWordInteger
+[4294967294,4294967295,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[3221225470,3221225471,3221225472,3221225473,3221225474]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+====================================
+xsWord32
+[4294967294,4294967295,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[3221225470,3221225471,3221225472,3221225473,3221225474]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+====================================
+xsWord32Integer
+[4294967294,4294967295,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[3221225470,3221225471,3221225472,3221225473,3221225474]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+====================================
+xsWord64
+[18446744073709551614,18446744073709551615,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744072635809790,18446744072635809791,18446744072635809792,18446744072635809793,18446744072635809794]
+[18446744071562067966,18446744071562067967,18446744071562067968,18446744071562067969,18446744071562067970]
+[18446744069414584318,18446744069414584319,18446744069414584320,18446744069414584321,18446744069414584322]
+[18446744065119617022,18446744065119617023,18446744065119617024,18446744065119617025,18446744065119617026]
+[18446744056529682430,18446744056529682431,18446744056529682432,18446744056529682433,18446744056529682434]
+[13835058055282163710,13835058055282163711,13835058055282163712,13835058055282163713,13835058055282163714]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+====================================
+xsWord64Integer
+[18446744073709551614,18446744073709551615,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744072635809790,18446744072635809791,18446744072635809792,18446744072635809793,18446744072635809794]
+[18446744071562067966,18446744071562067967,18446744071562067968,18446744071562067969,18446744071562067970]
+[18446744069414584318,18446744069414584319,18446744069414584320,18446744069414584321,18446744069414584322]
+[18446744065119617022,18446744065119617023,18446744065119617024,18446744065119617025,18446744065119617026]
+[18446744056529682430,18446744056529682431,18446744056529682432,18446744056529682433,18446744056529682434]
+[13835058055282163710,13835058055282163711,13835058055282163712,13835058055282163713,13835058055282163714]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
diff --git a/testsuite/tests/lib/integer/integerConversions.stdout-ws-64 b/testsuite/tests/lib/integer/integerConversions.stdout-ws-64
new file mode 100644
index 0000000000..9dcd6d98c2
--- /dev/null
+++ b/testsuite/tests/lib/integer/integerConversions.stdout-ws-64
@@ -0,0 +1,299 @@
+====================================
+xs
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,18446744073709551616,18446744073709551617,18446744073709551618]
+[36893488147419103230,36893488147419103231,36893488147419103232,36893488147419103233,36893488147419103234]
+[73786976294838206462,73786976294838206463,73786976294838206464,73786976294838206465,73786976294838206466]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[-9223372036854775810,-9223372036854775809,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-18446744073709551618,-18446744073709551617,-18446744073709551616,-18446744073709551615,-18446744073709551614]
+[-36893488147419103234,-36893488147419103233,-36893488147419103232,-36893488147419103231,-36893488147419103230]
+[-73786976294838206466,-73786976294838206465,-73786976294838206464,-73786976294838206463,-73786976294838206462]
+====================================
+xsInt
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsIntInteger
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt32
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt32Integer
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[2147483646,2147483647,-2147483648,-2147483647,-2147483646]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt64
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsInt64Integer
+[-2,-1,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-1073741826,-1073741825,-1073741824,-1073741823,-1073741822]
+[-2147483650,-2147483649,-2147483648,-2147483647,-2147483646]
+[-4294967298,-4294967297,-4294967296,-4294967295,-4294967294]
+[-8589934594,-8589934593,-8589934592,-8589934591,-8589934590]
+[-17179869186,-17179869185,-17179869184,-17179869183,-17179869182]
+[-4611686018427387906,-4611686018427387905,-4611686018427387904,-4611686018427387903,-4611686018427387902]
+[9223372036854775806,9223372036854775807,-9223372036854775808,-9223372036854775807,-9223372036854775806]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+[-2,-1,0,1,2]
+====================================
+xsWord
+[18446744073709551614,18446744073709551615,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744072635809790,18446744072635809791,18446744072635809792,18446744072635809793,18446744072635809794]
+[18446744071562067966,18446744071562067967,18446744071562067968,18446744071562067969,18446744071562067970]
+[18446744069414584318,18446744069414584319,18446744069414584320,18446744069414584321,18446744069414584322]
+[18446744065119617022,18446744065119617023,18446744065119617024,18446744065119617025,18446744065119617026]
+[18446744056529682430,18446744056529682431,18446744056529682432,18446744056529682433,18446744056529682434]
+[13835058055282163710,13835058055282163711,13835058055282163712,13835058055282163713,13835058055282163714]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+====================================
+xsWordInteger
+[18446744073709551614,18446744073709551615,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744072635809790,18446744072635809791,18446744072635809792,18446744072635809793,18446744072635809794]
+[18446744071562067966,18446744071562067967,18446744071562067968,18446744071562067969,18446744071562067970]
+[18446744069414584318,18446744069414584319,18446744069414584320,18446744069414584321,18446744069414584322]
+[18446744065119617022,18446744065119617023,18446744065119617024,18446744065119617025,18446744065119617026]
+[18446744056529682430,18446744056529682431,18446744056529682432,18446744056529682433,18446744056529682434]
+[13835058055282163710,13835058055282163711,13835058055282163712,13835058055282163713,13835058055282163714]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+====================================
+xsWord32
+[4294967294,4294967295,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[3221225470,3221225471,3221225472,3221225473,3221225474]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+====================================
+xsWord32Integer
+[4294967294,4294967295,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[3221225470,3221225471,3221225472,3221225473,3221225474]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+[4294967294,4294967295,0,1,2]
+====================================
+xsWord64
+[18446744073709551614,18446744073709551615,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744072635809790,18446744072635809791,18446744072635809792,18446744072635809793,18446744072635809794]
+[18446744071562067966,18446744071562067967,18446744071562067968,18446744071562067969,18446744071562067970]
+[18446744069414584318,18446744069414584319,18446744069414584320,18446744069414584321,18446744069414584322]
+[18446744065119617022,18446744065119617023,18446744065119617024,18446744065119617025,18446744065119617026]
+[18446744056529682430,18446744056529682431,18446744056529682432,18446744056529682433,18446744056529682434]
+[13835058055282163710,13835058055282163711,13835058055282163712,13835058055282163713,13835058055282163714]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+====================================
+xsWord64Integer
+[18446744073709551614,18446744073709551615,0,1,2]
+[1073741822,1073741823,1073741824,1073741825,1073741826]
+[2147483646,2147483647,2147483648,2147483649,2147483650]
+[4294967294,4294967295,4294967296,4294967297,4294967298]
+[8589934590,8589934591,8589934592,8589934593,8589934594]
+[17179869182,17179869183,17179869184,17179869185,17179869186]
+[4611686018427387902,4611686018427387903,4611686018427387904,4611686018427387905,4611686018427387906]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744072635809790,18446744072635809791,18446744072635809792,18446744072635809793,18446744072635809794]
+[18446744071562067966,18446744071562067967,18446744071562067968,18446744071562067969,18446744071562067970]
+[18446744069414584318,18446744069414584319,18446744069414584320,18446744069414584321,18446744069414584322]
+[18446744065119617022,18446744065119617023,18446744065119617024,18446744065119617025,18446744065119617026]
+[18446744056529682430,18446744056529682431,18446744056529682432,18446744056529682433,18446744056529682434]
+[13835058055282163710,13835058055282163711,13835058055282163712,13835058055282163713,13835058055282163714]
+[9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809,9223372036854775810]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
+[18446744073709551614,18446744073709551615,0,1,2]
diff --git a/testsuite/tests/lib/libposix/Makefile b/testsuite/tests/lib/libposix/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/libposix/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/libposix/posix001.hs b/testsuite/tests/lib/libposix/posix001.hs
new file mode 100644
index 0000000000..ed20df7939
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix001.hs
@@ -0,0 +1,24 @@
+module Main(main) where
+
+import Posix
+
+main :: IO ()
+main = do
+ ppid <- getParentProcessID
+ pid <- getProcessID
+ putStr "Parent Process ID: "
+ print ppid
+ putStr "Process ID: "
+ print pid
+ putStr "forking ps ux"
+ print ppid
+ child <- forkProcess
+ case child of
+ Nothing -> executeFile "ps" True ["ux" ++ show ppid] Nothing
+ Just x -> doParent x pid
+
+doParent cpid pid = do
+ getProcessStatus True False cpid
+ putStr "\nChild finished. Now exec'ing ps ux\n"
+ print pid
+ executeFile "ps" True ["ux" ++ show pid] Nothing
diff --git a/testsuite/tests/lib/libposix/posix001.stdout b/testsuite/tests/lib/libposix/posix001.stdout
new file mode 100644
index 0000000000..c9cd245bbe
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix001.stdout
@@ -0,0 +1,4 @@
+USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
+sof 30160 0.0 0.2 1244 648 p0 S 15:09 0:00 /bin/sh -c ./posix001
+USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
+sof 30161 0.0 0.1 892 336 p0 R 15:09 0:00 ps ux30161
diff --git a/testsuite/tests/lib/libposix/posix002.hs b/testsuite/tests/lib/libposix/posix002.hs
new file mode 100644
index 0000000000..8d01e8b69f
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix002.hs
@@ -0,0 +1,4 @@
+import Posix
+
+main =
+ executeFile "printenv" True [] (Just [("ONE","1"),("TWO","2")])
diff --git a/testsuite/tests/lib/libposix/posix002.stdout b/testsuite/tests/lib/libposix/posix002.stdout
new file mode 100644
index 0000000000..5e17a60f42
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix002.stdout
@@ -0,0 +1,2 @@
+ONE=1
+TWO=2
diff --git a/testsuite/tests/lib/libposix/posix003.hs b/testsuite/tests/lib/libposix/posix003.hs
new file mode 100644
index 0000000000..dbea5e1d9b
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix003.hs
@@ -0,0 +1,6 @@
+import IO
+import Posix
+
+main =
+ openFile "po003.out" WriteMode >>= \ h ->
+ runProcess "pwd" [] Nothing (Just "/usr/tmp") Nothing (Just h) Nothing
diff --git a/testsuite/tests/lib/libposix/posix003.stdout b/testsuite/tests/lib/libposix/posix003.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix003.stdout
diff --git a/testsuite/tests/lib/libposix/posix004.hs b/testsuite/tests/lib/libposix/posix004.hs
new file mode 100644
index 0000000000..2423f3f77a
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix004.hs
@@ -0,0 +1,58 @@
+import Posix
+import System(ExitCode(..), exitWith)
+
+main =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> raiseSignal floatingPointException
+ _ -> doParent
+
+doParent =
+ getAnyProcessStatus True False >>= \ (Just (pid, tc)) ->
+ case tc of
+ Terminated sig | sig == floatingPointException -> forkChild2
+ _ -> fail (userError "unexpected termination cause")
+
+forkChild2 =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> exitImmediately (ExitFailure 42)
+ _ -> doParent2
+
+doParent2 =
+ getAnyProcessStatus True False >>= \ (Just (pid, tc)) ->
+ case tc of
+ Exited (ExitFailure 42) -> forkChild3
+ _ -> fail (userError "unexpected termination cause (2)")
+
+forkChild3 =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> exitImmediately (ExitSuccess)
+ _ -> doParent3
+
+doParent3 =
+ getAnyProcessStatus True False >>= \ (Just (pid, tc)) ->
+ case tc of
+ Exited ExitSuccess -> forkChild4
+ _ -> fail (userError "unexpected termination cause (3)")
+
+forkChild4 =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> raiseSignal softwareStop
+ _ -> doParent4
+
+doParent4 =
+ getAnyProcessStatus True True >>= \ (Just (pid, tc)) ->
+ case tc of
+ Stopped sig | sig == softwareStop -> enoughAlready pid
+ _ -> fail (userError "unexpected termination cause (4)")
+
+enoughAlready pid =
+ signalProcess killProcess pid >>
+ getAnyProcessStatus True True >>= \ (Just (pid, tc)) ->
+ case tc of
+ Terminated sig | sig == killProcess -> putStr "I'm happy.\n"
+ _ -> fail (userError "unexpected termination cause (5)")
+
diff --git a/testsuite/tests/lib/libposix/posix004.stdout b/testsuite/tests/lib/libposix/posix004.stdout
new file mode 100644
index 0000000000..8ed7ee54d5
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix004.stdout
@@ -0,0 +1 @@
+I'm happy.
diff --git a/testsuite/tests/lib/libposix/posix005.hs b/testsuite/tests/lib/libposix/posix005.hs
new file mode 100644
index 0000000000..a53182971a
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix005.hs
@@ -0,0 +1,25 @@
+import Posix
+import IO
+main =
+ hSetBuffering stdout NoBuffering >>
+ getEnvVar "TERM" >>= \ term ->
+ putStrLn term >>
+ setEnvironment [("one","1"),("two","2")] >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvVar "foo" "bar" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvVar "foo" "baz" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvVar "fu" "bar" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ removeEnvVar "foo" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvironment [] >>
+ getEnvironment >>= \ env ->
+ print env
+
diff --git a/testsuite/tests/lib/libposix/posix005.stdout b/testsuite/tests/lib/libposix/posix005.stdout
new file mode 100644
index 0000000000..9896f43da7
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix005.stdout
@@ -0,0 +1,7 @@
+emacs
+[("one","1"),("two","2")]
+[("one","1"),("two","2"),("foo","bar")]
+[("one","1"),("two","2"),("foo","baz")]
+[("one","1"),("two","2"),("foo","baz"),("fu","bar")]
+[("one","1"),("two","2"),("fu","bar")]
+[]
diff --git a/testsuite/tests/lib/libposix/posix006.hs b/testsuite/tests/lib/libposix/posix006.hs
new file mode 100644
index 0000000000..eb6451dd73
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix006.hs
@@ -0,0 +1,14 @@
+import Posix
+
+main =
+ epochTime >>= \ start ->
+ sleep 5 >>
+ let timeleft = 0 in
+ epochTime >>= \ finish ->
+ putStr "Started: " >>
+ print start >>
+ putStr "\nSlept: " >>
+ print (5 - timeleft) >>
+ putStr "\nFinished: " >>
+ print finish >>
+ putChar '\n'
diff --git a/testsuite/tests/lib/libposix/posix006.stdout b/testsuite/tests/lib/libposix/posix006.stdout
new file mode 100644
index 0000000000..d66a4ff4ab
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix006.stdout
@@ -0,0 +1,6 @@
+Started: 902585354
+
+Slept: 5
+
+Finished: 902585359
+
diff --git a/testsuite/tests/lib/libposix/posix007.hs b/testsuite/tests/lib/libposix/posix007.hs
new file mode 100644
index 0000000000..2e62820511
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix007.hs
@@ -0,0 +1,34 @@
+import Posix
+
+-- This test is an example of where something more sophisticated than runstdtest
+-- is required, as its interactive.
+
+main = do
+ installHandler keyboardSignal (Catch doCtrlC) Nothing
+ ta <- getTerminalAttributes stdInput
+ case (controlChar ta Interrupt) of
+ Nothing -> fixMe ta
+ Just x -> continue x
+
+fixMe ta = do
+ putStr "Oops...no interrupt character?\nI can fix that...\n"
+ setTerminalAttributes stdInput (withCC ta (Interrupt, '\ETX')) Immediately
+ ta <- getTerminalAttributes stdInput
+ case (controlChar ta Interrupt) of
+ Nothing -> putStr "...Then again, maybe I can't\n"
+ Just x -> continue x
+
+continue x =
+ putStr "Press '"
+ putStr (ccStr x)
+ putStr "'.\n"
+ awaitSignal Nothing
+ putStr "How did I get here?\n"
+
+doCtrlC =
+ putStr "Caught an interrupt.\n"
+
+ccStr '\DEL' = "^?"
+ccStr x
+ | x >= ' ' = [x]
+ | otherwise = ['^', (toEnum (fromEnum x + fromEnum '@'))]
diff --git a/testsuite/tests/lib/libposix/posix007.stdout b/testsuite/tests/lib/libposix/posix007.stdout
new file mode 100644
index 0000000000..a69478b004
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix007.stdout
@@ -0,0 +1,2 @@
+Press '^C'.
+Caught an interrupt.
diff --git a/testsuite/tests/lib/libposix/posix008.hs b/testsuite/tests/lib/libposix/posix008.hs
new file mode 100644
index 0000000000..249e58eedc
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix008.hs
@@ -0,0 +1,12 @@
+import Posix
+
+main =
+ installHandler realTimeAlarm (Catch alarmclock) Nothing >>
+ putStr "Scheduling an alarm in 5 seconds...\n" >>
+ scheduleAlarm 5 >>
+ putStr "Sleeping one minute.\n" >>
+ sleep 60 >>
+ putStr "How did I get here?\n"
+
+alarmclock =
+ putStr "The alarm went off.\n"
diff --git a/testsuite/tests/lib/libposix/posix008.stdout b/testsuite/tests/lib/libposix/posix008.stdout
new file mode 100644
index 0000000000..582d22b225
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix008.stdout
@@ -0,0 +1,3 @@
+Scheduling an alarm in 5 seconds...
+Sleeping one minute.
+The alarm went off.
diff --git a/testsuite/tests/lib/libposix/posix009.hs b/testsuite/tests/lib/libposix/posix009.hs
new file mode 100644
index 0000000000..1f230f648c
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix009.hs
@@ -0,0 +1,15 @@
+import Posix
+
+main =
+ putStr "Blocking real time alarms.\n" >>
+ blockSignals (addSignal realTimeAlarm emptySignalSet) >>
+ putStr "Scheduling an alarm in 2 seconds...\n" >>
+ scheduleAlarm 2 >>
+ putStr "Sleeping 5 seconds.\n" >>
+ sleep 5 >>
+ putStrLn "Woken up" >>
+ getPendingSignals >>= \ ints ->
+ putStr "Checking pending interrupts for RealTimeAlarm\n" >>
+ print (inSignalSet realTimeAlarm ints) >>
+ putChar '\n'
+
diff --git a/testsuite/tests/lib/libposix/posix009.stdout b/testsuite/tests/lib/libposix/posix009.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix009.stdout
diff --git a/testsuite/tests/lib/libposix/posix010.hs b/testsuite/tests/lib/libposix/posix010.hs
new file mode 100644
index 0000000000..83d5f27ee0
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix010.hs
@@ -0,0 +1,24 @@
+import Posix
+
+main =
+ getUserEntryForName "sof" >>= \ sof ->
+ getUserEntryForName "partain" >>= \ partain ->
+ putStr (ue2String sof) >>
+ putChar '\n' >>
+ putStr (ue2String partain) >>
+ putChar '\n' >>
+ getUserEntryForID (userID sof) >>= \ muid ->
+ getUserEntryForID (userID partain) >>= \ puid ->
+ putStr (ue2String muid) >>
+ putChar '\n' >>
+ putStr (ue2String puid) >>
+ putChar '\n'
+
+ue2String ue =
+ name ++ (':' : (show uid) ++ (':' : (show gid) ++ (':' : home ++ (':' : shell))))
+ where
+ name = userName ue
+ uid = userID ue
+ gid = userGroupID ue
+ home = homeDirectory ue
+ shell = userShell ue
diff --git a/testsuite/tests/lib/libposix/posix010.stdout b/testsuite/tests/lib/libposix/posix010.stdout
new file mode 100644
index 0000000000..ec1d729853
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix010.stdout
@@ -0,0 +1,4 @@
+mattson:104:401:/users/fp/mattson:/bin/csh
+partain:184:401:/users/fp/partain:/usr/local/bin/tcsh
+mattson:104:401:/users/fp/mattson:/bin/csh
+partain:184:401:/users/fp/partain:/usr/local/bin/tcsh
diff --git a/testsuite/tests/lib/libposix/posix011.hs b/testsuite/tests/lib/libposix/posix011.hs
new file mode 100644
index 0000000000..f8baf1cbc2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix011.hs
@@ -0,0 +1,22 @@
+import Posix
+
+main =
+ getGroupEntryForName "grasp" >>= \ grasp ->
+ getGroupEntryForName "staff" >>= \ staff ->
+ putStr (ge2String grasp) >>
+ putChar '\n' >>
+ putStr (ge2String staff) >>
+ putChar '\n' >>
+ getGroupEntryForID (groupID grasp) >>= \ guid ->
+ getGroupEntryForID (groupID staff) >>= \ suid ->
+ putStr (ge2String guid) >>
+ putChar '\n' >>
+ putStr (ge2String suid) >>
+ putChar '\n'
+
+ge2String ge =
+ name ++ (':' : (show gid) ++ (':' : members))
+ where
+ name = groupName ge
+ gid = groupID ge
+ members = foldr (\x y -> x ++ (',' : y)) "" (groupMembers ge)
diff --git a/testsuite/tests/lib/libposix/posix011.stdout b/testsuite/tests/lib/libposix/posix011.stdout
new file mode 100644
index 0000000000..11b5df4f1b
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix011.stdout
@@ -0,0 +1,4 @@
+grasp:401:andre,andy,ap,areid,cvh,dm,dnt,gnik,grasp,hwloidl,jan,johan,jonathan,jtod,kh,laszlo,mattson,partain,sansom,satnam,sewardj,sharpkm,simonm,simonpj,sof,trinder,wadler,
+staff:9:aileen,alexa,ali,alison,andy,anne,ansftp,aran,arthur,audit,bill,botech,bw,carol,carron,cathy,conftp,cs2head,cvh,dam,darryn,daw,dcg,debbie,del,deptlib,dkm,dlg,dm,dnt,ellen,f131mgr,fabio,fairouz,faxback,fido,finance,fiona,footsie,george,gilbert,gilles,gsm,handbook,harrismi,helen,hme,hmg,huw,iain,id,igr,iii,imis-doc,imm,inei,infoman,ingres,inventdb,irfest,isabel,jacksonn,jacqui,james,janice,jej,jim,jl,jmm,johnson,jon,jstack,jtod,jwp,keith,kempj,kh,kieran,kimb,kirsten,kmssys,laurent,lewis,lisa,lizbeth,logiej,love,lyons,maclib,macneisd,margaret,mark,mary,mattson,meurig,mjj,mmi,monica,mossin,mpa,muffy,nk,norman,partain,pd,pdg,pete,pp,ps,quintin,rab,ray,rdm,reh,replib,rff,rffingres,rich,rios,rjw,rn,ron,ruffin,rwi,sanderso,sandy,sansom,satnam,sheila,sid,simonm,simonpj,slurry,softlib,stephen,steve,stevem,stuart,support,susan,tania,tech,teresa,tfm,tommyk,tracy,trinder,types,typesftp,wadler,wf,xadmin,
+grasp:401:andre,andy,ap,areid,cvh,dm,dnt,gnik,grasp,hwloidl,jan,johan,jonathan,jtod,kh,laszlo,mattson,partain,sansom,satnam,sewardj,sharpkm,simonm,simonpj,sof,trinder,wadler,
+staff:9:aileen,alexa,ali,alison,andy,anne,ansftp,aran,arthur,audit,bill,botech,bw,carol,carron,cathy,conftp,cs2head,cvh,dam,darryn,daw,dcg,debbie,del,deptlib,dkm,dlg,dm,dnt,ellen,f131mgr,fabio,fairouz,faxback,fido,finance,fiona,footsie,george,gilbert,gilles,gsm,handbook,harrismi,helen,hme,hmg,huw,iain,id,igr,iii,imis-doc,imm,inei,infoman,ingres,inventdb,irfest,isabel,jacksonn,jacqui,james,janice,jej,jim,jl,jmm,johnson,jon,jstack,jtod,jwp,keith,kempj,kh,kieran,kimb,kirsten,kmssys,laurent,lewis,lisa,lizbeth,logiej,love,lyons,maclib,macneisd,margaret,mark,mary,mattson,meurig,mjj,mmi,monica,mossin,mpa,muffy,nk,norman,partain,pd,pdg,pete,pp,ps,quintin,rab,ray,rdm,reh,replib,rff,rffingres,rich,rios,rjw,rn,ron,ruffin,rwi,sanderso,sandy,sansom,satnam,sheila,sid,simonm,simonpj,slurry,softlib,stephen,steve,stevem,stuart,support,susan,tania,tech,teresa,tfm,tommyk,tracy,trinder,types,typesftp,wadler,wf,xadmin,
diff --git a/testsuite/tests/lib/libposix/posix012.hs b/testsuite/tests/lib/libposix/posix012.hs
new file mode 100644
index 0000000000..87f002a6cd
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix012.hs
@@ -0,0 +1,59 @@
+import Posix
+import IO -- 1.3
+
+main =
+ createFile "po012.out" stdFileMode >>= \ fd ->
+ installHandler processStatusChanged (Catch (reap1 fd)) Nothing >>
+ ls >>
+ awaitSignal Nothing
+
+ls =
+ runProcess "ls" ["-l"] Nothing Nothing Nothing Nothing Nothing
+
+reap1 fd =
+ hPutStrLn stderr "Reaper1" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap2 fd)) Nothing >>
+ fdWrite fd (take 666 (repeat 'x')) >>
+ ls >>
+ awaitSignal Nothing
+
+reap2 fd =
+ hPutStrLn stderr "Reaper2" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap3 fd)) Nothing >>
+ setFileMode "po012.out"
+ (foldr1 unionFileModes [ownerReadMode,ownerWriteMode,groupReadMode,otherReadMode]) >>
+ ls >>
+ awaitSignal Nothing
+
+reap3 fd =
+ hPutStrLn stderr "Reaper3" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap4 fd)) Nothing >>
+ setFileTimes "po012.out" 0 0 >>
+ ls >>
+ awaitSignal Nothing
+
+reap4 fd =
+ hPutStrLn stderr "Reaper4" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap5 fd)) Nothing >>
+ --removeLink "po012.out" >>
+ ls >>
+ awaitSignal Nothing
+
+reap5 fd =
+ hPutStrLn stderr "Reaper5" >>
+ getAnyProcessStatus True False >>
+ fdSeek fd SeekFromEnd 0 >>= \ bytes ->
+ if bytes == 666 then
+ fdSeek fd AbsoluteSeek 0 >>
+ hPutStrLn stderr "Reaper5" >>
+ fdRead fd 666 >>= \ (str, _) ->
+ if str == (take 666 (repeat 'x')) then
+ putStr "Okay\n"
+ else
+ putStr "Read failed\n"
+ else
+ putStr "Seek returned wrong size\n"
diff --git a/testsuite/tests/lib/libposix/posix012.stdout b/testsuite/tests/lib/libposix/posix012.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix012.stdout
diff --git a/testsuite/tests/lib/libposix/posix013.hs b/testsuite/tests/lib/libposix/posix013.hs
new file mode 100644
index 0000000000..b78930b44e
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix013.hs
@@ -0,0 +1,21 @@
+--!! Querying for system information.
+module Main(main) where
+
+import Posix
+
+main = do
+ sid <- getSystemID
+ let
+ info =
+ [ "Node Name: " , nodeName sid
+ , "OS: " , systemName sid
+ , "Arch: " , machine sid
+ , "Version: " , version sid
+ , "Release: " , release sid
+ ]
+ putStrLn2 info
+
+putStrLn2 :: [String] -> IO ()
+putStrLn2 [] = return ()
+putStrLn2 [x] = putStrLn x
+putStrLn2 (x1:x2:xs) = putStrLn (x1++x2) >> putStrLn2 xs
diff --git a/testsuite/tests/lib/libposix/posix014.hs b/testsuite/tests/lib/libposix/posix014.hs
new file mode 100644
index 0000000000..bb3518c440
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix014.hs
@@ -0,0 +1,19 @@
+--!! Basic pipe usage
+module Main(main) where
+
+import Posix
+
+main = do
+ str <- getEffectiveUserName
+ putStrLn str
+ (rd, wd) <- createPipe
+ n <- forkProcess
+ case n of
+ Nothing -> do
+ (str,_) <- fdRead rd 32
+ -- avoid them zombies
+ putStrLn str
+ Just pid -> do
+ fdWrite wd "Hi, there - forked child calling"
+-- getProcessStatus False True pid
+ return ()
diff --git a/testsuite/tests/lib/should_run/4006.hs b/testsuite/tests/lib/should_run/4006.hs
new file mode 100644
index 0000000000..662b0f62e3
--- /dev/null
+++ b/testsuite/tests/lib/should_run/4006.hs
@@ -0,0 +1,8 @@
+import System.Process
+
+testUnicode :: String -> IO String
+testUnicode str = readProcess "printf" ["%s", str] ""
+
+main = do
+ testUnicode "It works here" >>= putStrLn
+ testUnicode "РздеÑÑŒ ÑломалоÑÑŒ" >>= putStrLn
diff --git a/testsuite/tests/lib/should_run/4006.stdout b/testsuite/tests/lib/should_run/4006.stdout
new file mode 100644
index 0000000000..9db8a8ced2
--- /dev/null
+++ b/testsuite/tests/lib/should_run/4006.stdout
@@ -0,0 +1,2 @@
+It works here
+РздеÑÑŒ ÑломалоÑÑŒ
diff --git a/testsuite/tests/lib/should_run/Makefile b/testsuite/tests/lib/should_run/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/should_run/Memo1.lhs b/testsuite/tests/lib/should_run/Memo1.lhs
new file mode 100644
index 0000000000..796f6121e4
--- /dev/null
+++ b/testsuite/tests/lib/should_run/Memo1.lhs
@@ -0,0 +1,142 @@
+% $Id: Memo.lhs,v 1.1 2005/12/16 10:46:05 simonmar Exp $
+%
+% (c) The GHC Team, 1999
+%
+% Hashing memo tables.
+
+\begin{code}
+{-# LANGUAGE CPP #-}
+
+module Memo1
+ {-# DEPRECATED "This module is unmaintained, and will disappear soon" #-}
+#ifndef __PARALLEL_HASKELL__
+ ( memo -- :: (a -> b) -> a -> b
+ , memoSized -- :: Int -> (a -> b) -> a -> b
+ )
+#endif
+ where
+
+#ifndef __PARALLEL_HASKELL__
+
+import System.Mem.StableName ( StableName, makeStableName, hashStableName )
+import System.Mem.Weak ( Weak, mkWeakPtr, mkWeak, deRefWeak, finalize )
+import Data.Array.IO ( IOArray, newArray, readArray, writeArray )
+import System.IO.Unsafe ( unsafePerformIO )
+import Control.Concurrent.MVar ( MVar, newMVar, putMVar, takeMVar )
+\end{code}
+
+-----------------------------------------------------------------------------
+Memo table representation.
+
+The representation is this: a fixed-size hash table where each bucket
+is a list of table entries, of the form (key,value).
+
+The key in this case is (StableName key), and we use hashStableName to
+hash it.
+
+It's important that we can garbage collect old entries in the table
+when the key is no longer reachable in the heap. Hence the value part
+of each table entry is (Weak val), where the weak pointer "key" is the
+key for our memo table, and 'val' is the value of this memo table
+entry. When the key becomes unreachable, a finalizer will fire and
+remove this entry from the hash bucket, and further attempts to
+dereference the weak pointer will return Nothing. References from
+'val' to the key are ignored (see the semantics of weak pointers in
+the documentation).
+
+\begin{code}
+type MemoTable key val
+ = MVar (
+ Int, -- current table size
+ IOArray Int [MemoEntry key val] -- hash table
+ )
+
+-- a memo table entry: compile with -funbox-strict-fields to eliminate
+-- the boxes around the StableName and Weak fields.
+data MemoEntry key val = MemoEntry !(StableName key) !(Weak val)
+\end{code}
+
+We use an MVar to the hash table, so that several threads may safely
+access it concurrently. This includes the finalization threads that
+remove entries from the table.
+
+ToDo: Can efficiency be improved at all?
+
+\begin{code}
+memo :: (a -> b) -> a -> b
+memo f = memoSized default_table_size f
+
+default_table_size = 1001
+
+-- Our memo functions are *strict*. Lazy memo functions tend to be
+-- less useful because it is less likely you'll get a memo table hit
+-- for a thunk. This change was made to match Hugs's Memo
+-- implementation, and as the result of feedback from Conal Elliot
+-- <conal@microsoft.com>.
+
+memoSized :: Int -> (a -> b) -> a -> b
+memoSized size f = strict (lazyMemoSized size f)
+
+strict = ($!)
+
+lazyMemoSized :: Int -> (a -> b) -> a -> b
+lazyMemoSized size f =
+ let (table,weak) = unsafePerformIO (
+ do { tbl <- newArray (0,size) []
+ ; mvar <- newMVar (size,tbl)
+ ; weak <- mkWeakPtr mvar (Just (table_finalizer tbl size))
+ ; return (mvar,weak)
+ })
+ in memo' f table weak
+
+table_finalizer :: IOArray Int [MemoEntry key val] -> Int -> IO ()
+table_finalizer table size =
+ sequence_ [ finalizeBucket i | i <- [0..size] ]
+ where
+ finalizeBucket i = do
+ bucket <- readArray table i
+ sequence_ [ finalize w | MemoEntry _ w <- bucket ]
+
+memo' :: (a -> b) -> MemoTable a b -> Weak (MemoTable a b) -> a -> b
+memo' f ref weak_ref = \k -> unsafePerformIO $ do
+ stable_key <- makeStableName k
+ (size, table) <- takeMVar ref
+ let hash_key = hashStableName stable_key `mod` size
+ bucket <- readArray table hash_key
+ lkp <- lookupSN stable_key bucket
+
+ case lkp of
+ Just result -> do
+ putMVar ref (size,table)
+ return result
+ Nothing -> do
+ let result = f k
+ weak <- mkWeak k result (Just (finalizer hash_key stable_key weak_ref))
+ writeArray table hash_key (MemoEntry stable_key weak : bucket)
+ putMVar ref (size,table)
+ return result
+
+finalizer :: Int -> StableName a -> Weak (MemoTable a b) -> IO ()
+finalizer hash_key stable_key weak_ref =
+ do r <- deRefWeak weak_ref
+ case r of
+ Nothing -> return ()
+ Just mvar -> do
+ (size,table) <- takeMVar mvar
+ bucket <- readArray table hash_key
+ let new_bucket = [ e | e@(MemoEntry sn weak) <- bucket,
+ sn /= stable_key ]
+ writeArray table hash_key new_bucket
+ putMVar mvar (size,table)
+
+lookupSN :: StableName key -> [MemoEntry key val] -> IO (Maybe val)
+lookupSN sn [] = sn `seq` return Nothing -- make it strict in sn
+lookupSN sn (MemoEntry sn' weak : xs)
+ | sn == sn' = do maybe_item <- deRefWeak weak
+ case maybe_item of
+ Nothing -> error ("dead weak pair: " ++
+ show (hashStableName sn))
+ Just v -> return (Just v)
+ | otherwise = lookupSN sn xs
+#endif
+\end{code}
diff --git a/testsuite/tests/lib/should_run/Memo2.lhs b/testsuite/tests/lib/should_run/Memo2.lhs
new file mode 100644
index 0000000000..5193ec2899
--- /dev/null
+++ b/testsuite/tests/lib/should_run/Memo2.lhs
@@ -0,0 +1,142 @@
+% $Id: Memo.lhs,v 1.1 2005/12/16 10:46:05 simonmar Exp $
+%
+% (c) The GHC Team, 1999
+%
+% Hashing memo tables.
+
+\begin{code}
+{-# LANGUAGE CPP #-}
+
+module Memo2
+ {-# DEPRECATED "This module is unmaintained, and will disappear soon" #-}
+#ifndef __PARALLEL_HASKELL__
+ ( memo -- :: (a -> b) -> a -> b
+ , memoSized -- :: Int -> (a -> b) -> a -> b
+ )
+#endif
+ where
+
+#ifndef __PARALLEL_HASKELL__
+
+import System.Mem.StableName ( StableName, makeStableName, hashStableName )
+import System.Mem.Weak ( Weak, mkWeakPtr, mkWeak, deRefWeak, finalize )
+import Data.Array.IO ( IOArray, newArray, readArray, writeArray )
+import System.IO.Unsafe ( unsafePerformIO )
+import Control.Concurrent.MVar ( MVar, newMVar, putMVar, takeMVar )
+\end{code}
+
+-----------------------------------------------------------------------------
+Memo table representation.
+
+The representation is this: a fixed-size hash table where each bucket
+is a list of table entries, of the form (key,value).
+
+The key in this case is (StableName key), and we use hashStableName to
+hash it.
+
+It's important that we can garbage collect old entries in the table
+when the key is no longer reachable in the heap. Hence the value part
+of each table entry is (Weak val), where the weak pointer "key" is the
+key for our memo table, and 'val' is the value of this memo table
+entry. When the key becomes unreachable, a finalizer will fire and
+remove this entry from the hash bucket, and further attempts to
+dereference the weak pointer will return Nothing. References from
+'val' to the key are ignored (see the semantics of weak pointers in
+the documentation).
+
+\begin{code}
+type MemoTable key val
+ = MVar (
+ Int, -- current table size
+ IOArray Int [MemoEntry key val] -- hash table
+ )
+
+-- a memo table entry: compile with -funbox-strict-fields to eliminate
+-- the boxes around the StableName and Weak fields.
+data MemoEntry key val = MemoEntry !(StableName key) !(Weak val)
+\end{code}
+
+We use an MVar to the hash table, so that several threads may safely
+access it concurrently. This includes the finalization threads that
+remove entries from the table.
+
+ToDo: Can efficiency be improved at all?
+
+\begin{code}
+memo :: (a -> b) -> a -> b
+memo f = memoSized default_table_size f
+
+default_table_size = 1001
+
+-- Our memo functions are *strict*. Lazy memo functions tend to be
+-- less useful because it is less likely you'll get a memo table hit
+-- for a thunk. This change was made to match Hugs's Memo
+-- implementation, and as the result of feedback from Conal Elliot
+-- <conal@microsoft.com>.
+
+memoSized :: Int -> (a -> b) -> a -> b
+memoSized size f = strict (lazyMemoSized size f)
+
+strict = ($!)
+
+lazyMemoSized :: Int -> (a -> b) -> a -> b
+lazyMemoSized size f =
+ let (table,weak) = unsafePerformIO (
+ do { tbl <- newArray (0,size) []
+ ; mvar <- newMVar (size,tbl)
+ ; weak <- mkWeakPtr mvar (Just (table_finalizer tbl size))
+ ; return (mvar,weak)
+ })
+ in memo' f table weak
+
+table_finalizer :: IOArray Int [MemoEntry key val] -> Int -> IO ()
+table_finalizer table size =
+ sequence_ [ finalizeBucket i | i <- [0..size] ]
+ where
+ finalizeBucket i = do
+ bucket <- readArray table i
+ sequence_ [ finalize w | MemoEntry _ w <- bucket ]
+
+memo' :: (a -> b) -> MemoTable a b -> Weak (MemoTable a b) -> a -> b
+memo' f ref weak_ref = \k -> unsafePerformIO $ do
+ stable_key <- makeStableName k
+ (size, table) <- takeMVar ref
+ let hash_key = hashStableName stable_key `mod` size
+ bucket <- readArray table hash_key
+ lkp <- lookupSN stable_key bucket
+
+ case lkp of
+ Just result -> do
+ putMVar ref (size,table)
+ return result
+ Nothing -> do
+ let result = f k
+ weak <- mkWeak k result (Just (finalizer hash_key stable_key weak_ref))
+ writeArray table hash_key (MemoEntry stable_key weak : bucket)
+ putMVar ref (size,table)
+ return result
+
+finalizer :: Int -> StableName a -> Weak (MemoTable a b) -> IO ()
+finalizer hash_key stable_key weak_ref =
+ do r <- deRefWeak weak_ref
+ case r of
+ Nothing -> return ()
+ Just mvar -> do
+ (size,table) <- takeMVar mvar
+ bucket <- readArray table hash_key
+ let new_bucket = [ e | e@(MemoEntry sn weak) <- bucket,
+ sn /= stable_key ]
+ writeArray table hash_key new_bucket
+ putMVar mvar (size,table)
+
+lookupSN :: StableName key -> [MemoEntry key val] -> IO (Maybe val)
+lookupSN sn [] = sn `seq` return Nothing -- make it strict in sn
+lookupSN sn (MemoEntry sn' weak : xs)
+ | sn == sn' = do maybe_item <- deRefWeak weak
+ case maybe_item of
+ Nothing -> error ("dead weak pair: " ++
+ show (hashStableName sn))
+ Just v -> return (Just v)
+ | otherwise = lookupSN sn xs
+#endif
+\end{code}
diff --git a/testsuite/tests/lib/should_run/addr001.hs b/testsuite/tests/lib/should_run/addr001.hs
new file mode 100644
index 0000000000..436a066063
--- /dev/null
+++ b/testsuite/tests/lib/should_run/addr001.hs
@@ -0,0 +1,10 @@
+-- !!! Testing that Show for Addr is OK..
+module Main(main) where
+
+import Foreign.Ptr
+
+main :: IO ()
+main = do
+ print (nullPtr `plusPtr` maxBound)
+ print (nullPtr `plusPtr` minBound)
+
diff --git a/testsuite/tests/lib/should_run/addr001.stdout b/testsuite/tests/lib/should_run/addr001.stdout
new file mode 100644
index 0000000000..e098b1be49
--- /dev/null
+++ b/testsuite/tests/lib/should_run/addr001.stdout
@@ -0,0 +1,2 @@
+0x7fffffff
+0x80000000
diff --git a/testsuite/tests/lib/should_run/addr001.stdout-alpha-dec-osf3 b/testsuite/tests/lib/should_run/addr001.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..f38ea71861
--- /dev/null
+++ b/testsuite/tests/lib/should_run/addr001.stdout-alpha-dec-osf3
@@ -0,0 +1,2 @@
+0x7fffffffffffffff
+0x8000000000000000
diff --git a/testsuite/tests/lib/should_run/addr001.stdout-mips-sgi-irix b/testsuite/tests/lib/should_run/addr001.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..f38ea71861
--- /dev/null
+++ b/testsuite/tests/lib/should_run/addr001.stdout-mips-sgi-irix
@@ -0,0 +1,2 @@
+0x7fffffffffffffff
+0x8000000000000000
diff --git a/testsuite/tests/lib/should_run/addr001.stdout-ws-64 b/testsuite/tests/lib/should_run/addr001.stdout-ws-64
new file mode 100644
index 0000000000..f38ea71861
--- /dev/null
+++ b/testsuite/tests/lib/should_run/addr001.stdout-ws-64
@@ -0,0 +1,2 @@
+0x7fffffffffffffff
+0x8000000000000000
diff --git a/testsuite/tests/lib/should_run/addr001.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/should_run/addr001.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..f38ea71861
--- /dev/null
+++ b/testsuite/tests/lib/should_run/addr001.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,2 @@
+0x7fffffffffffffff
+0x8000000000000000
diff --git a/testsuite/tests/lib/should_run/all.T b/testsuite/tests/lib/should_run/all.T
new file mode 100644
index 0000000000..502f868e7f
--- /dev/null
+++ b/testsuite/tests/lib/should_run/all.T
@@ -0,0 +1,70 @@
+test('array001', normal, compile_and_run, [''])
+
+test('char001', normal, compile_and_run, [''])
+test('char002', normal, compile_and_run, [''])
+
+test('cstring001', normal, compile_and_run, [''])
+
+test('length001',
+ # This fails without -O, as it relies on a RULE being applied
+ expect_fail_for(['normal', 'threaded1', 'llvm']),
+ compile_and_run,
+ [''])
+
+test('ratio001', normal, compile_and_run, [''])
+
+test('rand001', reqlib('random'), compile_and_run, [''])
+test('reads001', normal, compile_and_run, [''])
+test('show001', normal, compile_and_run, [''])
+test('text001', normal, compile_and_run, [''])
+
+test('tup001', normal, compile_and_run, [''])
+
+test('addr001', normal, compile_and_run, [''])
+test('dynamic001', normal, compile_and_run, [''])
+test('dynamic002', normal, compile_and_run, [''])
+test('dynamic003', extra_run_opts('+RTS -K32m -RTS'), compile_and_run, [''])
+test('dynamic004', normal, compile_and_run, [''])
+test('dynamic005', normal, compile_and_run, [''])
+test('enum01', skip_if_fast, compile_and_run, ['-cpp'])
+test('enum02', skip_if_fast, compile_and_run, ['-cpp'])
+test('enum03', skip_if_fast, compile_and_run, ['-cpp'])
+test('enum04', normal, compile_and_run, [''])
+test('exceptionsrun001', normal, compile_and_run, [''])
+test('exceptionsrun002', normal, compile_and_run, [''])
+test('list001' , skip_if_fast, compile_and_run, [''])
+test('list002', skip_if_fast, compile_and_run, [''])
+test('list003', skip_if_fast, compile_and_run, [''])
+
+test('memo001',
+ [skip_if_fast,
+ extra_run_opts('+RTS -A10k -RTS'),
+ extra_clean(['Memo1.hi', 'Memo1.o'])],
+ multimod_compile_and_run,
+ ['memo001',''])
+
+test('memo002',
+ [skip_if_fast,
+ extra_run_opts('20'),
+ extra_clean(['Memo2.hi', 'Memo2.o'])],
+ multimod_compile_and_run, ['memo002',''])
+
+test('packedstring001', reqlib('packedstring'), compile_and_run, ['-package packedstring'])
+
+test('stableptr001',
+ [skip_if_fast, extra_run_opts('+RTS -K8m -RTS')],
+ compile_and_run, [''])
+test('stableptr003', normal, compile_and_run, [''])
+test('stableptr004', extra_run_opts('+RTS -K4m -RTS'), compile_and_run, [''])
+test('stableptr005', normal, compile_and_run, [''])
+
+test('weak001', normal, compile_and_run, [''])
+
+# In the 65001 codepage, we can't even cat the expected output on msys:
+# $ cat 4006.stdout
+# It works here
+# cat: write error: Permission denied
+# Seems to be a known problem, e.g.
+# http://mingw-users.1079350.n2.nabble.com/Bug-re-Unicode-on-the-console-td3121717.html
+test('4006', if_msys(expect_fail), compile_and_run, [''])
+
diff --git a/testsuite/tests/lib/should_run/array001.hs b/testsuite/tests/lib/should_run/array001.hs
new file mode 100644
index 0000000000..b5839b9d53
--- /dev/null
+++ b/testsuite/tests/lib/should_run/array001.hs
@@ -0,0 +1,34 @@
+-- !!! Testing that #4827 is fixed (hPutArray/hGetArray use count argument)
+module Main(main) where
+
+import Control.Monad
+
+import Data.Array.MArray
+import Data.Array.IO
+
+import System.IO
+
+main :: IO ()
+main = do
+ the_array <- newListArray (0, 11) [1..12]
+
+ -- Write out almost all of the array
+ h_out <- openBinaryFile "array001.data" WriteMode
+ hPutArray h_out the_array 11
+ hClose h_out
+
+
+ the_array <- newListArray (0, 11) [0 | i <- [1..12]]
+
+ -- Read in almost all of the array
+ h_in <- openBinaryFile "array001.data" ReadMode
+ wrote_size <- hFileSize h_in
+ hGetArray h_in the_array 10
+ hClose h_in
+
+
+ read_elems <- getElems the_array
+
+
+ print wrote_size -- Bytes written, should == 11
+ print read_elems -- Bytes read, should match written array in first 10 bytes, be 0 afterwards
diff --git a/testsuite/tests/lib/should_run/array001.stdout b/testsuite/tests/lib/should_run/array001.stdout
new file mode 100644
index 0000000000..7c9b768654
--- /dev/null
+++ b/testsuite/tests/lib/should_run/array001.stdout
@@ -0,0 +1,2 @@
+11
+[1,2,3,4,5,6,7,8,9,10,0,0]
diff --git a/testsuite/tests/lib/should_run/char001.hs b/testsuite/tests/lib/should_run/char001.hs
new file mode 100644
index 0000000000..2fb0edce0f
--- /dev/null
+++ b/testsuite/tests/lib/should_run/char001.hs
@@ -0,0 +1,43 @@
+-- !!! Testing the behaviour of Char.lexLitChar a little..
+
+-- [March 2003] We now allow \X and \O as escapes although the
+-- spec only permits \x and \o. Seems more consistent.
+
+module Main where
+
+import Data.Char
+
+lex' str = do
+ putStr ("lex " ++ str ++ " = ")
+ print (lex str)
+
+hexes = do
+ lex' "'\\X00'"
+ lex' "'\\x0f2'"
+ lex' "'\\xf2'"
+ lex' "'\\xf2t'"
+ lex' "'\\X24'"
+ lex' "'\\x24b'"
+ lex' "'\\Xa4b'"
+ lex' "'\\xa4bg'"
+
+octs = do
+ lex' "'\\o00'"
+ lex' "'\\o05'"
+ lex' "'\\o50'"
+ lex' "'\\o72'"
+ lex' "'\\o82'"
+ lex' "'\\O24'"
+ lex' "'\\O000024'"
+ lex' "'\\024b'"
+ lex' "'\\o14b'"
+ lex' "'\\0a4bg'"
+
+main = do
+ hexes
+ octs
+
+
+
+
+
diff --git a/testsuite/tests/lib/should_run/char001.stdout b/testsuite/tests/lib/should_run/char001.stdout
new file mode 100644
index 0000000000..0c13ac7c03
--- /dev/null
+++ b/testsuite/tests/lib/should_run/char001.stdout
@@ -0,0 +1,18 @@
+lex '\X00' = [("'\\X00'","")]
+lex '\x0f2' = [("'\\x0f2'","")]
+lex '\xf2' = [("'\\xf2'","")]
+lex '\xf2t' = []
+lex '\X24' = [("'\\X24'","")]
+lex '\x24b' = [("'\\x24b'","")]
+lex '\Xa4b' = [("'\\Xa4b'","")]
+lex '\xa4bg' = []
+lex '\o00' = [("'\\o00'","")]
+lex '\o05' = [("'\\o05'","")]
+lex '\o50' = [("'\\o50'","")]
+lex '\o72' = [("'\\o72'","")]
+lex '\o82' = []
+lex '\O24' = [("'\\O24'","")]
+lex '\O000024' = [("'\\O000024'","")]
+lex '\024b' = []
+lex '\o14b' = []
+lex '\0a4bg' = []
diff --git a/testsuite/tests/lib/should_run/char002.hs b/testsuite/tests/lib/should_run/char002.hs
new file mode 100644
index 0000000000..60b8b03cda
--- /dev/null
+++ b/testsuite/tests/lib/should_run/char002.hs
@@ -0,0 +1,7 @@
+-- !!! tests for large character values in literals
+import Data.Char
+main = do
+ print (ord '\xffff')
+ print (ord '\o7777')
+ print (ord '\65535')
+ print (map ord "\xffff\o7777\65535")
diff --git a/testsuite/tests/lib/should_run/char002.stdout b/testsuite/tests/lib/should_run/char002.stdout
new file mode 100644
index 0000000000..5190ad9c53
--- /dev/null
+++ b/testsuite/tests/lib/should_run/char002.stdout
@@ -0,0 +1,4 @@
+65535
+4095
+65535
+[65535,4095,65535]
diff --git a/testsuite/tests/lib/should_run/cstring001.hs b/testsuite/tests/lib/should_run/cstring001.hs
new file mode 100644
index 0000000000..38d0d25db2
--- /dev/null
+++ b/testsuite/tests/lib/should_run/cstring001.hs
@@ -0,0 +1,18 @@
+import Control.Monad
+import Foreign.C.String
+
+test_strings = ["Hello World", replicate 10000 'a']
+
+assertEqual :: (Eq a, Show a) => a -> a -> IO ()
+assertEqual x y = if x == y then return () else error $ "assertEqual: " ++ show x ++ " /= " ++ show y
+
+main = do
+ -- Try roundtripping some ASCII strings through the locale encoding
+ forM test_strings $ \try_str -> do
+ got_str <- withCString try_str peekCString
+ got_str `assertEqual` try_str
+
+ -- Try roundtripping some ASCII strings with lengths through the locale encoding
+ forM test_strings $ \try_str -> do
+ got_str <- withCStringLen try_str peekCStringLen
+ got_str `assertEqual` try_str
diff --git a/testsuite/tests/lib/should_run/dynamic001.hs b/testsuite/tests/lib/should_run/dynamic001.hs
new file mode 100644
index 0000000000..7a3fd515e9
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic001.hs
@@ -0,0 +1,107 @@
+-- !!! Dynamic library regression tests
+module Main(main) where
+
+import Data.Dynamic
+
+main :: IO ()
+main = do
+ test "toDyn" toDyn_list
+ testIO "fromDyn" fromDyn_test
+
+toDyn_list :: [Dynamic]
+toDyn_list =
+ [ toDyn (1::Int)
+ , toDyn ('a')
+ , toDyn False
+ , toDyn ((-1.0)::Float)
+ , toDyn (0.0::Double)
+ , toDyn (1394::Integer)
+ , toDyn (print "hello")
+ , toDyn toDyn_list
+ , toDyn ([]::[Int])
+ , toDyn (Nothing :: Maybe Int)
+ , toDyn ((Just 2) :: Maybe Int)
+ , toDyn ((Just 2) :: Maybe Int)
+ , toDyn ((Left 3) :: Either Int Bool)
+ , toDyn ((Right 3) :: Either Char Int)
+ , toDyn ()
+ , toDyn LT
+ , toDyn ((),2::Int)
+ , toDyn ((),2::Int,'a')
+ , toDyn ((),2::Int,'a',1.0::Double)
+ , toDyn ((),2::Int,'a',1.0::Double,Nothing::Maybe Bool)
+ , toDyn ((+) :: Int -> Int -> Int)
+ , toDyn ((+) :: Integer -> Integer -> Integer)
+ , toDyn ((++) :: [Char] -> [Char] -> [Char])
+ ]
+
+-- Testing the conversion from Dynamic values:
+fromDyn_test :: IO ()
+fromDyn_test = do
+ print (fromDyn (toDyn (1::Int)) (0::Int))
+ print (fromDyn (toDyn ('a'::Char)) (0::Int))
+ print (fromDyn (toDyn 'a') 'b')
+ print (fromDyn (toDyn (1::Float)) (0::Float))
+ print (fromDyn (toDyn (2::Float)) (0::Int))
+ print (fromDyn (toDyn (3::Double)) (0::Double))
+ print (fromDyn (toDyn (4::Double)) (0::Int))
+ print (fromDyn (toDyn (5::Integer)) (0::Integer))
+ print (fromDyn (toDyn (6::Integer)) False)
+ print (fromDyn (toDyn [1,3,5::Integer]) ([]::[Integer]))
+ print (fromDyn (toDyn (Just True)) (Nothing::Maybe Bool))
+ print (fromDyn (toDyn (Left True::Either Bool Bool)) (Right False :: Either Bool Bool))
+ print (fromDyn (toDyn LT) GT)
+ print (fromDyn (toDyn ((+1)::Int->Int)) False)
+ print ((fromDyn (toDyn ((+1)::Int->Int)) ((+2)::Int->Int)) 3)
+ print ((fromDyn (toDyn ((++)::[Int]->[Int]->[Int])) ((undefined)::[Int]->[Int]->[Int])) [1] [2])
+
+
+-- Misc test utilities:
+test :: Show a => String -> [a] -> IO ()
+test str ls = do
+ putStrLn ("*** Testing: " ++ str ++ " ***")
+ putStrLn (showListLn ls)
+
+testIO :: String -> IO () -> IO ()
+testIO str tst = do
+ putStrLn ("*** Testing: " ++ str ++ " ***")
+ tst
+
+
+-- showListLn presents a list in a diff-friendly format.
+-- showListLn [a1,..an]
+-- =>
+-- [ a1
+-- , a2
+-- ..
+-- , an
+-- ]
+--
+showListLn :: Show a => [a] -> String
+showListLn [] = ""
+showListLn ls = '[' : ' ' : go ls
+ where
+ go [x] = show x ++ "\n]"
+ go (x:xs) = show x ++ '\n':',':' ':go xs
+
+{-
+test8 = toDyn (mkAppTy listTc)
+test9 :: Float
+test9 = fromDyn test8 0
+
+printf :: String -> [Dynamic] -> IO ()
+printf str args = putStr (decode str args)
+ where
+ decode [] [] = []
+ decode ('%':'n':cs) (d:ds) =
+ (\ v -> show v++decode cs ds) (fromDyn d (0::Int))
+ decode ('%':'c':cs) (d:ds) =
+ (\ v -> show v++decode cs ds) (fromDyn d ('\0'))
+ decode ('%':'b':cs) (d:ds) =
+ (\ v -> show v++decode cs ds) (fromDyn d (False::Bool))
+ decode (x:xs) ds = x:decode xs ds
+
+test10 :: IO ()
+test10 = printf "%n = %c, that much is %b\n" [toDyn (3::Int),toDyn 'a', toDyn False]
+
+-}
diff --git a/testsuite/tests/lib/should_run/dynamic001.stdout b/testsuite/tests/lib/should_run/dynamic001.stdout
new file mode 100644
index 0000000000..c2d365a7c6
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic001.stdout
@@ -0,0 +1,42 @@
+*** Testing: toDyn ***
+[ <<Int>>
+, <<Char>>
+, <<Bool>>
+, <<Float>>
+, <<Double>>
+, <<Integer>>
+, <<IO ()>>
+, <<[Dynamic]>>
+, <<[Int]>>
+, <<Maybe Int>>
+, <<Maybe Int>>
+, <<Maybe Int>>
+, <<Either Int Bool>>
+, <<Either Char Int>>
+, <<()>>
+, <<Ordering>>
+, <<((),Int)>>
+, <<((),Int,Char)>>
+, <<((),Int,Char,Double)>>
+, <<((),Int,Char,Double,(Maybe Bool))>>
+, <<Int -> Int -> Int>>
+, <<Integer -> Integer -> Integer>>
+, <<[Char] -> [Char] -> [Char]>>
+]
+*** Testing: fromDyn ***
+1
+0
+'a'
+1.0
+0
+3.0
+0
+5
+False
+[1,3,5]
+Just True
+Left True
+LT
+False
+4
+[1,2]
diff --git a/testsuite/tests/lib/should_run/dynamic002.hs b/testsuite/tests/lib/should_run/dynamic002.hs
new file mode 100644
index 0000000000..6d53d2ed1e
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic002.hs
@@ -0,0 +1,91 @@
+-- !!! Testing Typeable instances
+module Main(main) where
+
+import Data.Dynamic
+import Data.Array
+import Data.Array.MArray
+import Data.Array.ST
+import Data.Array.IO
+import Data.Array.Unboxed
+import Data.Complex
+import Data.Int
+import Data.Word
+import Data.IORef
+import System.IO
+import Control.Monad.ST
+import System.Mem.StableName
+import System.Mem.Weak
+import Foreign.StablePtr
+import Control.Exception
+import Foreign.C.Types
+
+main :: IO ()
+main = do
+ print (typeOf (undefined :: [()]))
+ print (typeOf (undefined :: ()))
+ print (typeOf (undefined :: ((),())))
+ print (typeOf (undefined :: ((),(),())))
+ print (typeOf (undefined :: ((),(),(),())))
+ print (typeOf (undefined :: ((),(),(),(),())))
+ print (typeOf (undefined :: (() -> ())))
+ print (typeOf (undefined :: (Array () ())))
+ print (typeOf (undefined :: Bool))
+ print (typeOf (undefined :: Char))
+ print (typeOf (undefined :: (Complex ())))
+ print (typeOf (undefined :: Double))
+ print (typeOf (undefined :: (Either () ())))
+ print (typeOf (undefined :: Float))
+ print (typeOf (undefined :: Handle))
+ print (typeOf (undefined :: Int))
+ print (typeOf (undefined :: Integer))
+ print (typeOf (undefined :: IO ()))
+ print (typeOf (undefined :: (Maybe ())))
+ print (typeOf (undefined :: Ordering))
+
+ print (typeOf (undefined :: Dynamic))
+ print (typeOf (undefined :: (IORef ())))
+ print (typeOf (undefined :: Int8))
+ print (typeOf (undefined :: Int16))
+ print (typeOf (undefined :: Int32))
+ print (typeOf (undefined :: Int64))
+ print (typeOf (undefined :: (ST () ())))
+ print (typeOf (undefined :: (StableName ())))
+ print (typeOf (undefined :: (StablePtr ())))
+ print (typeOf (undefined :: TyCon))
+ print (typeOf (undefined :: TypeRep))
+ print (typeOf (undefined :: Word8))
+ print (typeOf (undefined :: Word16))
+ print (typeOf (undefined :: Word32))
+ print (typeOf (undefined :: Word64))
+
+ print (typeOf (undefined :: ArithException))
+ print (typeOf (undefined :: AsyncException))
+ print (typeOf (undefined :: (IOArray () ())))
+ print (typeOf (undefined :: (IOUArray () ())))
+ print (typeOf (undefined :: (STArray () () ())))
+ print (typeOf (undefined :: (STUArray () () ())))
+ print (typeOf (undefined :: (StableName ())))
+ print (typeOf (undefined :: (StablePtr ())))
+ print (typeOf (undefined :: (UArray () ())))
+ print (typeOf (undefined :: (Weak ())))
+
+ print (typeOf (undefined :: CChar))
+ print (typeOf (undefined :: CSChar))
+ print (typeOf (undefined :: CUChar))
+ print (typeOf (undefined :: CShort))
+ print (typeOf (undefined :: CUShort))
+ print (typeOf (undefined :: CInt))
+ print (typeOf (undefined :: CUInt))
+ print (typeOf (undefined :: CLong))
+ print (typeOf (undefined :: CULong))
+ print (typeOf (undefined :: CLLong))
+ print (typeOf (undefined :: CULLong))
+ print (typeOf (undefined :: CFloat))
+ print (typeOf (undefined :: CDouble))
+
+ print (typeOf (undefined :: CPtrdiff))
+ print (typeOf (undefined :: CSize))
+ print (typeOf (undefined :: CWchar))
+ print (typeOf (undefined :: CSigAtomic))
+ print (typeOf (undefined :: CClock))
+ print (typeOf (undefined :: CTime))
diff --git a/testsuite/tests/lib/should_run/dynamic002.stdout b/testsuite/tests/lib/should_run/dynamic002.stdout
new file mode 100644
index 0000000000..8b55566ada
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic002.stdout
@@ -0,0 +1,64 @@
+[()]
+()
+((),())
+((),(),())
+((),(),(),())
+((),(),(),(),())
+() -> ()
+Array () ()
+Bool
+Char
+Complex ()
+Double
+Either () ()
+Float
+Handle
+Int
+Integer
+IO ()
+Maybe ()
+Ordering
+Dynamic
+IORef ()
+Int8
+Int16
+Int32
+Int64
+ST () ()
+StableName ()
+StablePtr ()
+TyCon
+TypeRep
+Word8
+Word16
+Word32
+Word64
+ArithException
+AsyncException
+IOArray () ()
+IOUArray () ()
+STArray () () ()
+STUArray () () ()
+StableName ()
+StablePtr ()
+UArray () ()
+Weak ()
+CChar
+CSChar
+CUChar
+CShort
+CUShort
+CInt
+CUInt
+CLong
+CULong
+CLLong
+CULLong
+CFloat
+CDouble
+CPtrdiff
+CSize
+CWchar
+CSigAtomic
+CClock
+CTime
diff --git a/testsuite/tests/lib/should_run/dynamic003.hs b/testsuite/tests/lib/should_run/dynamic003.hs
new file mode 100644
index 0000000000..fae8bdb276
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic003.hs
@@ -0,0 +1,12 @@
+module Main where
+
+-- Test generation of large TypeReps
+-- (can be used as a benchmark)
+
+import Data.Typeable
+
+f :: Typeable a => Int -> a -> TypeRep
+f 0 a = typeOf a
+f n a = f (n-1) [a]
+
+main = print (f 50000 () == f 50001 ())
diff --git a/testsuite/tests/lib/should_run/dynamic003.stdout b/testsuite/tests/lib/should_run/dynamic003.stdout
new file mode 100644
index 0000000000..bc59c12aa1
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic003.stdout
@@ -0,0 +1 @@
+False
diff --git a/testsuite/tests/lib/should_run/dynamic004.hs b/testsuite/tests/lib/should_run/dynamic004.hs
new file mode 100644
index 0000000000..e6b7a82bfd
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic004.hs
@@ -0,0 +1,36 @@
+module Main where
+
+import Data.Typeable
+import Data.Typeable.Internal
+import GHC.Fingerprint
+import Text.Printf
+
+f :: Typeable a => Int -> a -> [TypeRep]
+f 0 a = []
+f n a = typeOf a : f (n-1) [a]
+
+-- pointwise compare 1000x1001 TypeReps, there should be exactly 1000 equalities
+-- (can be used as a benchmark)
+main = print $ length [ t1 | t1 <- f 1000 (), t2 <- f 1001 (), t1 == t2 ]
+
+{-
+ DEBUGGING code to help find bugs in the TypeRep implementation when
+ this test fails:
+
+ where
+ g (x:xs) (y:ys)
+ | x == y = g xs ys
+ | otherwise = do
+ print x
+ case x of
+ TypeRep f1 (TyCon f2 _ _ _) [TypeRep f3 _ _] ->
+ printf "f1: %s\nf2: %s\nf3: %s\n" (show_fp f1) (show_fp f2) (show_fp f3)
+ case y of
+ TypeRep f1 (TyCon f2 _ _ _) [TypeRep f3 _ _] ->
+ printf "f1: %s\nf2: %s\nf3: %s\n" (show_fp f1) (show_fp f2) (show_fp f3)
+ g _ _ = return ()
+
+ show_fp :: Fingerprint -> String
+ show_fp (Fingerprint h l) =
+ printf "%x %x" h l
+-}
diff --git a/testsuite/tests/lib/should_run/dynamic004.stdout b/testsuite/tests/lib/should_run/dynamic004.stdout
new file mode 100644
index 0000000000..83b33d238d
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic004.stdout
@@ -0,0 +1 @@
+1000
diff --git a/testsuite/tests/lib/should_run/dynamic005.hs b/testsuite/tests/lib/should_run/dynamic005.hs
new file mode 100644
index 0000000000..e90aeea960
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic005.hs
@@ -0,0 +1,14 @@
+module Main where
+
+import Data.Typeable
+
+f :: Typeable a => Int -> a -> [TypeRep]
+f 0 a = []
+f n a = typeOf a : f (n-1) [a]
+
+-- pointwise compare 1000x1000 different TypeReps, there should be no equalities
+-- (can be used as a benchmark)
+
+main = print $ length [ t1 | t1 <- replicate 1000 (f 10 ()),
+ t2 <- replicate 1000 (f 10 'a'),
+ t1 == t2 ]
diff --git a/testsuite/tests/lib/should_run/dynamic005.stdout b/testsuite/tests/lib/should_run/dynamic005.stdout
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/testsuite/tests/lib/should_run/dynamic005.stdout
@@ -0,0 +1 @@
+0
diff --git a/testsuite/tests/lib/should_run/enum01.hs b/testsuite/tests/lib/should_run/enum01.hs
new file mode 100644
index 0000000000..d8178667eb
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum01.hs
@@ -0,0 +1,526 @@
+-- !!! Testing the Prelude's Enum instances.
+module Main(main) where
+
+import Control.Exception
+import Prelude hiding (catch)
+import Data.Char
+import Data.Ratio
+
+main = do
+ -- Enum Int
+ putStrLn "Testing Enum Int: "
+ testEnumInt
+ -- Enum Integer
+ putStrLn "Testing Enum Integer: "
+ testEnumInteger
+ -- Enum Char
+ putStrLn "Testing Enum Char: "
+ testEnumChar
+ -- Enum ()
+ putStrLn "Testing Enum (): "
+ testEnumUnit
+ -- Enum Ordering
+ putStrLn "Testing Enum Ordering (derived): "
+ testEnumOrdering
+ -- Enum Bool
+ putStrLn "Testing Enum Bool: "
+ testEnumBool
+ -- Enum Rational
+ putStrLn "Testing Enum Rational: "
+ testEnumRational
+ -- Enum (Ratio Int)
+ putStrLn "Testing Enum (Ratio Int): "
+ testEnumRatioInt
+
+{-
+ Here's the properties that's supposed to
+ hold for arithmetic sequences over Int:
+
+ - [e1..] = [e1, (e1+1), (e1+2), ..., maxBound]
+
+ - [e1,e2..] = [e1, (e1+i), (e1+2*i), ... upper]
+ where
+ i = e2 - e1
+ upper
+ | i > 0 = maxBound
+ | i < 0 = minBound
+ | i == 0 = maxBound -- this really shouldn't matter (I feel.)
+ - [e1..e3] = [e1, (e1+i), (e1+2*i),..e3]
+ where
+ i
+ | e3 >= e1 = 1
+ | e3 < e1 = (-1)
+
+ - [e1,e2..e3] = res
+ where
+ i = e2 - e1
+
+ res
+ | i >= 0 && e3 < e1 = []
+ | i < 0 && e3 >= e1 = [] -- (*)
+ | otherwise = [e1, (e1+i), (e1 + 2*i), .. e3]
+
+ Note:
+ (*) - I think this instead should be (i < 0 && e3 > e1), since, as is,
+
+ [x,(x+1) ..x] = [x]
+ [x,(x-1) ..x] = []
+
+ which does not look right, symmetrically speaking.
+
+
+ The same properties hold for other Prelude types that
+ are instances of Enum as well as being Bounded.
+
+ For non-Bounded types (e.g., Float and Double), the properties are similar,
+ except that the boundary tests become slightly different, i.e., when an
+ element becomes greater than (e3 + i/2) (or less than (e3 + i/2) for negative
+ i.)
+
+ Q - does [(x::Double)..] have an upper bound? (ditto for Float.)
+
+ OK - on with the regression testing.
+-}
+
+#define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) })
+
+
+testEnumInt :: IO ()
+testEnumInt = do
+ -- succ
+ printTest ((succ (0::Int)))
+ printTest ((succ (minBound::Int)))
+ mayBomb (printTest ((succ (maxBound::Int))))
+
+ -- pred
+ printTest (pred (1::Int))
+ printTest (pred (maxBound::Int))
+ mayBomb (printTest (pred (minBound::Int)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Int) [1,minBound,maxBound]))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Int),minBound,maxBound]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Int)..]))
+ printTest ((take 7 [((maxBound::Int)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Int),2..]))
+ printTest ((take 7 [(1::Int),7..]))
+ printTest ((take 7 [(1::Int),1..]))
+ printTest ((take 7 [(1::Int),0..]))
+ printTest ((take 7 [(5::Int),2..]))
+ let x = (minBound::Int) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Int) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Int) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- Test overflow conditions
+ printTest (([minBound::Int,1..]))
+ printTest (([minBound::Int,0..]))
+ printTest (([minBound::Int,-1..]))
+ printTest (([maxBound::Int,1..]))
+ printTest (([maxBound::Int,0..]))
+ printTest (([maxBound::Int,-1..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Int) .. 5])))
+ printTest ((take 4 ([(1::Int) .. 1])))
+ printTest ((take 7 ([(1::Int) .. 0])))
+ printTest ((take 7 ([(5::Int) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Int)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Int)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Int),4..1]))
+ printTest ((take 7 [(5::Int),3..1]))
+ printTest ((take 7 [(5::Int),3..2]))
+ printTest ((take 7 [(1::Int),2..1]))
+ printTest ((take 7 [(2::Int),1..2]))
+ printTest ((take 7 [(2::Int),1..1]))
+ printTest ((take 7 [(2::Int),3..1]))
+
+ -- Test overflow conditions
+ printTest (([minBound, 1..maxBound::Int]))
+ printTest (([minBound, 0..maxBound::Int]))
+ printTest (([minBound,-1..maxBound::Int]))
+ printTest (([minBound,-1..maxBound-1::Int]))
+ printTest (([minBound,-1..maxBound-2::Int]))
+
+ printTest (([maxBound, 1..minBound::Int]))
+ printTest (([maxBound, 0..minBound::Int]))
+ printTest (([maxBound, 0..minBound+1::Int]))
+ printTest (([maxBound, 0..minBound+2::Int]))
+ printTest (([maxBound,-1..minBound::Int]))
+
+ let x = (maxBound::Int) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Int) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+testEnumChar :: IO ()
+testEnumChar = do
+ -- succ
+ printTest ((succ 'a'))
+ printTest ((succ (minBound::Char)))
+ mayBomb (printTest ((succ (maxBound::Char))))
+
+ -- pred
+ printTest ((pred 'b'))
+ printTest (pred (maxBound::Char))
+ mayBomb (printTest (pred (minBound::Char)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]))
+ mayBomb (printTest ((toEnum::Int->Char) (minBound::Int)))
+
+ -- fromEnum
+ printTest ((map fromEnum ['X',minBound,maxBound]))
+
+ -- [x..] aka enumFrom
+ -- printTest ((take 7 ['\NUL' .. ]))
+ do{ putStr ( " " ++ "(take 7 ['\\NUL' .. ])" ++ " = " ) ; print (take 7 ['\NUL' .. ]) }
+ -- printTest ((take 7 ['\250' .. ]))
+ do{ putStr ( " " ++ "(take 7 ['\\250' .. ])" ++ " = " ) ; print (take 7 ['\250' .. ]) }
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 ['a','b'..]))
+ printTest ((take 7 ['a','e'..]))
+ printTest ((take 7 ['a','a'..]))
+ printTest ((take 7 ['z','y'..]))
+ printTest ((take 7 ['z','v'..]))
+ let x = '\1'
+ -- printTest ((take 7 ['\1', '\0' ..]))
+ do{ putStr ( " " ++ "(take 7 ['\\1', '\\0' ..])" ++ " = " ) ; print (take 7 ['\1', '\0' ..]) }
+ let x = '\5'
+ -- printTest ((take 7 ['\5', '\4' ..]))
+ do{ putStr ( " " ++ "(take 7 ['\\5', '\\4' ..])" ++ " = " ) ; print (take 7 ['\5', '\4' ..]) }
+ let x = (maxBound::Int) - 5
+ -- printTest ((take 7 ['\250', '\251' ..]))
+ do{ putStr ( " " ++ "(take 7 ['\\250', '\\251' ..])" ++ " = " ) ; print (take 7 ['\250', '\251' ..]) }
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 (['a' .. 'e'])))
+ printTest ((take 4 (['a' .. 'a'])))
+ printTest ((take 7 (['b' .. 'a'])))
+ printTest ((take 7 (['e' .. 'a'])))
+ -- printTest ((take 7 (['\250' .. '\255'])))
+ do{ putStr ( " " ++ "(take 7 (['\\250' .. '\\255']))" ++ " = " ) ; print (take 7 (['\250' .. '\255'])) }
+ -- printTest ((take 7 (['\5' .. '\0'])))
+ do{ putStr ( " " ++ "(take 7 (['\\5' .. '\\0']))" ++ " = " ) ; print (take 7 (['\5' .. '\0'])) }
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 ['f','e' .. 'b']))
+ printTest ((take 7 ['g','e' .. 'b']))
+ printTest ((take 7 ['g','d' .. 'c']))
+ printTest ((take 7 ['b','c' .. 'b']))
+ printTest ((take 7 ['c','b' .. 'c']))
+ printTest ((take 7 ['c','b' .. 'b']))
+ printTest ((take 7 ['c','d' .. 'b']))
+ -- printTest ((take 7 ['\251', '\252' .. maxBound]))
+ do{ putStr ( " " ++ "(take 7 ['\\251', '\\252' .. maxBound])" ++ " = " ) ; print (take 7 ['\251', '\252' .. maxBound]) }
+ -- printTest ((take 7 ['\5', '\4' .. minBound]))
+ do{ putStr ( " " ++ "(take 7 ['\\5', '\\4' .. minBound])" ++ " = " ) ; print (take 7 ['\5', '\4' .. minBound]) }
+
+
+testEnumUnit :: IO ()
+testEnumUnit = do
+ -- succ:
+ mayBomb (printTest ((succ ())))
+ mayBomb (printTest ((succ (minBound::()))))
+ mayBomb (printTest ((succ (maxBound::()))))
+
+ -- pred:
+ mayBomb (printTest ((pred ())))
+ mayBomb (printTest ((pred (minBound::()))))
+ mayBomb (printTest ((pred (maxBound::()))))
+
+ -- toEnum:
+ printTest ((toEnum 0)::())
+ mayBomb (printTest ((toEnum 1)::()))
+
+ -- fromEnum:
+ printTest ((fromEnum ()))
+
+ -- enumFrom:
+ printTest ((take 7 [()..]))
+
+ -- enumFromThen:
+ printTest ((take 7 [(),()..]))
+
+ -- enumFromTo
+ printTest ((take 7 [()..()]))
+
+ -- enumFromThenTo
+ printTest ((take 7 [(),()..()]))
+
+testEnumOrdering :: IO ()
+testEnumOrdering = do
+ -- succ:
+ printTest ((succ LT))
+ printTest ((succ (minBound::Ordering)))
+ mayBomb (printTest ((succ (maxBound::Ordering))))
+
+ -- pred:
+ printTest ((pred GT))
+ printTest ((pred (maxBound::Ordering)))
+ mayBomb (printTest ((pred (minBound::Ordering))))
+
+ -- toEnum:
+ printTest ((toEnum 0)::Ordering)
+ mayBomb (printTest ((toEnum 5)::Ordering))
+
+ -- fromEnum:
+ printTest ((fromEnum LT))
+ printTest ((fromEnum EQ))
+ printTest ((fromEnum GT))
+
+ -- enumFrom:
+ printTest (([LT ..]))
+ printTest (([EQ ..]))
+ printTest (([GT ..]))
+
+ -- enumFromThen:
+ printTest (([LT,EQ ..]))
+ printTest (([EQ,GT ..]))
+ printTest (([EQ,LT ..]))
+ printTest (([LT,GT ..]))
+ printTest (([GT,LT ..]))
+ printTest (take 7 (([GT,GT ..])))
+ printTest (take 7 (([LT,LT ..])))
+
+ -- enumFromTo
+ printTest (([LT .. GT]))
+ printTest (([LT .. EQ]))
+ printTest (([LT .. LT]))
+ printTest (([GT .. LT]))
+ printTest (([GT .. EQ]))
+ printTest (([GT .. GT]))
+
+ -- enumFromThenTo
+ printTest (([LT,EQ .. GT]))
+ printTest (([GT,EQ .. LT]))
+ printTest (([GT,EQ .. EQ]))
+ printTest (([GT,EQ .. GT]))
+ printTest (([GT,EQ .. LT]))
+ printTest (([LT,EQ .. LT]))
+ printTest (([LT,EQ .. GT]))
+ printTest (take 7 (([LT,LT .. GT])))
+ printTest (take 7 (([GT,GT .. LT])))
+
+testEnumBool :: IO ()
+testEnumBool = do
+ -- succ:
+ printTest ((succ False))
+ printTest ((succ (minBound::Bool)))
+ mayBomb (printTest ((succ (maxBound::Bool))))
+
+ -- pred:
+ printTest ((pred True))
+ printTest ((pred (maxBound::Bool)))
+ mayBomb (printTest ((pred (minBound::Bool))))
+
+ -- toEnum:
+ printTest ((toEnum 0)::Bool)
+ mayBomb (printTest ((toEnum 5)::Bool))
+
+ -- fromEnum:
+ printTest ((fromEnum False))
+ printTest ((fromEnum True))
+
+ -- enumFrom:
+ printTest (([False ..]))
+ printTest (([True ..]))
+
+ -- enumFromThen:
+ printTest (([False,True ..]))
+ printTest (([True,False ..]))
+ printTest ((take 7 ([False,False ..])))
+ printTest ((take 7 ([True,True ..])))
+
+ -- enumFromTo
+ printTest (([False .. True]))
+ printTest (([True .. False]))
+
+ -- enumFromThenTo
+ printTest (take 7 ([False,False .. False]))
+ printTest (take 7 ([False,False .. True]))
+ printTest (take 7 ([False,True .. False]))
+ printTest (take 7 ([False,True .. True]))
+ printTest (take 7 ([True,False .. False]))
+ printTest (take 7 ([True,False .. True]))
+ printTest (take 7 ([True,True .. False]))
+ printTest (take 7 ([True,True .. True]))
+
+
+testEnumInteger :: IO ()
+testEnumInteger = do
+ -- succ
+ printTest ((succ (0::Integer)))
+ printTest ((succ ((-1)::Integer)))
+
+ -- pred
+ printTest (pred (1::Integer))
+ printTest (pred (0::Integer))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Integer) [1,minBound,maxBound]))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Integer),42,45]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Integer)..]))
+ printTest ((take 7 [(-5::Integer)..]))
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Integer),2..]))
+ printTest ((take 7 [(1::Integer),7..]))
+ printTest ((take 7 [(1::Integer),1..]))
+ printTest ((take 7 [(1::Integer),0..]))
+ printTest ((take 7 [(5::Integer),2..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Integer) .. 5])))
+ printTest ((take 4 ([(1::Integer) .. 1])))
+ printTest ((take 7 ([(1::Integer) .. 0])))
+ printTest ((take 7 ([(5::Integer) .. 0])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Integer),4..1]))
+ printTest ((take 7 [(5::Integer),3..1]))
+ printTest ((take 7 [(5::Integer),3..2]))
+ printTest ((take 7 [(1::Integer),2..1]))
+ printTest ((take 7 [(2::Integer),1..2]))
+ printTest ((take 7 [(2::Integer),1..1]))
+ printTest ((take 7 [(2::Integer),3..1]))
+
+testEnumRational :: IO ()
+testEnumRational = do
+ -- succ
+ printTest ((succ (0::Rational)))
+ printTest ((succ ((-1)::Rational)))
+
+ -- pred
+ printTest (pred (1::Rational))
+ printTest (pred (0::Rational))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Rational) [1,minBound,maxBound]))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Rational),42,45]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Rational)..]))
+ printTest ((take 7 [(-5::Rational)..]))
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Rational),2..]))
+ printTest ((take 7 [(1::Rational),7..]))
+ printTest ((take 7 [(1::Rational),1..]))
+ printTest ((take 7 [(1::Rational),0..]))
+ printTest ((take 7 [(5::Rational),2..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Rational) .. 5])))
+ printTest ((take 4 ([(1::Rational) .. 1])))
+ printTest ((take 7 ([(1::Rational) .. 0])))
+ printTest ((take 7 ([(5::Rational) .. 0])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Rational),4..1]))
+ printTest ((take 7 [(5::Rational),3..1]))
+ printTest ((take 7 [(5::Rational),3..2]))
+ printTest ((take 7 [(1::Rational),2..1]))
+ printTest ((take 7 [(2::Rational),1..2]))
+ printTest ((take 7 [(2::Rational),1..1]))
+ printTest ((take 7 [(2::Rational),3..1]))
+
+testEnumRatioInt :: IO ()
+testEnumRatioInt = do
+ -- succ
+ printTest ((succ (0::Ratio Int)))
+ printTest ((succ ((-1)::Ratio Int)))
+
+ -- pred
+ printTest (pred (1::Ratio Int))
+ printTest (pred (0::Ratio Int))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Ratio Int) [1,minBound,maxBound]))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Ratio Int),42,45]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Ratio Int)..]))
+ printTest ((take 7 [(-5::Ratio Int)..]))
+ printTest ((take 7 [((toEnum ((maxBound::Int)-5))::Ratio Int)..]))
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Ratio Int),2..]))
+ printTest ((take 7 [(1::Ratio Int),7..]))
+ printTest ((take 7 [(1::Ratio Int),1..]))
+ printTest ((take 7 [(1::Ratio Int),0..]))
+ printTest ((take 7 [(5::Ratio Int),2..]))
+ let x = (toEnum ((minBound::Int) + 1))::Ratio Int
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (toEnum ((minBound::Int) + 5))::Ratio Int
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (toEnum ((maxBound::Int) - 5))::Ratio Int
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Ratio Int) .. 5])))
+ printTest ((take 4 ([(1::Ratio Int) .. 1])))
+ printTest ((take 7 ([(1::Ratio Int) .. 0])))
+ printTest ((take 7 ([(5::Ratio Int) .. 0])))
+ let x = (toEnum (maxBound - (5::Int))) :: Ratio Int
+ let y = (toEnum (maxBound::Int)) :: Ratio Int
+ printTest ((take 7 ([x..y])))
+ let x = (toEnum (minBound + (5::Int))) :: Ratio Int
+ let y = (toEnum (minBound::Int)) :: Ratio Int
+ printTest ((take 7 ([x..y])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Ratio Int),4..1]))
+ printTest ((take 7 [(5::Ratio Int),3..1]))
+ printTest ((take 7 [(5::Ratio Int),3..2]))
+ printTest ((take 7 [(1::Ratio Int),2..1]))
+ printTest ((take 7 [(2::Ratio Int),1..2]))
+ printTest ((take 7 [(2::Ratio Int),1..1]))
+ printTest ((take 7 [(2::Ratio Int),3..1]))
+
+ let x = (toEnum ((maxBound::Int) - 4)) :: Ratio Int
+ let y = (toEnum (maxBound::Int)) :: Ratio Int
+ printTest ((take 7 [x,(x+1)..y]))
+ let x = (toEnum ((minBound::Int) + 5)) :: Ratio Int
+ let y = (toEnum (minBound::Int)) :: Ratio Int
+ printTest ((take 7 [x,(x-1)..y]))
+
+--
+--
+-- Utils
+--
+--
+
+
+mayBomb x = catch x (\(ErrorCall e) -> putStrLn ("error " ++ show e))
+ `catch` (\e -> putStrLn ("Fail: " ++ show (e :: SomeException)))
+
+test :: Show a => String -> String -> a -> IO ()
+test test_nm expected val = do
+ putStr test_nm
+ if expected == got then
+ putStrLn ": SUCCEEDED"
+ else do
+ putStr ": FAILED"
+ putStrLn ("( expected: " ++ show expected ++ " , got: " ++ show got ++ " )")
+ where
+ got = show val
diff --git a/testsuite/tests/lib/should_run/enum01.stdout b/testsuite/tests/lib/should_run/enum01.stdout
new file mode 100644
index 0000000000..71e5bd6d1a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum01.stdout
@@ -0,0 +1,246 @@
+Testing Enum Int:
+ (succ (0::Int)) = 1
+ (succ (minBound::Int)) = -2147483647
+ (succ (maxBound::Int)) = error "Prelude.Enum.succ{Int}: tried to take `succ' of maxBound"
+ pred (1::Int) = 0
+ pred (maxBound::Int) = 2147483646
+ pred (minBound::Int) = error "Prelude.Enum.pred{Int}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int) [1,minBound,maxBound]) = [1,-2147483648,2147483647]
+ (map fromEnum [(1::Int),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ ([minBound::Int,1..]) = [-2147483648,1]
+ ([minBound::Int,0..]) = [-2147483648,0]
+ ([minBound::Int,-1..]) = [-2147483648,-1,2147483646]
+ ([maxBound::Int,1..]) = [2147483647,1,-2147483645]
+ ([maxBound::Int,0..]) = [2147483647,0,-2147483647]
+ ([maxBound::Int,-1..]) = [2147483647,-1]
+ (take 7 ([(1::Int) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int) .. 1])) = [1]
+ (take 7 ([(1::Int) .. 0])) = []
+ (take 7 ([(5::Int) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int)) .. minBound])) = []
+ (take 7 [(5::Int),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int),3..1]) = [5,3,1]
+ (take 7 [(5::Int),3..2]) = [5,3]
+ (take 7 [(1::Int),2..1]) = [1]
+ (take 7 [(2::Int),1..2]) = [2]
+ (take 7 [(2::Int),1..1]) = [2,1]
+ (take 7 [(2::Int),3..1]) = []
+ ([minBound, 1..maxBound::Int]) = [-2147483648,1]
+ ([minBound, 0..maxBound::Int]) = [-2147483648,0]
+ ([minBound,-1..maxBound::Int]) = [-2147483648,-1,2147483646]
+ ([minBound,-1..maxBound-1::Int]) = [-2147483648,-1,2147483646]
+ ([minBound,-1..maxBound-2::Int]) = [-2147483648,-1]
+ ([maxBound, 1..minBound::Int]) = [2147483647,1,-2147483645]
+ ([maxBound, 0..minBound::Int]) = [2147483647,0,-2147483647]
+ ([maxBound, 0..minBound+1::Int]) = [2147483647,0,-2147483647]
+ ([maxBound, 0..minBound+2::Int]) = [2147483647,0]
+ ([maxBound,-1..minBound::Int]) = [2147483647,-1]
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Integer:
+ (succ (0::Integer)) = 1
+ (succ ((-1)::Integer)) = 0
+ pred (1::Integer) = 0
+ pred (0::Integer) = -1
+ (map (toEnum::Int->Integer) [1,minBound,maxBound]) = [1,-2147483648,2147483647]
+ (map fromEnum [(1::Integer),42,45]) = [1,42,45]
+ (take 7 [(1::Integer)..]) = [1,2,3,4,5,6,7]
+ (take 7 [(-5::Integer)..]) = [-5,-4,-3,-2,-1,0,1]
+ (take 7 [(1::Integer),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Integer),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Integer),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Integer),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Integer),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 ([(1::Integer) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Integer) .. 1])) = [1]
+ (take 7 ([(1::Integer) .. 0])) = []
+ (take 7 ([(5::Integer) .. 0])) = []
+ (take 7 [(5::Integer),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Integer),3..1]) = [5,3,1]
+ (take 7 [(5::Integer),3..2]) = [5,3]
+ (take 7 [(1::Integer),2..1]) = [1]
+ (take 7 [(2::Integer),1..2]) = [2]
+ (take 7 [(2::Integer),1..1]) = [2,1]
+ (take 7 [(2::Integer),3..1]) = []
+Testing Enum Char:
+ (succ 'a') = 'b'
+ (succ (minBound::Char)) = '\SOH'
+ (succ (maxBound::Char)) = error "Prelude.Enum.Char.succ: bad argument"
+ (pred 'b') = 'a'
+ pred (maxBound::Char) = '\1114110'
+ pred (minBound::Char) = error "Prelude.Enum.Char.pred: bad argument"
+ (map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]) = "{\NUL\1114111"
+ (toEnum::Int->Char) (minBound::Int) = error "Prelude.chr: bad argument: (-2147483648)"
+ (map fromEnum ['X',minBound,maxBound]) = [88,0,1114111]
+ (take 7 ['\NUL' .. ]) = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK"
+ (take 7 ['\250' .. ]) = "\250\251\252\253\254\255\256"
+ (take 7 ['a','b'..]) = "abcdefg"
+ (take 7 ['a','e'..]) = "aeimquy"
+ (take 7 ['a','a'..]) = "aaaaaaa"
+ (take 7 ['z','y'..]) = "zyxwvut"
+ (take 7 ['z','v'..]) = "zvrnjfb"
+ (take 7 ['\1', '\0' ..]) = "\SOH\NUL"
+ (take 7 ['\5', '\4' ..]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+ (take 7 ['\250', '\251' ..]) = "\250\251\252\253\254\255\256"
+ (take 7 (['a' .. 'e'])) = "abcde"
+ (take 4 (['a' .. 'a'])) = "a"
+ (take 7 (['b' .. 'a'])) = ""
+ (take 7 (['e' .. 'a'])) = ""
+ (take 7 (['\250' .. '\255'])) = "\250\251\252\253\254\255"
+ (take 7 (['\5' .. '\0'])) = ""
+ (take 7 ['f','e' .. 'b']) = "fedcb"
+ (take 7 ['g','e' .. 'b']) = "gec"
+ (take 7 ['g','d' .. 'c']) = "gd"
+ (take 7 ['b','c' .. 'b']) = "b"
+ (take 7 ['c','b' .. 'c']) = "c"
+ (take 7 ['c','b' .. 'b']) = "cb"
+ (take 7 ['c','d' .. 'b']) = ""
+ (take 7 ['\251', '\252' .. maxBound]) = "\251\252\253\254\255\256\257"
+ (take 7 ['\5', '\4' .. minBound]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+Testing Enum ():
+ (succ ()) = error "Prelude.Enum.().succ: bad argument"
+ (succ (minBound::())) = error "Prelude.Enum.().succ: bad argument"
+ (succ (maxBound::())) = error "Prelude.Enum.().succ: bad argument"
+ (pred ()) = error "Prelude.Enum.().pred: bad argument"
+ (pred (minBound::())) = error "Prelude.Enum.().pred: bad argument"
+ (pred (maxBound::())) = error "Prelude.Enum.().pred: bad argument"
+ (toEnum 0)::() = ()
+ (toEnum 1)::() = error "Prelude.Enum.().toEnum: bad argument"
+ (fromEnum ()) = 0
+ (take 7 [()..]) = [()]
+ (take 7 [(),()..]) = [(),(),(),(),(),(),()]
+ (take 7 [()..()]) = [()]
+ (take 7 [(),()..()]) = [(),(),(),(),(),(),()]
+Testing Enum Ordering (derived):
+ (succ LT) = EQ
+ (succ (minBound::Ordering)) = EQ
+ (succ (maxBound::Ordering)) = error "Prelude.Enum.Ordering.succ: bad argument"
+ (pred GT) = EQ
+ (pred (maxBound::Ordering)) = EQ
+ (pred (minBound::Ordering)) = error "Prelude.Enum.Ordering.pred: bad argument"
+ (toEnum 0)::Ordering = LT
+ (toEnum 5)::Ordering = error "Prelude.Enum.Ordering.toEnum: bad argument"
+ (fromEnum LT) = 0
+ (fromEnum EQ) = 1
+ (fromEnum GT) = 2
+ ([LT ..]) = [LT,EQ,GT]
+ ([EQ ..]) = [EQ,GT]
+ ([GT ..]) = [GT]
+ ([LT,EQ ..]) = [LT,EQ,GT]
+ ([EQ,GT ..]) = [EQ,GT]
+ ([EQ,LT ..]) = [EQ,LT]
+ ([LT,GT ..]) = [LT,GT]
+ ([GT,LT ..]) = [GT,LT]
+ take 7 (([GT,GT ..])) = [GT,GT,GT,GT,GT,GT,GT]
+ take 7 (([LT,LT ..])) = [LT,LT,LT,LT,LT,LT,LT]
+ ([LT .. GT]) = [LT,EQ,GT]
+ ([LT .. EQ]) = [LT,EQ]
+ ([LT .. LT]) = [LT]
+ ([GT .. LT]) = []
+ ([GT .. EQ]) = []
+ ([GT .. GT]) = [GT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([GT,EQ .. EQ]) = [GT,EQ]
+ ([GT,EQ .. GT]) = [GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([LT,EQ .. LT]) = [LT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ take 7 (([LT,LT .. GT])) = [LT,LT,LT,LT,LT,LT,LT]
+ take 7 (([GT,GT .. LT])) = []
+Testing Enum Bool:
+ (succ False) = True
+ (succ (minBound::Bool)) = True
+ (succ (maxBound::Bool)) = error "Prelude.Enum.Bool.succ: bad argument"
+ (pred True) = False
+ (pred (maxBound::Bool)) = False
+ (pred (minBound::Bool)) = error "Prelude.Enum.Bool.pred: bad argument"
+ (toEnum 0)::Bool = False
+ (toEnum 5)::Bool = error "Prelude.Enum.Bool.toEnum: bad argument"
+ (fromEnum False) = 0
+ (fromEnum True) = 1
+ ([False ..]) = [False,True]
+ ([True ..]) = [True]
+ ([False,True ..]) = [False,True]
+ ([True,False ..]) = [True,False]
+ (take 7 ([False,False ..])) = [False,False,False,False,False,False,False]
+ (take 7 ([True,True ..])) = [True,True,True,True,True,True,True]
+ ([False .. True]) = [False,True]
+ ([True .. False]) = []
+ take 7 ([False,False .. False]) = [False,False,False,False,False,False,False]
+ take 7 ([False,False .. True]) = [False,False,False,False,False,False,False]
+ take 7 ([False,True .. False]) = [False]
+ take 7 ([False,True .. True]) = [False,True]
+ take 7 ([True,False .. False]) = [True,False]
+ take 7 ([True,False .. True]) = [True]
+ take 7 ([True,True .. False]) = []
+ take 7 ([True,True .. True]) = [True,True,True,True,True,True,True]
+Testing Enum Rational:
+ (succ (0::Rational)) = 1 % 1
+ (succ ((-1)::Rational)) = 0 % 1
+ pred (1::Rational) = 0 % 1
+ pred (0::Rational) = (-1) % 1
+ (map (toEnum::Int->Rational) [1,minBound,maxBound]) = [1 % 1,(-2147483648) % 1,2147483647 % 1]
+ (map fromEnum [(1::Rational),42,45]) = [1,42,45]
+ (take 7 [(1::Rational)..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(-5::Rational)..]) = [(-5) % 1,(-4) % 1,(-3) % 1,(-2) % 1,(-1) % 1,0 % 1,1 % 1]
+ (take 7 [(1::Rational),2..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(1::Rational),7..]) = [1 % 1,7 % 1,13 % 1,19 % 1,25 % 1,31 % 1,37 % 1]
+ (take 7 [(1::Rational),1..]) = [1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1]
+ (take 7 [(1::Rational),0..]) = [1 % 1,0 % 1,(-1) % 1,(-2) % 1,(-3) % 1,(-4) % 1,(-5) % 1]
+ (take 7 [(5::Rational),2..]) = [5 % 1,2 % 1,(-1) % 1,(-4) % 1,(-7) % 1,(-10) % 1,(-13) % 1]
+ (take 7 ([(1::Rational) .. 5])) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
+ (take 4 ([(1::Rational) .. 1])) = [1 % 1]
+ (take 7 ([(1::Rational) .. 0])) = []
+ (take 7 ([(5::Rational) .. 0])) = []
+ (take 7 [(5::Rational),4..1]) = [5 % 1,4 % 1,3 % 1,2 % 1,1 % 1]
+ (take 7 [(5::Rational),3..1]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(5::Rational),3..2]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(1::Rational),2..1]) = [1 % 1]
+ (take 7 [(2::Rational),1..2]) = [2 % 1]
+ (take 7 [(2::Rational),1..1]) = [2 % 1,1 % 1]
+ (take 7 [(2::Rational),3..1]) = []
+Testing Enum (Ratio Int):
+ (succ (0::Ratio Int)) = 1 % 1
+ (succ ((-1)::Ratio Int)) = 0 % 1
+ pred (1::Ratio Int) = 0 % 1
+ pred (0::Ratio Int) = (-1) % 1
+ (map (toEnum::Int->Ratio Int) [1,minBound,maxBound]) = [1 % 1,(-2147483648) % 1,2147483647 % 1]
+ (map fromEnum [(1::Ratio Int),42,45]) = [1,42,45]
+ (take 7 [(1::Ratio Int)..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(-5::Ratio Int)..]) = [(-5) % 1,(-4) % 1,(-3) % 1,(-2) % 1,(-1) % 1,0 % 1,1 % 1]
+ (take 7 [((toEnum ((maxBound::Int)-5))::Ratio Int)..]) = [2147483642 % 1,2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1,(-2147483648) % 1]
+ (take 7 [(1::Ratio Int),2..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(1::Ratio Int),7..]) = [1 % 1,7 % 1,13 % 1,19 % 1,25 % 1,31 % 1,37 % 1]
+ (take 7 [(1::Ratio Int),1..]) = [1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1]
+ (take 7 [(1::Ratio Int),0..]) = [1 % 1,0 % 1,(-1) % 1,(-2) % 1,(-3) % 1,(-4) % 1,(-5) % 1]
+ (take 7 [(5::Ratio Int),2..]) = [5 % 1,2 % 1,(-1) % 1,(-4) % 1,(-7) % 1,(-10) % 1,(-13) % 1]
+ (take 7 [x, x-1 ..]) = [(-2147483647) % 1,(-2147483648) % 1,2147483647 % 1,2147483646 % 1,2147483645 % 1,2147483644 % 1,2147483643 % 1]
+ (take 7 [x, x-1 ..]) = [(-2147483643) % 1,(-2147483644) % 1,(-2147483645) % 1,(-2147483646) % 1,(-2147483647) % 1,(-2147483648) % 1,2147483647 % 1]
+ (take 7 [x, (x+1) ..]) = [2147483642 % 1,2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1,(-2147483648) % 1]
+ (take 7 ([(1::Ratio Int) .. 5])) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
+ (take 4 ([(1::Ratio Int) .. 1])) = [1 % 1]
+ (take 7 ([(1::Ratio Int) .. 0])) = []
+ (take 7 ([(5::Ratio Int) .. 0])) = []
+ (take 7 ([x..y])) = [2147483642 % 1,2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1]
+ (take 7 ([x..y])) = []
+ (take 7 [(5::Ratio Int),4..1]) = [5 % 1,4 % 1,3 % 1,2 % 1,1 % 1]
+ (take 7 [(5::Ratio Int),3..1]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(5::Ratio Int),3..2]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(1::Ratio Int),2..1]) = [1 % 1]
+ (take 7 [(2::Ratio Int),1..2]) = [2 % 1]
+ (take 7 [(2::Ratio Int),1..1]) = [2 % 1,1 % 1]
+ (take 7 [(2::Ratio Int),3..1]) = []
+ (take 7 [x,(x+1)..y]) = [2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1]
+ (take 7 [x,(x-1)..y]) = [(-2147483643) % 1,(-2147483644) % 1,(-2147483645) % 1,(-2147483646) % 1,(-2147483647) % 1,(-2147483648) % 1]
diff --git a/testsuite/tests/lib/should_run/enum01.stdout-alpha-dec-osf3 b/testsuite/tests/lib/should_run/enum01.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..63ba3e2fb3
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum01.stdout-alpha-dec-osf3
@@ -0,0 +1,230 @@
+Testing Enum Int:
+ (succ (0::Int)) = 1
+ (succ (minBound::Int)) = -9223372036854775807
+ (succ (maxBound::Int)) = error "Prelude.Enum.succ{Int}: tried to take `succ' of maxBound"
+ pred (1::Int) = 0
+ pred (maxBound::Int) = 9223372036854775806
+ pred (minBound::Int) = error "Prelude.Enum.pred{Int}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int) [1,minBound,maxBound]) = [1,-9223372036854775808,9223372036854775807]
+ (map fromEnum [(1::Int),minBound,maxBound]) = [1,-9223372036854775808,9223372036854775807]
+ (take 7 [(1::Int)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(1::Int) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int) .. 1])) = [1]
+ (take 7 ([(1::Int) .. 0])) = []
+ (take 7 ([(5::Int) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int)) .. minBound])) = []
+ (take 7 [(5::Int),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int),3..1]) = [5,3,1]
+ (take 7 [(5::Int),3..2]) = [5,3]
+ (take 7 [(1::Int),2..1]) = [1]
+ (take 7 [(2::Int),1..2]) = [2]
+ (take 7 [(2::Int),1..1]) = [2,1]
+ (take 7 [(2::Int),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+Testing Enum Integer:
+ (succ (0::Integer)) = 1
+ (succ ((-1)::Integer)) = 0
+ pred (1::Integer) = 0
+ pred (0::Integer) = -1
+ (map (toEnum::Int->Integer) [1,minBound,maxBound]) = [1,-9223372036854775808,9223372036854775807]
+ (map fromEnum [(1::Integer),42,45]) = [1,42,45]
+ (take 7 [(1::Integer)..]) = [1,2,3,4,5,6,7]
+ (take 7 [(-5::Integer)..]) = [-5,-4,-3,-2,-1,0,1]
+ (take 7 [(1::Integer),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Integer),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Integer),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Integer),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Integer),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 ([(1::Integer) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Integer) .. 1])) = [1]
+ (take 7 ([(1::Integer) .. 0])) = []
+ (take 7 ([(5::Integer) .. 0])) = []
+ (take 7 [(5::Integer),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Integer),3..1]) = [5,3,1]
+ (take 7 [(5::Integer),3..2]) = [5,3]
+ (take 7 [(1::Integer),2..1]) = [1]
+ (take 7 [(2::Integer),1..2]) = [2]
+ (take 7 [(2::Integer),1..1]) = [2,1]
+ (take 7 [(2::Integer),3..1]) = []
+Testing Enum Char:
+ (succ 'a') = 'b'
+ (succ (minBound::Char)) = '\SOH'
+ (succ (maxBound::Char)) = error "Prelude.Enum.Char.succ: bad argument"
+ (pred 'b') = 'a'
+ pred (maxBound::Char) = '\1114110'
+ pred (minBound::Char) = error "Prelude.Enum.Char.pred: bad argument"
+ (map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]) = "{\NUL\1114111"
+ (toEnum::Int->Char) (minBound::Int) = error "Prelude.chr: bad argument"
+ (map fromEnum ['X',minBound,maxBound]) = [88,0,1114111]
+ (take 7 ['\NUL' .. ]) = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK"
+ (take 7 ['\250' .. ]) = "\250\251\252\253\254\255\256"
+ (take 7 ['a','b'..]) = "abcdefg"
+ (take 7 ['a','e'..]) = "aeimquy"
+ (take 7 ['a','a'..]) = "aaaaaaa"
+ (take 7 ['z','y'..]) = "zyxwvut"
+ (take 7 ['z','v'..]) = "zvrnjfb"
+ (take 7 ['\1', '\0' ..]) = "\SOH\NUL"
+ (take 7 ['\5', '\4' ..]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+ (take 7 ['\250', '\251' ..]) = "\250\251\252\253\254\255\256"
+ (take 7 (['a' .. 'e'])) = "abcde"
+ (take 4 (['a' .. 'a'])) = "a"
+ (take 7 (['b' .. 'a'])) = ""
+ (take 7 (['e' .. 'a'])) = ""
+ (take 7 (['\250' .. '\255'])) = "\250\251\252\253\254\255"
+ (take 7 (['\5' .. '\0'])) = ""
+ (take 7 ['f','e' .. 'b']) = "fedcb"
+ (take 7 ['g','e' .. 'b']) = "gec"
+ (take 7 ['g','d' .. 'c']) = "gd"
+ (take 7 ['b','c' .. 'b']) = "b"
+ (take 7 ['c','b' .. 'c']) = "c"
+ (take 7 ['c','b' .. 'b']) = "cb"
+ (take 7 ['c','d' .. 'b']) = ""
+ (take 7 ['\251', '\252' .. maxBound]) = "\251\252\253\254\255\256\257"
+ (take 7 ['\5', '\4' .. minBound]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+Testing Enum ():
+ (succ ()) = error "Prelude.Enum.().succ: bad argument"
+ (succ (minBound::())) = error "Prelude.Enum.().succ: bad argument"
+ (succ (maxBound::())) = error "Prelude.Enum.().succ: bad argument"
+ (pred ()) = error "Prelude.Enum.().pred: bad argument"
+ (pred (minBound::())) = error "Prelude.Enum.().pred: bad argument"
+ (pred (maxBound::())) = error "Prelude.Enum.().pred: bad argument"
+ (toEnum 0)::() = ()
+ (toEnum 1)::() = error "Prelude.Enum.().toEnum: bad argument"
+ (fromEnum ()) = 0
+ (take 7 [()..]) = [()]
+ (take 7 [(),()..]) = [(),(),(),(),(),(),()]
+ (take 7 [()..()]) = [()]
+ (take 7 [(),()..()]) = [(),(),(),(),(),(),()]
+Testing Enum Ordering (derived):
+ (succ LT) = EQ
+ (succ (minBound::Ordering)) = EQ
+ (succ (maxBound::Ordering)) = error "Prelude.Enum.Ordering.succ: bad argument"
+ (pred GT) = EQ
+ (pred (maxBound::Ordering)) = EQ
+ (pred (minBound::Ordering)) = error "Prelude.Enum.Ordering.pred: bad argument"
+ (toEnum 0)::Ordering = LT
+ (toEnum 5)::Ordering = error "Prelude.Enum.Ordering.toEnum: bad argument"
+ (fromEnum LT) = 0
+ (fromEnum EQ) = 1
+ (fromEnum GT) = 2
+ ([LT ..]) = [LT,EQ,GT]
+ ([EQ ..]) = [EQ,GT]
+ ([GT ..]) = [GT]
+ ([LT,EQ ..]) = [LT,EQ,GT]
+ ([EQ,GT ..]) = [EQ,GT]
+ ([EQ,LT ..]) = [EQ,LT]
+ ([LT,GT ..]) = [LT,GT]
+ ([GT,LT ..]) = [GT,LT]
+ take 7 (([GT,GT ..])) = [GT,GT,GT,GT,GT,GT,GT]
+ take 7 (([LT,LT ..])) = [LT,LT,LT,LT,LT,LT,LT]
+ ([LT .. GT]) = [LT,EQ,GT]
+ ([LT .. EQ]) = [LT,EQ]
+ ([LT .. LT]) = [LT]
+ ([GT .. LT]) = []
+ ([GT .. EQ]) = []
+ ([GT .. GT]) = [GT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([GT,EQ .. EQ]) = [GT,EQ]
+ ([GT,EQ .. GT]) = [GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([LT,EQ .. LT]) = [LT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ take 7 (([LT,LT .. GT])) = [LT,LT,LT,LT,LT,LT,LT]
+ take 7 (([GT,GT .. LT])) = []
+Testing Enum Bool:
+ (succ False) = True
+ (succ (minBound::Bool)) = True
+ (succ (maxBound::Bool)) = error "Prelude.Enum.Bool.succ: bad argument"
+ (pred True) = False
+ (pred (maxBound::Bool)) = False
+ (pred (minBound::Bool)) = error "Prelude.Enum.Bool.pred: bad argument"
+ (toEnum 0)::Bool = False
+ (toEnum 5)::Bool = error "Prelude.Enum.Bool.toEnum: bad argument"
+ (fromEnum False) = 0
+ (fromEnum True) = 1
+ ([False ..]) = [False,True]
+ ([True ..]) = [True]
+ ([False,True ..]) = [False,True]
+ ([True,False ..]) = [True,False]
+ (take 7 ([False,False ..])) = [False,False,False,False,False,False,False]
+ (take 7 ([True,True ..])) = [True,True,True,True,True,True,True]
+ ([False .. True]) = [False,True]
+ ([True .. False]) = []
+ take 7 ([False,False .. False]) = [False,False,False,False,False,False,False]
+ take 7 ([False,False .. True]) = [False,False,False,False,False,False,False]
+ take 7 ([False,True .. False]) = [False]
+ take 7 ([False,True .. True]) = [False,True]
+ take 7 ([True,False .. False]) = [True,False]
+ take 7 ([True,False .. True]) = [True]
+ take 7 ([True,True .. False]) = []
+ take 7 ([True,True .. True]) = [True,True,True,True,True,True,True]
+Testing Enum Rational:
+ (succ (0::Rational)) = 1%1
+ (succ ((-1)::Rational)) = 0%1
+ pred (1::Rational) = 0%1
+ pred (0::Rational) = (-1)%1
+ (map (toEnum::Int->Rational) [1,minBound,maxBound]) = [1%1,(-9223372036854775808)%1,9223372036854775807%1]
+ (map fromEnum [(1::Rational),42,45]) = [1,42,45]
+ (take 7 [(1::Rational)..]) = [1%1,2%1,3%1,4%1,5%1,6%1,7%1]
+ (take 7 [(-5::Rational)..]) = [(-5)%1,(-4)%1,(-3)%1,(-2)%1,(-1)%1,0%1,1%1]
+ (take 7 [(1::Rational),2..]) = [1%1,2%1,3%1,4%1,5%1,6%1,7%1]
+ (take 7 [(1::Rational),7..]) = [1%1,7%1,13%1,19%1,25%1,31%1,37%1]
+ (take 7 [(1::Rational),1..]) = [1%1,1%1,1%1,1%1,1%1,1%1,1%1]
+ (take 7 [(1::Rational),0..]) = [1%1,0%1,(-1)%1,(-2)%1,(-3)%1,(-4)%1,(-5)%1]
+ (take 7 [(5::Rational),2..]) = [5%1,2%1,(-1)%1,(-4)%1,(-7)%1,(-10)%1,(-13)%1]
+ (take 7 ([(1::Rational) .. 5])) = [1%1,2%1,3%1,4%1,5%1]
+ (take 4 ([(1::Rational) .. 1])) = [1%1]
+ (take 7 ([(1::Rational) .. 0])) = []
+ (take 7 ([(5::Rational) .. 0])) = []
+ (take 7 [(5::Rational),4..1]) = [5%1,4%1,3%1,2%1,1%1]
+ (take 7 [(5::Rational),3..1]) = [5%1,3%1,1%1]
+ (take 7 [(5::Rational),3..2]) = [5%1,3%1,1%1]
+ (take 7 [(1::Rational),2..1]) = [1%1]
+ (take 7 [(2::Rational),1..2]) = [2%1]
+ (take 7 [(2::Rational),1..1]) = [2%1,1%1]
+ (take 7 [(2::Rational),3..1]) = []
+Testing Enum (Ratio Int):
+ (succ (0::Ratio Int)) = 1%1
+ (succ ((-1)::Ratio Int)) = 0%1
+ pred (1::Ratio Int) = 0%1
+ pred (0::Ratio Int) = (-1)%1
+ (map (toEnum::Int->Ratio Int) [1,minBound,maxBound]) = [1%1,(-9223372036854775808)%1,9223372036854775807%1]
+ (map fromEnum [(1::Ratio Int),42,45]) = [1,42,45]
+ (take 7 [(1::Ratio Int)..]) = [1%1,2%1,3%1,4%1,5%1,6%1,7%1]
+ (take 7 [(-5::Ratio Int)..]) = [(-5)%1,(-4)%1,(-3)%1,(-2)%1,(-1)%1,0%1,1%1]
+ (take 7 [((toEnum ((maxBound::Int)-5))::Ratio Int)..]) = [9223372036854775802%1,9223372036854775803%1,9223372036854775804%1,9223372036854775805%1,9223372036854775806%1,9223372036854775807%1,(-9223372036854775808)%1]
+ (take 7 [(1::Ratio Int),2..]) = [1%1,2%1,3%1,4%1,5%1,6%1,7%1]
+ (take 7 [(1::Ratio Int),7..]) = [1%1,7%1,13%1,19%1,25%1,31%1,37%1]
+ (take 7 [(1::Ratio Int),1..]) = [1%1,1%1,1%1,1%1,1%1,1%1,1%1]
+ (take 7 [(1::Ratio Int),0..]) = [1%1,0%1,(-1)%1,(-2)%1,(-3)%1,(-4)%1,(-5)%1]
+ (take 7 [(5::Ratio Int),2..]) = [5%1,2%1,(-1)%1,(-4)%1,(-7)%1,(-10)%1,(-13)%1]
+ (take 7 [x, x-1 ..]) = [(-9223372036854775807)%1,(-9223372036854775808)%1,9223372036854775807%1,9223372036854775806%1,9223372036854775805%1,9223372036854775804%1,9223372036854775803%1]
+ (take 7 [x, x-1 ..]) = [(-9223372036854775803)%1,(-9223372036854775804)%1,(-9223372036854775805)%1,(-9223372036854775806)%1,(-9223372036854775807)%1,(-9223372036854775808)%1,9223372036854775807%1]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802%1,9223372036854775803%1,9223372036854775804%1,9223372036854775805%1,9223372036854775806%1,9223372036854775807%1,(-9223372036854775808)%1]
+ (take 7 ([(1::Ratio Int) .. 5])) = [1%1,2%1,3%1,4%1,5%1]
+ (take 4 ([(1::Ratio Int) .. 1])) = [1%1]
+ (take 7 ([(1::Ratio Int) .. 0])) = []
+ (take 7 ([(5::Ratio Int) .. 0])) = []
+ (take 7 ([x..y])) = [9223372036854775802%1,9223372036854775803%1,9223372036854775804%1,9223372036854775805%1,9223372036854775806%1,9223372036854775807%1]
+ (take 7 ([x..y])) = []
+ (take 7 [(5::Ratio Int),4..1]) = [5%1,4%1,3%1,2%1,1%1]
+ (take 7 [(5::Ratio Int),3..1]) = [5%1,3%1,1%1]
+ (take 7 [(5::Ratio Int),3..2]) = [5%1,3%1,1%1]
+ (take 7 [(1::Ratio Int),2..1]) = [1%1]
+ (take 7 [(2::Ratio Int),1..2]) = [2%1]
+ (take 7 [(2::Ratio Int),1..1]) = [2%1,1%1]
+ (take 7 [(2::Ratio Int),3..1]) = []
+ (take 7 [x,(x+1)..y]) = [9223372036854775803%1,9223372036854775804%1,9223372036854775805%1,9223372036854775806%1,9223372036854775807%1]
+ (take 7 [x,(x-1)..y]) = [(-9223372036854775803)%1,(-9223372036854775804)%1,(-9223372036854775805)%1,(-9223372036854775806)%1,(-9223372036854775807)%1,(-9223372036854775808)%1]
diff --git a/testsuite/tests/lib/should_run/enum01.stdout-hugs b/testsuite/tests/lib/should_run/enum01.stdout-hugs
new file mode 100644
index 0000000000..41bb64d598
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum01.stdout-hugs
@@ -0,0 +1,246 @@
+Testing Enum Int:
+ (succ (0::Int)) = 1
+ (succ (minBound::Int)) = -2147483647
+ (succ (maxBound::Int)) = error "succ: applied to maxBound"
+ pred (1::Int) = 0
+ pred (maxBound::Int) = 2147483646
+ pred (minBound::Int) = error "pred: applied to minBound"
+ (map (toEnum::Int->Int) [1,minBound,maxBound]) = [1,-2147483648,2147483647]
+ (map fromEnum [(1::Int),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ ([minBound::Int,1..]) = [-2147483648,1]
+ ([minBound::Int,0..]) = [-2147483648,0]
+ ([minBound::Int,-1..]) = [-2147483648,-1,2147483646]
+ ([maxBound::Int,1..]) = [2147483647,1,-2147483645]
+ ([maxBound::Int,0..]) = [2147483647,0,-2147483647]
+ ([maxBound::Int,-1..]) = [2147483647,-1]
+ (take 7 ([(1::Int) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int) .. 1])) = [1]
+ (take 7 ([(1::Int) .. 0])) = []
+ (take 7 ([(5::Int) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int)) .. minBound])) = []
+ (take 7 [(5::Int),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int),3..1]) = [5,3,1]
+ (take 7 [(5::Int),3..2]) = [5,3]
+ (take 7 [(1::Int),2..1]) = [1]
+ (take 7 [(2::Int),1..2]) = [2]
+ (take 7 [(2::Int),1..1]) = [2,1]
+ (take 7 [(2::Int),3..1]) = []
+ ([minBound, 1..maxBound::Int]) = [-2147483648,1]
+ ([minBound, 0..maxBound::Int]) = [-2147483648,0]
+ ([minBound,-1..maxBound::Int]) = [-2147483648,-1,2147483646]
+ ([minBound,-1..maxBound-1::Int]) = [-2147483648,-1,2147483646]
+ ([minBound,-1..maxBound-2::Int]) = [-2147483648,-1]
+ ([maxBound, 1..minBound::Int]) = [2147483647,1,-2147483645]
+ ([maxBound, 0..minBound::Int]) = [2147483647,0,-2147483647]
+ ([maxBound, 0..minBound+1::Int]) = [2147483647,0,-2147483647]
+ ([maxBound, 0..minBound+2::Int]) = [2147483647,0]
+ ([maxBound,-1..minBound::Int]) = [2147483647,-1]
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Integer:
+ (succ (0::Integer)) = 1
+ (succ ((-1)::Integer)) = 0
+ pred (1::Integer) = 0
+ pred (0::Integer) = -1
+ (map (toEnum::Int->Integer) [1,minBound,maxBound]) = [1,-2147483648,2147483647]
+ (map fromEnum [(1::Integer),42,45]) = [1,42,45]
+ (take 7 [(1::Integer)..]) = [1,2,3,4,5,6,7]
+ (take 7 [(-5::Integer)..]) = [-5,-4,-3,-2,-1,0,1]
+ (take 7 [(1::Integer),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Integer),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Integer),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Integer),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Integer),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 ([(1::Integer) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Integer) .. 1])) = [1]
+ (take 7 ([(1::Integer) .. 0])) = []
+ (take 7 ([(5::Integer) .. 0])) = []
+ (take 7 [(5::Integer),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Integer),3..1]) = [5,3,1]
+ (take 7 [(5::Integer),3..2]) = [5,3]
+ (take 7 [(1::Integer),2..1]) = [1]
+ (take 7 [(2::Integer),1..2]) = [2]
+ (take 7 [(2::Integer),1..1]) = [2,1]
+ (take 7 [(2::Integer),3..1]) = []
+Testing Enum Char:
+ (succ 'a') = 'b'
+ (succ (minBound::Char)) = '\SOH'
+ (succ (maxBound::Char)) = error "chr: out of range"
+ (pred 'b') = 'a'
+ pred (maxBound::Char) = '\1114110'
+ pred (minBound::Char) = error "chr: out of range"
+ (map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]) = "{\NUL\1114111"
+ (toEnum::Int->Char) (minBound::Int) = error "chr: out of range"
+ (map fromEnum ['X',minBound,maxBound]) = [88,0,1114111]
+ (take 7 ['\NUL' .. ]) = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK"
+ (take 7 ['\250' .. ]) = "\250\251\252\253\254\255\256"
+ (take 7 ['a','b'..]) = "abcdefg"
+ (take 7 ['a','e'..]) = "aeimquy"
+ (take 7 ['a','a'..]) = "aaaaaaa"
+ (take 7 ['z','y'..]) = "zyxwvut"
+ (take 7 ['z','v'..]) = "zvrnjfb"
+ (take 7 ['\1', '\0' ..]) = "\SOH\NUL"
+ (take 7 ['\5', '\4' ..]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+ (take 7 ['\250', '\251' ..]) = "\250\251\252\253\254\255\256"
+ (take 7 (['a' .. 'e'])) = "abcde"
+ (take 4 (['a' .. 'a'])) = "a"
+ (take 7 (['b' .. 'a'])) = ""
+ (take 7 (['e' .. 'a'])) = ""
+ (take 7 (['\250' .. '\255'])) = "\250\251\252\253\254\255"
+ (take 7 (['\5' .. '\0'])) = ""
+ (take 7 ['f','e' .. 'b']) = "fedcb"
+ (take 7 ['g','e' .. 'b']) = "gec"
+ (take 7 ['g','d' .. 'c']) = "gd"
+ (take 7 ['b','c' .. 'b']) = "b"
+ (take 7 ['c','b' .. 'c']) = "c"
+ (take 7 ['c','b' .. 'b']) = "cb"
+ (take 7 ['c','d' .. 'b']) = ""
+ (take 7 ['\251', '\252' .. maxBound]) = "\251\252\253\254\255\256\257"
+ (take 7 ['\5', '\4' .. minBound]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+Testing Enum ():
+ (succ ()) = Fail: pattern match failure
+ (succ (minBound::())) = Fail: pattern match failure
+ (succ (maxBound::())) = Fail: pattern match failure
+ (pred ()) = Fail: pattern match failure
+ (pred (minBound::())) = Fail: pattern match failure
+ (pred (maxBound::())) = Fail: pattern match failure
+ (toEnum 0)::() = ()
+ (toEnum 1)::() = Fail: pattern match failure
+ (fromEnum ()) = 0
+ (take 7 [()..]) = [()]
+ (take 7 [(),()..]) = [(),(),(),(),(),(),()]
+ (take 7 [()..()]) = [()]
+ (take 7 [(),()..()]) = [(),(),(),(),(),(),()]
+Testing Enum Ordering (derived):
+ (succ LT) = EQ
+ (succ (minBound::Ordering)) = EQ
+ (succ (maxBound::Ordering)) = error "toEnum: out of range"
+ (pred GT) = EQ
+ (pred (maxBound::Ordering)) = EQ
+ (pred (minBound::Ordering)) = error "toEnum: out of range"
+ (toEnum 0)::Ordering = LT
+ (toEnum 5)::Ordering = error "toEnum: out of range"
+ (fromEnum LT) = 0
+ (fromEnum EQ) = 1
+ (fromEnum GT) = 2
+ ([LT ..]) = [LT,EQ,GT]
+ ([EQ ..]) = [EQ,GT]
+ ([GT ..]) = [GT]
+ ([LT,EQ ..]) = [LT,EQ,GT]
+ ([EQ,GT ..]) = [EQ,GT]
+ ([EQ,LT ..]) = [EQ,LT]
+ ([LT,GT ..]) = [LT,GT]
+ ([GT,LT ..]) = [GT,LT]
+ take 7 (([GT,GT ..])) = [GT,GT,GT,GT,GT,GT,GT]
+ take 7 (([LT,LT ..])) = [LT,LT,LT,LT,LT,LT,LT]
+ ([LT .. GT]) = [LT,EQ,GT]
+ ([LT .. EQ]) = [LT,EQ]
+ ([LT .. LT]) = [LT]
+ ([GT .. LT]) = []
+ ([GT .. EQ]) = []
+ ([GT .. GT]) = [GT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([GT,EQ .. EQ]) = [GT,EQ]
+ ([GT,EQ .. GT]) = [GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([LT,EQ .. LT]) = [LT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ take 7 (([LT,LT .. GT])) = [LT,LT,LT,LT,LT,LT,LT]
+ take 7 (([GT,GT .. LT])) = []
+Testing Enum Bool:
+ (succ False) = True
+ (succ (minBound::Bool)) = True
+ (succ (maxBound::Bool)) = error "toEnum: out of range"
+ (pred True) = False
+ (pred (maxBound::Bool)) = False
+ (pred (minBound::Bool)) = error "toEnum: out of range"
+ (toEnum 0)::Bool = False
+ (toEnum 5)::Bool = error "toEnum: out of range"
+ (fromEnum False) = 0
+ (fromEnum True) = 1
+ ([False ..]) = [False,True]
+ ([True ..]) = [True]
+ ([False,True ..]) = [False,True]
+ ([True,False ..]) = [True,False]
+ (take 7 ([False,False ..])) = [False,False,False,False,False,False,False]
+ (take 7 ([True,True ..])) = [True,True,True,True,True,True,True]
+ ([False .. True]) = [False,True]
+ ([True .. False]) = []
+ take 7 ([False,False .. False]) = [False,False,False,False,False,False,False]
+ take 7 ([False,False .. True]) = [False,False,False,False,False,False,False]
+ take 7 ([False,True .. False]) = [False]
+ take 7 ([False,True .. True]) = [False,True]
+ take 7 ([True,False .. False]) = [True,False]
+ take 7 ([True,False .. True]) = [True]
+ take 7 ([True,True .. False]) = []
+ take 7 ([True,True .. True]) = [True,True,True,True,True,True,True]
+Testing Enum Rational:
+ (succ (0::Rational)) = 1 % 1
+ (succ ((-1)::Rational)) = 0 % 1
+ pred (1::Rational) = 0 % 1
+ pred (0::Rational) = (-1) % 1
+ (map (toEnum::Int->Rational) [1,minBound,maxBound]) = [1 % 1,(-2147483648) % 1,2147483647 % 1]
+ (map fromEnum [(1::Rational),42,45]) = [1,42,45]
+ (take 7 [(1::Rational)..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(-5::Rational)..]) = [(-5) % 1,(-4) % 1,(-3) % 1,(-2) % 1,(-1) % 1,0 % 1,1 % 1]
+ (take 7 [(1::Rational),2..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(1::Rational),7..]) = [1 % 1,7 % 1,13 % 1,19 % 1,25 % 1,31 % 1,37 % 1]
+ (take 7 [(1::Rational),1..]) = [1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1]
+ (take 7 [(1::Rational),0..]) = [1 % 1,0 % 1,(-1) % 1,(-2) % 1,(-3) % 1,(-4) % 1,(-5) % 1]
+ (take 7 [(5::Rational),2..]) = [5 % 1,2 % 1,(-1) % 1,(-4) % 1,(-7) % 1,(-10) % 1,(-13) % 1]
+ (take 7 ([(1::Rational) .. 5])) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
+ (take 4 ([(1::Rational) .. 1])) = [1 % 1]
+ (take 7 ([(1::Rational) .. 0])) = []
+ (take 7 ([(5::Rational) .. 0])) = []
+ (take 7 [(5::Rational),4..1]) = [5 % 1,4 % 1,3 % 1,2 % 1,1 % 1]
+ (take 7 [(5::Rational),3..1]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(5::Rational),3..2]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(1::Rational),2..1]) = [1 % 1]
+ (take 7 [(2::Rational),1..2]) = [2 % 1]
+ (take 7 [(2::Rational),1..1]) = [2 % 1,1 % 1]
+ (take 7 [(2::Rational),3..1]) = []
+Testing Enum (Ratio Int):
+ (succ (0::Ratio Int)) = 1 % 1
+ (succ ((-1)::Ratio Int)) = 0 % 1
+ pred (1::Ratio Int) = 0 % 1
+ pred (0::Ratio Int) = (-1) % 1
+ (map (toEnum::Int->Ratio Int) [1,minBound,maxBound]) = [1 % 1,(-2147483648) % 1,2147483647 % 1]
+ (map fromEnum [(1::Ratio Int),42,45]) = [1,42,45]
+ (take 7 [(1::Ratio Int)..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(-5::Ratio Int)..]) = [(-5) % 1,(-4) % 1,(-3) % 1,(-2) % 1,(-1) % 1,0 % 1,1 % 1]
+ (take 7 [((toEnum ((maxBound::Int)-5))::Ratio Int)..]) = [2147483642 % 1,2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1,(-2147483648) % 1]
+ (take 7 [(1::Ratio Int),2..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(1::Ratio Int),7..]) = [1 % 1,7 % 1,13 % 1,19 % 1,25 % 1,31 % 1,37 % 1]
+ (take 7 [(1::Ratio Int),1..]) = [1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1]
+ (take 7 [(1::Ratio Int),0..]) = [1 % 1,0 % 1,(-1) % 1,(-2) % 1,(-3) % 1,(-4) % 1,(-5) % 1]
+ (take 7 [(5::Ratio Int),2..]) = [5 % 1,2 % 1,(-1) % 1,(-4) % 1,(-7) % 1,(-10) % 1,(-13) % 1]
+ (take 7 [x, x-1 ..]) = [(-2147483647) % 1,(-2147483648) % 1,2147483647 % 1,2147483646 % 1,2147483645 % 1,2147483644 % 1,2147483643 % 1]
+ (take 7 [x, x-1 ..]) = [(-2147483643) % 1,(-2147483644) % 1,(-2147483645) % 1,(-2147483646) % 1,(-2147483647) % 1,(-2147483648) % 1,2147483647 % 1]
+ (take 7 [x, (x+1) ..]) = [2147483642 % 1,2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1,(-2147483648) % 1]
+ (take 7 ([(1::Ratio Int) .. 5])) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
+ (take 4 ([(1::Ratio Int) .. 1])) = [1 % 1]
+ (take 7 ([(1::Ratio Int) .. 0])) = []
+ (take 7 ([(5::Ratio Int) .. 0])) = []
+ (take 7 ([x..y])) = [2147483642 % 1,2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1]
+ (take 7 ([x..y])) = []
+ (take 7 [(5::Ratio Int),4..1]) = [5 % 1,4 % 1,3 % 1,2 % 1,1 % 1]
+ (take 7 [(5::Ratio Int),3..1]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(5::Ratio Int),3..2]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(1::Ratio Int),2..1]) = [1 % 1]
+ (take 7 [(2::Ratio Int),1..2]) = [2 % 1]
+ (take 7 [(2::Ratio Int),1..1]) = [2 % 1,1 % 1]
+ (take 7 [(2::Ratio Int),3..1]) = []
+ (take 7 [x,(x+1)..y]) = [2147483643 % 1,2147483644 % 1,2147483645 % 1,2147483646 % 1,2147483647 % 1]
+ (take 7 [x,(x-1)..y]) = [(-2147483643) % 1,(-2147483644) % 1,(-2147483645) % 1,(-2147483646) % 1,(-2147483647) % 1,(-2147483648) % 1]
diff --git a/testsuite/tests/lib/should_run/enum01.stdout-ws-64 b/testsuite/tests/lib/should_run/enum01.stdout-ws-64
new file mode 100644
index 0000000000..3804dd2470
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum01.stdout-ws-64
@@ -0,0 +1,246 @@
+Testing Enum Int:
+ (succ (0::Int)) = 1
+ (succ (minBound::Int)) = -9223372036854775807
+ (succ (maxBound::Int)) = error "Prelude.Enum.succ{Int}: tried to take `succ' of maxBound"
+ pred (1::Int) = 0
+ pred (maxBound::Int) = 9223372036854775806
+ pred (minBound::Int) = error "Prelude.Enum.pred{Int}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int) [1,minBound,maxBound]) = [1,-9223372036854775808,9223372036854775807]
+ (map fromEnum [(1::Int),minBound,maxBound]) = [1,-9223372036854775808,9223372036854775807]
+ (take 7 [(1::Int)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ ([minBound::Int,1..]) = [-9223372036854775808,1]
+ ([minBound::Int,0..]) = [-9223372036854775808,0]
+ ([minBound::Int,-1..]) = [-9223372036854775808,-1,9223372036854775806]
+ ([maxBound::Int,1..]) = [9223372036854775807,1,-9223372036854775805]
+ ([maxBound::Int,0..]) = [9223372036854775807,0,-9223372036854775807]
+ ([maxBound::Int,-1..]) = [9223372036854775807,-1]
+ (take 7 ([(1::Int) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int) .. 1])) = [1]
+ (take 7 ([(1::Int) .. 0])) = []
+ (take 7 ([(5::Int) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int)) .. minBound])) = []
+ (take 7 [(5::Int),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int),3..1]) = [5,3,1]
+ (take 7 [(5::Int),3..2]) = [5,3]
+ (take 7 [(1::Int),2..1]) = [1]
+ (take 7 [(2::Int),1..2]) = [2]
+ (take 7 [(2::Int),1..1]) = [2,1]
+ (take 7 [(2::Int),3..1]) = []
+ ([minBound, 1..maxBound::Int]) = [-9223372036854775808,1]
+ ([minBound, 0..maxBound::Int]) = [-9223372036854775808,0]
+ ([minBound,-1..maxBound::Int]) = [-9223372036854775808,-1,9223372036854775806]
+ ([minBound,-1..maxBound-1::Int]) = [-9223372036854775808,-1,9223372036854775806]
+ ([minBound,-1..maxBound-2::Int]) = [-9223372036854775808,-1]
+ ([maxBound, 1..minBound::Int]) = [9223372036854775807,1,-9223372036854775805]
+ ([maxBound, 0..minBound::Int]) = [9223372036854775807,0,-9223372036854775807]
+ ([maxBound, 0..minBound+1::Int]) = [9223372036854775807,0,-9223372036854775807]
+ ([maxBound, 0..minBound+2::Int]) = [9223372036854775807,0]
+ ([maxBound,-1..minBound::Int]) = [9223372036854775807,-1]
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+Testing Enum Integer:
+ (succ (0::Integer)) = 1
+ (succ ((-1)::Integer)) = 0
+ pred (1::Integer) = 0
+ pred (0::Integer) = -1
+ (map (toEnum::Int->Integer) [1,minBound,maxBound]) = [1,-9223372036854775808,9223372036854775807]
+ (map fromEnum [(1::Integer),42,45]) = [1,42,45]
+ (take 7 [(1::Integer)..]) = [1,2,3,4,5,6,7]
+ (take 7 [(-5::Integer)..]) = [-5,-4,-3,-2,-1,0,1]
+ (take 7 [(1::Integer),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Integer),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Integer),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Integer),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Integer),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 ([(1::Integer) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Integer) .. 1])) = [1]
+ (take 7 ([(1::Integer) .. 0])) = []
+ (take 7 ([(5::Integer) .. 0])) = []
+ (take 7 [(5::Integer),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Integer),3..1]) = [5,3,1]
+ (take 7 [(5::Integer),3..2]) = [5,3]
+ (take 7 [(1::Integer),2..1]) = [1]
+ (take 7 [(2::Integer),1..2]) = [2]
+ (take 7 [(2::Integer),1..1]) = [2,1]
+ (take 7 [(2::Integer),3..1]) = []
+Testing Enum Char:
+ (succ 'a') = 'b'
+ (succ (minBound::Char)) = '\SOH'
+ (succ (maxBound::Char)) = error "Prelude.Enum.Char.succ: bad argument"
+ (pred 'b') = 'a'
+ pred (maxBound::Char) = '\1114110'
+ pred (minBound::Char) = error "Prelude.Enum.Char.pred: bad argument"
+ (map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]) = "{\NUL\1114111"
+ (toEnum::Int->Char) (minBound::Int) = error "Prelude.chr: bad argument: (-9223372036854775808)"
+ (map fromEnum ['X',minBound,maxBound]) = [88,0,1114111]
+ (take 7 ['\NUL' .. ]) = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK"
+ (take 7 ['\250' .. ]) = "\250\251\252\253\254\255\256"
+ (take 7 ['a','b'..]) = "abcdefg"
+ (take 7 ['a','e'..]) = "aeimquy"
+ (take 7 ['a','a'..]) = "aaaaaaa"
+ (take 7 ['z','y'..]) = "zyxwvut"
+ (take 7 ['z','v'..]) = "zvrnjfb"
+ (take 7 ['\1', '\0' ..]) = "\SOH\NUL"
+ (take 7 ['\5', '\4' ..]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+ (take 7 ['\250', '\251' ..]) = "\250\251\252\253\254\255\256"
+ (take 7 (['a' .. 'e'])) = "abcde"
+ (take 4 (['a' .. 'a'])) = "a"
+ (take 7 (['b' .. 'a'])) = ""
+ (take 7 (['e' .. 'a'])) = ""
+ (take 7 (['\250' .. '\255'])) = "\250\251\252\253\254\255"
+ (take 7 (['\5' .. '\0'])) = ""
+ (take 7 ['f','e' .. 'b']) = "fedcb"
+ (take 7 ['g','e' .. 'b']) = "gec"
+ (take 7 ['g','d' .. 'c']) = "gd"
+ (take 7 ['b','c' .. 'b']) = "b"
+ (take 7 ['c','b' .. 'c']) = "c"
+ (take 7 ['c','b' .. 'b']) = "cb"
+ (take 7 ['c','d' .. 'b']) = ""
+ (take 7 ['\251', '\252' .. maxBound]) = "\251\252\253\254\255\256\257"
+ (take 7 ['\5', '\4' .. minBound]) = "\ENQ\EOT\ETX\STX\SOH\NUL"
+Testing Enum ():
+ (succ ()) = error "Prelude.Enum.().succ: bad argument"
+ (succ (minBound::())) = error "Prelude.Enum.().succ: bad argument"
+ (succ (maxBound::())) = error "Prelude.Enum.().succ: bad argument"
+ (pred ()) = error "Prelude.Enum.().pred: bad argument"
+ (pred (minBound::())) = error "Prelude.Enum.().pred: bad argument"
+ (pred (maxBound::())) = error "Prelude.Enum.().pred: bad argument"
+ (toEnum 0)::() = ()
+ (toEnum 1)::() = error "Prelude.Enum.().toEnum: bad argument"
+ (fromEnum ()) = 0
+ (take 7 [()..]) = [()]
+ (take 7 [(),()..]) = [(),(),(),(),(),(),()]
+ (take 7 [()..()]) = [()]
+ (take 7 [(),()..()]) = [(),(),(),(),(),(),()]
+Testing Enum Ordering (derived):
+ (succ LT) = EQ
+ (succ (minBound::Ordering)) = EQ
+ (succ (maxBound::Ordering)) = error "Prelude.Enum.Ordering.succ: bad argument"
+ (pred GT) = EQ
+ (pred (maxBound::Ordering)) = EQ
+ (pred (minBound::Ordering)) = error "Prelude.Enum.Ordering.pred: bad argument"
+ (toEnum 0)::Ordering = LT
+ (toEnum 5)::Ordering = error "Prelude.Enum.Ordering.toEnum: bad argument"
+ (fromEnum LT) = 0
+ (fromEnum EQ) = 1
+ (fromEnum GT) = 2
+ ([LT ..]) = [LT,EQ,GT]
+ ([EQ ..]) = [EQ,GT]
+ ([GT ..]) = [GT]
+ ([LT,EQ ..]) = [LT,EQ,GT]
+ ([EQ,GT ..]) = [EQ,GT]
+ ([EQ,LT ..]) = [EQ,LT]
+ ([LT,GT ..]) = [LT,GT]
+ ([GT,LT ..]) = [GT,LT]
+ take 7 (([GT,GT ..])) = [GT,GT,GT,GT,GT,GT,GT]
+ take 7 (([LT,LT ..])) = [LT,LT,LT,LT,LT,LT,LT]
+ ([LT .. GT]) = [LT,EQ,GT]
+ ([LT .. EQ]) = [LT,EQ]
+ ([LT .. LT]) = [LT]
+ ([GT .. LT]) = []
+ ([GT .. EQ]) = []
+ ([GT .. GT]) = [GT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([GT,EQ .. EQ]) = [GT,EQ]
+ ([GT,EQ .. GT]) = [GT]
+ ([GT,EQ .. LT]) = [GT,EQ,LT]
+ ([LT,EQ .. LT]) = [LT]
+ ([LT,EQ .. GT]) = [LT,EQ,GT]
+ take 7 (([LT,LT .. GT])) = [LT,LT,LT,LT,LT,LT,LT]
+ take 7 (([GT,GT .. LT])) = []
+Testing Enum Bool:
+ (succ False) = True
+ (succ (minBound::Bool)) = True
+ (succ (maxBound::Bool)) = error "Prelude.Enum.Bool.succ: bad argument"
+ (pred True) = False
+ (pred (maxBound::Bool)) = False
+ (pred (minBound::Bool)) = error "Prelude.Enum.Bool.pred: bad argument"
+ (toEnum 0)::Bool = False
+ (toEnum 5)::Bool = error "Prelude.Enum.Bool.toEnum: bad argument"
+ (fromEnum False) = 0
+ (fromEnum True) = 1
+ ([False ..]) = [False,True]
+ ([True ..]) = [True]
+ ([False,True ..]) = [False,True]
+ ([True,False ..]) = [True,False]
+ (take 7 ([False,False ..])) = [False,False,False,False,False,False,False]
+ (take 7 ([True,True ..])) = [True,True,True,True,True,True,True]
+ ([False .. True]) = [False,True]
+ ([True .. False]) = []
+ take 7 ([False,False .. False]) = [False,False,False,False,False,False,False]
+ take 7 ([False,False .. True]) = [False,False,False,False,False,False,False]
+ take 7 ([False,True .. False]) = [False]
+ take 7 ([False,True .. True]) = [False,True]
+ take 7 ([True,False .. False]) = [True,False]
+ take 7 ([True,False .. True]) = [True]
+ take 7 ([True,True .. False]) = []
+ take 7 ([True,True .. True]) = [True,True,True,True,True,True,True]
+Testing Enum Rational:
+ (succ (0::Rational)) = 1 % 1
+ (succ ((-1)::Rational)) = 0 % 1
+ pred (1::Rational) = 0 % 1
+ pred (0::Rational) = (-1) % 1
+ (map (toEnum::Int->Rational) [1,minBound,maxBound]) = [1 % 1,(-9223372036854775808) % 1,9223372036854775807 % 1]
+ (map fromEnum [(1::Rational),42,45]) = [1,42,45]
+ (take 7 [(1::Rational)..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(-5::Rational)..]) = [(-5) % 1,(-4) % 1,(-3) % 1,(-2) % 1,(-1) % 1,0 % 1,1 % 1]
+ (take 7 [(1::Rational),2..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(1::Rational),7..]) = [1 % 1,7 % 1,13 % 1,19 % 1,25 % 1,31 % 1,37 % 1]
+ (take 7 [(1::Rational),1..]) = [1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1]
+ (take 7 [(1::Rational),0..]) = [1 % 1,0 % 1,(-1) % 1,(-2) % 1,(-3) % 1,(-4) % 1,(-5) % 1]
+ (take 7 [(5::Rational),2..]) = [5 % 1,2 % 1,(-1) % 1,(-4) % 1,(-7) % 1,(-10) % 1,(-13) % 1]
+ (take 7 ([(1::Rational) .. 5])) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
+ (take 4 ([(1::Rational) .. 1])) = [1 % 1]
+ (take 7 ([(1::Rational) .. 0])) = []
+ (take 7 ([(5::Rational) .. 0])) = []
+ (take 7 [(5::Rational),4..1]) = [5 % 1,4 % 1,3 % 1,2 % 1,1 % 1]
+ (take 7 [(5::Rational),3..1]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(5::Rational),3..2]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(1::Rational),2..1]) = [1 % 1]
+ (take 7 [(2::Rational),1..2]) = [2 % 1]
+ (take 7 [(2::Rational),1..1]) = [2 % 1,1 % 1]
+ (take 7 [(2::Rational),3..1]) = []
+Testing Enum (Ratio Int):
+ (succ (0::Ratio Int)) = 1 % 1
+ (succ ((-1)::Ratio Int)) = 0 % 1
+ pred (1::Ratio Int) = 0 % 1
+ pred (0::Ratio Int) = (-1) % 1
+ (map (toEnum::Int->Ratio Int) [1,minBound,maxBound]) = [1 % 1,(-9223372036854775808) % 1,9223372036854775807 % 1]
+ (map fromEnum [(1::Ratio Int),42,45]) = [1,42,45]
+ (take 7 [(1::Ratio Int)..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(-5::Ratio Int)..]) = [(-5) % 1,(-4) % 1,(-3) % 1,(-2) % 1,(-1) % 1,0 % 1,1 % 1]
+ (take 7 [((toEnum ((maxBound::Int)-5))::Ratio Int)..]) = [9223372036854775802 % 1,9223372036854775803 % 1,9223372036854775804 % 1,9223372036854775805 % 1,9223372036854775806 % 1,9223372036854775807 % 1,(-9223372036854775808) % 1]
+ (take 7 [(1::Ratio Int),2..]) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1,6 % 1,7 % 1]
+ (take 7 [(1::Ratio Int),7..]) = [1 % 1,7 % 1,13 % 1,19 % 1,25 % 1,31 % 1,37 % 1]
+ (take 7 [(1::Ratio Int),1..]) = [1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1,1 % 1]
+ (take 7 [(1::Ratio Int),0..]) = [1 % 1,0 % 1,(-1) % 1,(-2) % 1,(-3) % 1,(-4) % 1,(-5) % 1]
+ (take 7 [(5::Ratio Int),2..]) = [5 % 1,2 % 1,(-1) % 1,(-4) % 1,(-7) % 1,(-10) % 1,(-13) % 1]
+ (take 7 [x, x-1 ..]) = [(-9223372036854775807) % 1,(-9223372036854775808) % 1,9223372036854775807 % 1,9223372036854775806 % 1,9223372036854775805 % 1,9223372036854775804 % 1,9223372036854775803 % 1]
+ (take 7 [x, x-1 ..]) = [(-9223372036854775803) % 1,(-9223372036854775804) % 1,(-9223372036854775805) % 1,(-9223372036854775806) % 1,(-9223372036854775807) % 1,(-9223372036854775808) % 1,9223372036854775807 % 1]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802 % 1,9223372036854775803 % 1,9223372036854775804 % 1,9223372036854775805 % 1,9223372036854775806 % 1,9223372036854775807 % 1,(-9223372036854775808) % 1]
+ (take 7 ([(1::Ratio Int) .. 5])) = [1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
+ (take 4 ([(1::Ratio Int) .. 1])) = [1 % 1]
+ (take 7 ([(1::Ratio Int) .. 0])) = []
+ (take 7 ([(5::Ratio Int) .. 0])) = []
+ (take 7 ([x..y])) = [9223372036854775802 % 1,9223372036854775803 % 1,9223372036854775804 % 1,9223372036854775805 % 1,9223372036854775806 % 1,9223372036854775807 % 1]
+ (take 7 ([x..y])) = []
+ (take 7 [(5::Ratio Int),4..1]) = [5 % 1,4 % 1,3 % 1,2 % 1,1 % 1]
+ (take 7 [(5::Ratio Int),3..1]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(5::Ratio Int),3..2]) = [5 % 1,3 % 1,1 % 1]
+ (take 7 [(1::Ratio Int),2..1]) = [1 % 1]
+ (take 7 [(2::Ratio Int),1..2]) = [2 % 1]
+ (take 7 [(2::Ratio Int),1..1]) = [2 % 1,1 % 1]
+ (take 7 [(2::Ratio Int),3..1]) = []
+ (take 7 [x,(x+1)..y]) = [9223372036854775803 % 1,9223372036854775804 % 1,9223372036854775805 % 1,9223372036854775806 % 1,9223372036854775807 % 1]
+ (take 7 [x,(x-1)..y]) = [(-9223372036854775803) % 1,(-9223372036854775804) % 1,(-9223372036854775805) % 1,(-9223372036854775806) % 1,(-9223372036854775807) % 1,(-9223372036854775808) % 1]
diff --git a/testsuite/tests/lib/should_run/enum02.hs b/testsuite/tests/lib/should_run/enum02.hs
new file mode 100644
index 0000000000..3ba9d4912d
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum02.hs
@@ -0,0 +1,263 @@
+-- !!! Testing the Int Enum instances.
+module Main(main) where
+
+import Control.Exception
+import Prelude hiding (catch)
+import Data.Int
+
+main = do
+ putStrLn "Testing Enum Int8:"
+ testEnumInt8
+ putStrLn "Testing Enum Int16:"
+ testEnumInt16
+ putStrLn "Testing Enum Int32:"
+ testEnumInt32
+ putStrLn "Testing Enum Int64:"
+ testEnumInt64
+
+#define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) })
+
+testEnumInt8 :: IO ()
+testEnumInt8 = do
+ -- succ
+ printTest ((succ (0::Int8)))
+ printTest ((succ (minBound::Int8)))
+ mayBomb (printTest ((succ (maxBound::Int8))))
+
+ -- pred
+ printTest (pred (1::Int8))
+ printTest (pred (maxBound::Int8))
+ mayBomb (printTest (pred (minBound::Int8)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Int8) [1, fromIntegral (minBound::Int8), fromIntegral (maxBound::Int8)]))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Int8))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Int8),minBound,maxBound]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Int8)..]))
+ printTest ((take 7 [((maxBound::Int8)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Int8),2..]))
+ printTest ((take 7 [(1::Int8),7..]))
+ printTest ((take 7 [(1::Int8),1..]))
+ printTest ((take 7 [(1::Int8),0..]))
+ printTest ((take 7 [(5::Int8),2..]))
+ let x = (minBound::Int8) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Int8) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Int8) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Int8) .. 5])))
+ printTest ((take 4 ([(1::Int8) .. 1])))
+ printTest ((take 7 ([(1::Int8) .. 0])))
+ printTest ((take 7 ([(5::Int8) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Int8)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Int8)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Int8),4..1]))
+ printTest ((take 7 [(5::Int8),3..1]))
+ printTest ((take 7 [(5::Int8),3..2]))
+ printTest ((take 7 [(1::Int8),2..1]))
+ printTest ((take 7 [(2::Int8),1..2]))
+ printTest ((take 7 [(2::Int8),1..1]))
+ printTest ((take 7 [(2::Int8),3..1]))
+
+ let x = (maxBound::Int8) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Int8) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+testEnumInt16 :: IO ()
+testEnumInt16 = do
+ -- succ
+ printTest ((succ (0::Int16)))
+ printTest ((succ (minBound::Int16)))
+ mayBomb (printTest ((succ (maxBound::Int16))))
+
+ -- pred
+ printTest (pred (1::Int16))
+ printTest (pred (maxBound::Int16))
+ mayBomb (printTest (pred (minBound::Int16)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Int16) [1, fromIntegral (minBound::Int16), fromIntegral (maxBound::Int16)]))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Int16))
+
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Int16),minBound,maxBound]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Int16)..]))
+ printTest ((take 7 [((maxBound::Int16)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Int16),2..]))
+ printTest ((take 7 [(1::Int16),7..]))
+ printTest ((take 7 [(1::Int16),1..]))
+ printTest ((take 7 [(1::Int16),0..]))
+ printTest ((take 7 [(5::Int16),2..]))
+ let x = (minBound::Int16) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Int16) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Int16) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Int16) .. 5])))
+ printTest ((take 4 ([(1::Int16) .. 1])))
+ printTest ((take 7 ([(1::Int16) .. 0])))
+ printTest ((take 7 ([(5::Int16) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Int16)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Int16)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Int16),4..1]))
+ printTest ((take 7 [(5::Int16),3..1]))
+ printTest ((take 7 [(5::Int16),3..2]))
+ printTest ((take 7 [(1::Int16),2..1]))
+ printTest ((take 7 [(2::Int16),1..2]))
+ printTest ((take 7 [(2::Int16),1..1]))
+ printTest ((take 7 [(2::Int16),3..1]))
+
+ let x = (maxBound::Int16) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Int16) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+testEnumInt32 :: IO ()
+testEnumInt32 = do
+ -- succ
+ printTest ((succ (0::Int32)))
+ printTest ((succ (minBound::Int32)))
+ mayBomb (printTest ((succ (maxBound::Int32))))
+
+ -- pred
+ printTest (pred (1::Int32))
+ printTest (pred (maxBound::Int32))
+ mayBomb (printTest (pred (minBound::Int32)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Int32) [1, fromIntegral (minBound::Int32), fromIntegral (maxBound::Int32)]))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Int32))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Int32),minBound,maxBound]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Int32)..]))
+ printTest ((take 7 [((maxBound::Int32)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Int32),2..]))
+ printTest ((take 7 [(1::Int32),7..]))
+ printTest ((take 7 [(1::Int32),1..]))
+ printTest ((take 7 [(1::Int32),0..]))
+ printTest ((take 7 [(5::Int32),2..]))
+ let x = (minBound::Int32) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Int32) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Int32) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Int32) .. 5])))
+ printTest ((take 4 ([(1::Int32) .. 1])))
+ printTest ((take 7 ([(1::Int32) .. 0])))
+ printTest ((take 7 ([(5::Int32) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Int32)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Int32)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Int32),4..1]))
+ printTest ((take 7 [(5::Int32),3..1]))
+ printTest ((take 7 [(5::Int32),3..2]))
+ printTest ((take 7 [(1::Int32),2..1]))
+ printTest ((take 7 [(2::Int32),1..2]))
+ printTest ((take 7 [(2::Int32),1..1]))
+ printTest ((take 7 [(2::Int32),3..1]))
+
+ let x = (maxBound::Int32) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Int32) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+testEnumInt64 :: IO ()
+testEnumInt64 = do
+ -- succ
+ printTest ((succ (0::Int64)))
+ printTest ((succ (minBound::Int64)))
+ mayBomb (printTest ((succ (maxBound::Int64))))
+
+ -- pred
+ printTest (pred (1::Int64))
+ printTest (pred (maxBound::Int64))
+ mayBomb (printTest (pred (minBound::Int64)))
+
+ -- toEnum
+ mayBomb (printTest ((map (toEnum::Int->Int64) [1, fromIntegral (minBound::Int64), fromIntegral (maxBound::Int64)])))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Int64))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Int64),fromIntegral (minBound::Int) ,fromIntegral (maxBound::Int)]))
+ mayBomb (printTest (fromEnum (maxBound::Int64)))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Int64)..]))
+ printTest ((take 7 [((maxBound::Int64)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Int64),2..]))
+ printTest ((take 7 [(1::Int64),7..]))
+ printTest ((take 7 [(1::Int64),1..]))
+ printTest ((take 7 [(1::Int64),0..]))
+ printTest ((take 7 [(5::Int64),2..]))
+ let x = (minBound::Int64) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Int64) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Int64) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Int64) .. 5])))
+ printTest ((take 4 ([(1::Int64) .. 1])))
+ printTest ((take 7 ([(1::Int64) .. 0])))
+ printTest ((take 7 ([(5::Int64) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Int64)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Int64)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Int64),4..1]))
+ printTest ((take 7 [(5::Int64),3..1]))
+ printTest ((take 7 [(5::Int64),3..2]))
+ printTest ((take 7 [(1::Int64),2..1]))
+ printTest ((take 7 [(2::Int64),1..2]))
+ printTest ((take 7 [(2::Int64),1..1]))
+ printTest ((take 7 [(2::Int64),3..1]))
+
+ let x = (maxBound::Int64) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Int64) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+
+--
+--
+-- Utils
+--
+--
+
+
+mayBomb x = catch x (\(ErrorCall e) -> putStrLn ("error " ++ show e))
+ `catch` (\e -> putStrLn ("Fail: " ++ show (e :: SomeException)))
diff --git a/testsuite/tests/lib/should_run/enum02.stdout b/testsuite/tests/lib/should_run/enum02.stdout
new file mode 100644
index 0000000000..06d3bb5cae
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum02.stdout
@@ -0,0 +1,141 @@
+Testing Enum Int8:
+ (succ (0::Int8)) = 1
+ (succ (minBound::Int8)) = -127
+ (succ (maxBound::Int8)) = error "Enum.succ{Int8}: tried to take `succ' of maxBound"
+ pred (1::Int8) = 0
+ pred (maxBound::Int8) = 126
+ pred (minBound::Int8) = error "Enum.pred{Int8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int8) [1, fromIntegral (minBound::Int8), fromIntegral (maxBound::Int8)]) = [1,-128,127]
+ (toEnum (maxBound::Int))::Int8 = error "Enum.toEnum{Int8}: tag (2147483647) is outside of bounds (-128,127)"
+ (map fromEnum [(1::Int8),minBound,maxBound]) = [1,-128,127]
+ (take 7 [(1::Int8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int8)-5)..]) = [122,123,124,125,126,127]
+ (take 7 [(1::Int8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int8),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int8),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-127,-128]
+ (take 7 [x, x-1 ..]) = [-123,-124,-125,-126,-127,-128]
+ (take 7 [x, (x+1) ..]) = [122,123,124,125,126,127]
+ (take 7 ([(1::Int8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int8) .. 1])) = [1]
+ (take 7 ([(1::Int8) .. 0])) = []
+ (take 7 ([(5::Int8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int8)) .. maxBound])) = [122,123,124,125,126,127]
+ (take 7 ([(minBound+(5::Int8)) .. minBound])) = []
+ (take 7 [(5::Int8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int8),3..1]) = [5,3,1]
+ (take 7 [(5::Int8),3..2]) = [5,3]
+ (take 7 [(1::Int8),2..1]) = [1]
+ (take 7 [(2::Int8),1..2]) = [2]
+ (take 7 [(2::Int8),1..1]) = [2,1]
+ (take 7 [(2::Int8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [123,124,125,126,127]
+ (take 7 [x,(x-1)..minBound]) = [-123,-124,-125,-126,-127,-128]
+Testing Enum Int16:
+ (succ (0::Int16)) = 1
+ (succ (minBound::Int16)) = -32767
+ (succ (maxBound::Int16)) = error "Enum.succ{Int16}: tried to take `succ' of maxBound"
+ pred (1::Int16) = 0
+ pred (maxBound::Int16) = 32766
+ pred (minBound::Int16) = error "Enum.pred{Int16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int16) [1, fromIntegral (minBound::Int16), fromIntegral (maxBound::Int16)]) = [1,-32768,32767]
+ (toEnum (maxBound::Int))::Int16 = error "Enum.toEnum{Int16}: tag (2147483647) is outside of bounds (-32768,32767)"
+ (map fromEnum [(1::Int16),minBound,maxBound]) = [1,-32768,32767]
+ (take 7 [(1::Int16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int16)-5)..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 [(1::Int16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int16),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int16),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-32767,-32768]
+ (take 7 [x, x-1 ..]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+ (take 7 [x, (x+1) ..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(1::Int16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int16) .. 1])) = [1]
+ (take 7 ([(1::Int16) .. 0])) = []
+ (take 7 ([(5::Int16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int16)) .. maxBound])) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(minBound+(5::Int16)) .. minBound])) = []
+ (take 7 [(5::Int16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int16),3..1]) = [5,3,1]
+ (take 7 [(5::Int16),3..2]) = [5,3]
+ (take 7 [(1::Int16),2..1]) = [1]
+ (take 7 [(2::Int16),1..2]) = [2]
+ (take 7 [(2::Int16),1..1]) = [2,1]
+ (take 7 [(2::Int16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [32763,32764,32765,32766,32767]
+ (take 7 [x,(x-1)..minBound]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+Testing Enum Int32:
+ (succ (0::Int32)) = 1
+ (succ (minBound::Int32)) = -2147483647
+ (succ (maxBound::Int32)) = error "Enum.succ{Int32}: tried to take `succ' of maxBound"
+ pred (1::Int32) = 0
+ pred (maxBound::Int32) = 2147483646
+ pred (minBound::Int32) = error "Enum.pred{Int32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int32) [1, fromIntegral (minBound::Int32), fromIntegral (maxBound::Int32)]) = [1,-2147483648,2147483647]
+ (toEnum (maxBound::Int))::Int32 = 2147483647
+ (map fromEnum [(1::Int32),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int32)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int32),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int32),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(1::Int32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int32) .. 1])) = [1]
+ (take 7 ([(1::Int32) .. 0])) = []
+ (take 7 ([(5::Int32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int32)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int32)) .. minBound])) = []
+ (take 7 [(5::Int32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int32),3..1]) = [5,3,1]
+ (take 7 [(5::Int32),3..2]) = [5,3]
+ (take 7 [(1::Int32),2..1]) = [1]
+ (take 7 [(2::Int32),1..2]) = [2]
+ (take 7 [(2::Int32),1..1]) = [2,1]
+ (take 7 [(2::Int32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Int64:
+ (succ (0::Int64)) = 1
+ (succ (minBound::Int64)) = -9223372036854775807
+ (succ (maxBound::Int64)) = error "Enum.succ{Int64}: tried to take `succ' of maxBound"
+ pred (1::Int64) = 0
+ pred (maxBound::Int64) = 9223372036854775806
+ pred (minBound::Int64) = error "Enum.pred{Int64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int64) [1, fromIntegral (minBound::Int64), fromIntegral (maxBound::Int64)]) = [1,0,-1]
+ (toEnum (maxBound::Int))::Int64 = 2147483647
+ (map fromEnum [(1::Int64),fromIntegral (minBound::Int) ,fromIntegral (maxBound::Int)]) = [1,-2147483648,2147483647]
+ fromEnum (maxBound::Int64) = error "Enum.fromEnum{Int64}: value (9223372036854775807) is outside of Int's bounds (-2147483648,2147483647)"
+ (take 7 [(1::Int64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int64)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int64),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int64),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(1::Int64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int64) .. 1])) = [1]
+ (take 7 ([(1::Int64) .. 0])) = []
+ (take 7 ([(5::Int64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int64)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int64)) .. minBound])) = []
+ (take 7 [(5::Int64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int64),3..1]) = [5,3,1]
+ (take 7 [(5::Int64),3..2]) = [5,3]
+ (take 7 [(1::Int64),2..1]) = [1]
+ (take 7 [(2::Int64),1..2]) = [2]
+ (take 7 [(2::Int64),1..1]) = [2,1]
+ (take 7 [(2::Int64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
diff --git a/testsuite/tests/lib/should_run/enum02.stdout-alpha-dec-osf3 b/testsuite/tests/lib/should_run/enum02.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..23222450b5
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum02.stdout-alpha-dec-osf3
@@ -0,0 +1,141 @@
+Testing Enum Int8:
+ (succ (0::Int8)) = 1
+ (succ (minBound::Int8)) = -127
+ (succ (maxBound::Int8)) = error "Enum.succ{Int8}: tried to take `succ' of maxBound"
+ pred (1::Int8) = 0
+ pred (maxBound::Int8) = 126
+ pred (minBound::Int8) = error "Enum.pred{Int8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int8) [1, toInt (minBound::Int8), toInt (maxBound::Int8)]) = [1,-128,127]
+ (toEnum (maxBound::Int))::Int8 = error "Enum.toEnum{Int8}: tag (9223372036854775807) is outside of bounds (-128,127)"
+ (map fromEnum [(1::Int8),minBound,maxBound]) = [1,-128,127]
+ (take 7 [(1::Int8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int8)-5)..]) = [122,123,124,125,126,127]
+ (take 7 [(1::Int8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int8),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int8),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-127,-128]
+ (take 7 [x, x-1 ..]) = [-123,-124,-125,-126,-127,-128]
+ (take 7 [x, (x+1) ..]) = [122,123,124,125,126,127]
+ (take 7 ([(1::Int8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int8) .. 1])) = [1]
+ (take 7 ([(1::Int8) .. 0])) = []
+ (take 7 ([(5::Int8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int8)) .. maxBound])) = [122,123,124,125,126,127]
+ (take 7 ([(minBound+(5::Int8)) .. minBound])) = []
+ (take 7 [(5::Int8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int8),3..1]) = [5,3,1]
+ (take 7 [(5::Int8),3..2]) = [5,3]
+ (take 7 [(1::Int8),2..1]) = [1]
+ (take 7 [(2::Int8),1..2]) = [2]
+ (take 7 [(2::Int8),1..1]) = [2,1]
+ (take 7 [(2::Int8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [123,124,125,126,127]
+ (take 7 [x,(x-1)..minBound]) = [-123,-124,-125,-126,-127,-128]
+Testing Enum Int16:
+ (succ (0::Int16)) = 1
+ (succ (minBound::Int16)) = -32767
+ (succ (maxBound::Int16)) = error "Enum.succ{Int16}: tried to take `succ' of maxBound"
+ pred (1::Int16) = 0
+ pred (maxBound::Int16) = 32766
+ pred (minBound::Int16) = error "Enum.pred{Int16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int16) [1, toInt (minBound::Int16), toInt (maxBound::Int16)]) = [1,-32768,32767]
+ (toEnum (maxBound::Int))::Int16 = error "Enum.toEnum{Int16}: tag (9223372036854775807) is outside of bounds (-32768,32767)"
+ (map fromEnum [(1::Int16),minBound,maxBound]) = [1,-32768,32767]
+ (take 7 [(1::Int16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int16)-5)..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 [(1::Int16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int16),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int16),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-32767,-32768]
+ (take 7 [x, x-1 ..]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+ (take 7 [x, (x+1) ..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(1::Int16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int16) .. 1])) = [1]
+ (take 7 ([(1::Int16) .. 0])) = []
+ (take 7 ([(5::Int16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int16)) .. maxBound])) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(minBound+(5::Int16)) .. minBound])) = []
+ (take 7 [(5::Int16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int16),3..1]) = [5,3,1]
+ (take 7 [(5::Int16),3..2]) = [5,3]
+ (take 7 [(1::Int16),2..1]) = [1]
+ (take 7 [(2::Int16),1..2]) = [2]
+ (take 7 [(2::Int16),1..1]) = [2,1]
+ (take 7 [(2::Int16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [32763,32764,32765,32766,32767]
+ (take 7 [x,(x-1)..minBound]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+Testing Enum Int32:
+ (succ (0::Int32)) = 1
+ (succ (minBound::Int32)) = -2147483647
+ (succ (maxBound::Int32)) = error "Enum.succ{Int32}: tried to take `succ' of maxBound"
+ pred (1::Int32) = 0
+ pred (maxBound::Int32) = 2147483646
+ pred (minBound::Int32) = error "Enum.pred{Int32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int32) [1, toInt (minBound::Int32), toInt (maxBound::Int32)]) = [1,-2147483648,2147483647]
+ (toEnum (maxBound::Int))::Int32 = error "Enum.toEnum{Int32}: tag (9223372036854775807) is outside of bounds (-2147483648,2147483647)"
+ (map fromEnum [(1::Int32),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int32)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int32),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int32),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(1::Int32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int32) .. 1])) = [1]
+ (take 7 ([(1::Int32) .. 0])) = []
+ (take 7 ([(5::Int32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int32)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int32)) .. minBound])) = []
+ (take 7 [(5::Int32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int32),3..1]) = [5,3,1]
+ (take 7 [(5::Int32),3..2]) = [5,3]
+ (take 7 [(1::Int32),2..1]) = [1]
+ (take 7 [(2::Int32),1..2]) = [2]
+ (take 7 [(2::Int32),1..1]) = [2,1]
+ (take 7 [(2::Int32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Int64:
+ (succ (0::Int64)) = 1
+ (succ (minBound::Int64)) = -9223372036854775807
+ (succ (maxBound::Int64)) = error "Enum.succ{Int64}: tried to take `succ' of maxBound"
+ pred (1::Int64) = 0
+ pred (maxBound::Int64) = 9223372036854775806
+ pred (minBound::Int64) = error "Enum.pred{Int64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int64) [1, toInt (minBound::Int64), toInt (maxBound::Int64)]) = [1,-9223372036854775808,9223372036854775807]
+ (toEnum (maxBound::Int))::Int64 = 9223372036854775807
+ (map fromEnum [(1::Int64),fromInt (minBound::Int) ,fromInt (maxBound::Int)]) = [1,-9223372036854775808,9223372036854775807]
+ fromEnum (maxBound::Int64) = 9223372036854775807
+ (take 7 [(1::Int64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int64)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int64),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int64),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(1::Int64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int64) .. 1])) = [1]
+ (take 7 ([(1::Int64) .. 0])) = []
+ (take 7 ([(5::Int64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int64)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int64)) .. minBound])) = []
+ (take 7 [(5::Int64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int64),3..1]) = [5,3,1]
+ (take 7 [(5::Int64),3..2]) = [5,3]
+ (take 7 [(1::Int64),2..1]) = [1]
+ (take 7 [(2::Int64),1..2]) = [2]
+ (take 7 [(2::Int64),1..1]) = [2,1]
+ (take 7 [(2::Int64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
diff --git a/testsuite/tests/lib/should_run/enum02.stdout-hugs b/testsuite/tests/lib/should_run/enum02.stdout-hugs
new file mode 100644
index 0000000000..a28b84b187
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum02.stdout-hugs
@@ -0,0 +1,141 @@
+Testing Enum Int8:
+ (succ (0::Int8)) = 1
+ (succ (minBound::Int8)) = -127
+ (succ (maxBound::Int8)) = error "succ: applied to maxBound"
+ pred (1::Int8) = 0
+ pred (maxBound::Int8) = 126
+ pred (minBound::Int8) = error "pred: applied to minBound"
+ (map (toEnum::Int->Int8) [1, fromIntegral (minBound::Int8), fromIntegral (maxBound::Int8)]) = [1,-128,127]
+ (toEnum (maxBound::Int))::Int8 = -1
+ (map fromEnum [(1::Int8),minBound,maxBound]) = [1,-128,127]
+ (take 7 [(1::Int8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int8)-5)..]) = [122,123,124,125,126,127]
+ (take 7 [(1::Int8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int8),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int8),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-127,-128]
+ (take 7 [x, x-1 ..]) = [-123,-124,-125,-126,-127,-128]
+ (take 7 [x, (x+1) ..]) = [122,123,124,125,126,127]
+ (take 7 ([(1::Int8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int8) .. 1])) = [1]
+ (take 7 ([(1::Int8) .. 0])) = []
+ (take 7 ([(5::Int8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int8)) .. maxBound])) = [122,123,124,125,126,127]
+ (take 7 ([(minBound+(5::Int8)) .. minBound])) = []
+ (take 7 [(5::Int8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int8),3..1]) = [5,3,1]
+ (take 7 [(5::Int8),3..2]) = [5,3]
+ (take 7 [(1::Int8),2..1]) = [1]
+ (take 7 [(2::Int8),1..2]) = [2]
+ (take 7 [(2::Int8),1..1]) = [2,1]
+ (take 7 [(2::Int8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [123,124,125,126,127]
+ (take 7 [x,(x-1)..minBound]) = [-123,-124,-125,-126,-127,-128]
+Testing Enum Int16:
+ (succ (0::Int16)) = 1
+ (succ (minBound::Int16)) = -32767
+ (succ (maxBound::Int16)) = error "succ: applied to maxBound"
+ pred (1::Int16) = 0
+ pred (maxBound::Int16) = 32766
+ pred (minBound::Int16) = error "pred: applied to minBound"
+ (map (toEnum::Int->Int16) [1, fromIntegral (minBound::Int16), fromIntegral (maxBound::Int16)]) = [1,-32768,32767]
+ (toEnum (maxBound::Int))::Int16 = -1
+ (map fromEnum [(1::Int16),minBound,maxBound]) = [1,-32768,32767]
+ (take 7 [(1::Int16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int16)-5)..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 [(1::Int16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int16),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int16),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-32767,-32768]
+ (take 7 [x, x-1 ..]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+ (take 7 [x, (x+1) ..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(1::Int16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int16) .. 1])) = [1]
+ (take 7 ([(1::Int16) .. 0])) = []
+ (take 7 ([(5::Int16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int16)) .. maxBound])) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(minBound+(5::Int16)) .. minBound])) = []
+ (take 7 [(5::Int16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int16),3..1]) = [5,3,1]
+ (take 7 [(5::Int16),3..2]) = [5,3]
+ (take 7 [(1::Int16),2..1]) = [1]
+ (take 7 [(2::Int16),1..2]) = [2]
+ (take 7 [(2::Int16),1..1]) = [2,1]
+ (take 7 [(2::Int16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [32763,32764,32765,32766,32767]
+ (take 7 [x,(x-1)..minBound]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+Testing Enum Int32:
+ (succ (0::Int32)) = 1
+ (succ (minBound::Int32)) = -2147483647
+ (succ (maxBound::Int32)) = error "succ: applied to maxBound"
+ pred (1::Int32) = 0
+ pred (maxBound::Int32) = 2147483646
+ pred (minBound::Int32) = error "pred: applied to minBound"
+ (map (toEnum::Int->Int32) [1, fromIntegral (minBound::Int32), fromIntegral (maxBound::Int32)]) = [1,-2147483648,2147483647]
+ (toEnum (maxBound::Int))::Int32 = 2147483647
+ (map fromEnum [(1::Int32),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int32)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int32),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int32),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(1::Int32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int32) .. 1])) = [1]
+ (take 7 ([(1::Int32) .. 0])) = []
+ (take 7 ([(5::Int32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int32)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int32)) .. minBound])) = []
+ (take 7 [(5::Int32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int32),3..1]) = [5,3,1]
+ (take 7 [(5::Int32),3..2]) = [5,3]
+ (take 7 [(1::Int32),2..1]) = [1]
+ (take 7 [(2::Int32),1..2]) = [2]
+ (take 7 [(2::Int32),1..1]) = [2,1]
+ (take 7 [(2::Int32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Int64:
+ (succ (0::Int64)) = 1
+ (succ (minBound::Int64)) = -9223372036854775807
+ (succ (maxBound::Int64)) = error "succ: applied to maxBound"
+ pred (1::Int64) = 0
+ pred (maxBound::Int64) = 9223372036854775806
+ pred (minBound::Int64) = error "pred: applied to minBound"
+ (map (toEnum::Int->Int64) [1, fromIntegral (minBound::Int64), fromIntegral (maxBound::Int64)]) = [1,Fail: arithmetic overflow
+ (toEnum (maxBound::Int))::Int64 = 2147483647
+ (map fromEnum [(1::Int64),fromIntegral (minBound::Int) ,fromIntegral (maxBound::Int)]) = [1,-2147483648,2147483647]
+ fromEnum (maxBound::Int64) = Fail: arithmetic overflow
+ (take 7 [(1::Int64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int64)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int64),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int64),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(1::Int64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int64) .. 1])) = [1]
+ (take 7 ([(1::Int64) .. 0])) = []
+ (take 7 ([(5::Int64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int64)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int64)) .. minBound])) = []
+ (take 7 [(5::Int64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int64),3..1]) = [5,3,1]
+ (take 7 [(5::Int64),3..2]) = [5,3]
+ (take 7 [(1::Int64),2..1]) = [1]
+ (take 7 [(2::Int64),1..2]) = [2]
+ (take 7 [(2::Int64),1..1]) = [2,1]
+ (take 7 [(2::Int64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
diff --git a/testsuite/tests/lib/should_run/enum02.stdout-mips-sgi-irix b/testsuite/tests/lib/should_run/enum02.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..3177d541f4
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum02.stdout-mips-sgi-irix
@@ -0,0 +1,141 @@
+Testing Enum Int8:
+ (succ (0::Int8)) = 1
+ (succ (minBound::Int8)) = -127
+ (succ (maxBound::Int8)) = error "Enum.succ{Int8}: tried to take `succ' of maxBound"
+ pred (1::Int8) = 0
+ pred (maxBound::Int8) = 126
+ pred (minBound::Int8) = error "Enum.pred{Int8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int8) [1, fromIntegral (minBound::Int8), fromIntegral (maxBound::Int8)]) = [1,-128,127]
+ (toEnum (maxBound::Int))::Int8 = error "Enum.toEnum{Int8}: tag (9223372036854775807) is outside of bounds (-128,127)"
+ (map fromEnum [(1::Int8),minBound,maxBound]) = [1,-128,127]
+ (take 7 [(1::Int8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int8)-5)..]) = [122,123,124,125,126,127]
+ (take 7 [(1::Int8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int8),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int8),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-127,-128]
+ (take 7 [x, x-1 ..]) = [-123,-124,-125,-126,-127,-128]
+ (take 7 [x, (x+1) ..]) = [122,123,124,125,126,127]
+ (take 7 ([(1::Int8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int8) .. 1])) = [1]
+ (take 7 ([(1::Int8) .. 0])) = []
+ (take 7 ([(5::Int8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int8)) .. maxBound])) = [122,123,124,125,126,127]
+ (take 7 ([(minBound+(5::Int8)) .. minBound])) = []
+ (take 7 [(5::Int8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int8),3..1]) = [5,3,1]
+ (take 7 [(5::Int8),3..2]) = [5,3]
+ (take 7 [(1::Int8),2..1]) = [1]
+ (take 7 [(2::Int8),1..2]) = [2]
+ (take 7 [(2::Int8),1..1]) = [2,1]
+ (take 7 [(2::Int8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [123,124,125,126,127]
+ (take 7 [x,(x-1)..minBound]) = [-123,-124,-125,-126,-127,-128]
+Testing Enum Int16:
+ (succ (0::Int16)) = 1
+ (succ (minBound::Int16)) = -32767
+ (succ (maxBound::Int16)) = error "Enum.succ{Int16}: tried to take `succ' of maxBound"
+ pred (1::Int16) = 0
+ pred (maxBound::Int16) = 32766
+ pred (minBound::Int16) = error "Enum.pred{Int16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int16) [1, fromIntegral (minBound::Int16), fromIntegral (maxBound::Int16)]) = [1,-32768,32767]
+ (toEnum (maxBound::Int))::Int16 = error "Enum.toEnum{Int16}: tag (9223372036854775807) is outside of bounds (-32768,32767)"
+ (map fromEnum [(1::Int16),minBound,maxBound]) = [1,-32768,32767]
+ (take 7 [(1::Int16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int16)-5)..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 [(1::Int16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int16),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int16),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-32767,-32768]
+ (take 7 [x, x-1 ..]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+ (take 7 [x, (x+1) ..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(1::Int16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int16) .. 1])) = [1]
+ (take 7 ([(1::Int16) .. 0])) = []
+ (take 7 ([(5::Int16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int16)) .. maxBound])) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(minBound+(5::Int16)) .. minBound])) = []
+ (take 7 [(5::Int16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int16),3..1]) = [5,3,1]
+ (take 7 [(5::Int16),3..2]) = [5,3]
+ (take 7 [(1::Int16),2..1]) = [1]
+ (take 7 [(2::Int16),1..2]) = [2]
+ (take 7 [(2::Int16),1..1]) = [2,1]
+ (take 7 [(2::Int16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [32763,32764,32765,32766,32767]
+ (take 7 [x,(x-1)..minBound]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+Testing Enum Int32:
+ (succ (0::Int32)) = 1
+ (succ (minBound::Int32)) = -2147483647
+ (succ (maxBound::Int32)) = error "Enum.succ{Int32}: tried to take `succ' of maxBound"
+ pred (1::Int32) = 0
+ pred (maxBound::Int32) = 2147483646
+ pred (minBound::Int32) = error "Enum.pred{Int32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int32) [1, fromIntegral (minBound::Int32), fromIntegral (maxBound::Int32)]) = [1,-2147483648,2147483647]
+ (toEnum (maxBound::Int))::Int32 = error "Enum.toEnum{Int32}: tag (9223372036854775807) is outside of bounds (-2147483648,2147483647)"
+ (map fromEnum [(1::Int32),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int32)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int32),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int32),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(1::Int32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int32) .. 1])) = [1]
+ (take 7 ([(1::Int32) .. 0])) = []
+ (take 7 ([(5::Int32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int32)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int32)) .. minBound])) = []
+ (take 7 [(5::Int32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int32),3..1]) = [5,3,1]
+ (take 7 [(5::Int32),3..2]) = [5,3]
+ (take 7 [(1::Int32),2..1]) = [1]
+ (take 7 [(2::Int32),1..2]) = [2]
+ (take 7 [(2::Int32),1..1]) = [2,1]
+ (take 7 [(2::Int32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Int64:
+ (succ (0::Int64)) = 1
+ (succ (minBound::Int64)) = -9223372036854775807
+ (succ (maxBound::Int64)) = error "Enum.succ{Int64}: tried to take `succ' of maxBound"
+ pred (1::Int64) = 0
+ pred (maxBound::Int64) = 9223372036854775806
+ pred (minBound::Int64) = error "Enum.pred{Int64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int64) [1, fromIntegral (minBound::Int64), fromIntegral (maxBound::Int64)]) = [1,-9223372036854775808,9223372036854775807]
+ (toEnum (maxBound::Int))::Int64 = 9223372036854775807
+ (map fromEnum [(1::Int64),fromIntegral (minBound::Int) ,fromIntegral (maxBound::Int)]) = [1,-9223372036854775808,9223372036854775807]
+ fromEnum (maxBound::Int64) = 9223372036854775807
+ (take 7 [(1::Int64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int64)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int64),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int64),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(1::Int64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int64) .. 1])) = [1]
+ (take 7 ([(1::Int64) .. 0])) = []
+ (take 7 ([(5::Int64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int64)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int64)) .. minBound])) = []
+ (take 7 [(5::Int64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int64),3..1]) = [5,3,1]
+ (take 7 [(5::Int64),3..2]) = [5,3]
+ (take 7 [(1::Int64),2..1]) = [1]
+ (take 7 [(2::Int64),1..2]) = [2]
+ (take 7 [(2::Int64),1..1]) = [2,1]
+ (take 7 [(2::Int64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
diff --git a/testsuite/tests/lib/should_run/enum02.stdout-ws-64 b/testsuite/tests/lib/should_run/enum02.stdout-ws-64
new file mode 100644
index 0000000000..3177d541f4
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum02.stdout-ws-64
@@ -0,0 +1,141 @@
+Testing Enum Int8:
+ (succ (0::Int8)) = 1
+ (succ (minBound::Int8)) = -127
+ (succ (maxBound::Int8)) = error "Enum.succ{Int8}: tried to take `succ' of maxBound"
+ pred (1::Int8) = 0
+ pred (maxBound::Int8) = 126
+ pred (minBound::Int8) = error "Enum.pred{Int8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int8) [1, fromIntegral (minBound::Int8), fromIntegral (maxBound::Int8)]) = [1,-128,127]
+ (toEnum (maxBound::Int))::Int8 = error "Enum.toEnum{Int8}: tag (9223372036854775807) is outside of bounds (-128,127)"
+ (map fromEnum [(1::Int8),minBound,maxBound]) = [1,-128,127]
+ (take 7 [(1::Int8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int8)-5)..]) = [122,123,124,125,126,127]
+ (take 7 [(1::Int8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int8),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int8),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-127,-128]
+ (take 7 [x, x-1 ..]) = [-123,-124,-125,-126,-127,-128]
+ (take 7 [x, (x+1) ..]) = [122,123,124,125,126,127]
+ (take 7 ([(1::Int8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int8) .. 1])) = [1]
+ (take 7 ([(1::Int8) .. 0])) = []
+ (take 7 ([(5::Int8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int8)) .. maxBound])) = [122,123,124,125,126,127]
+ (take 7 ([(minBound+(5::Int8)) .. minBound])) = []
+ (take 7 [(5::Int8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int8),3..1]) = [5,3,1]
+ (take 7 [(5::Int8),3..2]) = [5,3]
+ (take 7 [(1::Int8),2..1]) = [1]
+ (take 7 [(2::Int8),1..2]) = [2]
+ (take 7 [(2::Int8),1..1]) = [2,1]
+ (take 7 [(2::Int8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [123,124,125,126,127]
+ (take 7 [x,(x-1)..minBound]) = [-123,-124,-125,-126,-127,-128]
+Testing Enum Int16:
+ (succ (0::Int16)) = 1
+ (succ (minBound::Int16)) = -32767
+ (succ (maxBound::Int16)) = error "Enum.succ{Int16}: tried to take `succ' of maxBound"
+ pred (1::Int16) = 0
+ pred (maxBound::Int16) = 32766
+ pred (minBound::Int16) = error "Enum.pred{Int16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int16) [1, fromIntegral (minBound::Int16), fromIntegral (maxBound::Int16)]) = [1,-32768,32767]
+ (toEnum (maxBound::Int))::Int16 = error "Enum.toEnum{Int16}: tag (9223372036854775807) is outside of bounds (-32768,32767)"
+ (map fromEnum [(1::Int16),minBound,maxBound]) = [1,-32768,32767]
+ (take 7 [(1::Int16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int16)-5)..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 [(1::Int16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int16),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int16),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-32767,-32768]
+ (take 7 [x, x-1 ..]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+ (take 7 [x, (x+1) ..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(1::Int16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int16) .. 1])) = [1]
+ (take 7 ([(1::Int16) .. 0])) = []
+ (take 7 ([(5::Int16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int16)) .. maxBound])) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(minBound+(5::Int16)) .. minBound])) = []
+ (take 7 [(5::Int16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int16),3..1]) = [5,3,1]
+ (take 7 [(5::Int16),3..2]) = [5,3]
+ (take 7 [(1::Int16),2..1]) = [1]
+ (take 7 [(2::Int16),1..2]) = [2]
+ (take 7 [(2::Int16),1..1]) = [2,1]
+ (take 7 [(2::Int16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [32763,32764,32765,32766,32767]
+ (take 7 [x,(x-1)..minBound]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+Testing Enum Int32:
+ (succ (0::Int32)) = 1
+ (succ (minBound::Int32)) = -2147483647
+ (succ (maxBound::Int32)) = error "Enum.succ{Int32}: tried to take `succ' of maxBound"
+ pred (1::Int32) = 0
+ pred (maxBound::Int32) = 2147483646
+ pred (minBound::Int32) = error "Enum.pred{Int32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int32) [1, fromIntegral (minBound::Int32), fromIntegral (maxBound::Int32)]) = [1,-2147483648,2147483647]
+ (toEnum (maxBound::Int))::Int32 = error "Enum.toEnum{Int32}: tag (9223372036854775807) is outside of bounds (-2147483648,2147483647)"
+ (map fromEnum [(1::Int32),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int32)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int32),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int32),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(1::Int32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int32) .. 1])) = [1]
+ (take 7 ([(1::Int32) .. 0])) = []
+ (take 7 ([(5::Int32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int32)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int32)) .. minBound])) = []
+ (take 7 [(5::Int32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int32),3..1]) = [5,3,1]
+ (take 7 [(5::Int32),3..2]) = [5,3]
+ (take 7 [(1::Int32),2..1]) = [1]
+ (take 7 [(2::Int32),1..2]) = [2]
+ (take 7 [(2::Int32),1..1]) = [2,1]
+ (take 7 [(2::Int32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Int64:
+ (succ (0::Int64)) = 1
+ (succ (minBound::Int64)) = -9223372036854775807
+ (succ (maxBound::Int64)) = error "Enum.succ{Int64}: tried to take `succ' of maxBound"
+ pred (1::Int64) = 0
+ pred (maxBound::Int64) = 9223372036854775806
+ pred (minBound::Int64) = error "Enum.pred{Int64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int64) [1, fromIntegral (minBound::Int64), fromIntegral (maxBound::Int64)]) = [1,-9223372036854775808,9223372036854775807]
+ (toEnum (maxBound::Int))::Int64 = 9223372036854775807
+ (map fromEnum [(1::Int64),fromIntegral (minBound::Int) ,fromIntegral (maxBound::Int)]) = [1,-9223372036854775808,9223372036854775807]
+ fromEnum (maxBound::Int64) = 9223372036854775807
+ (take 7 [(1::Int64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int64)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int64),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int64),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(1::Int64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int64) .. 1])) = [1]
+ (take 7 ([(1::Int64) .. 0])) = []
+ (take 7 ([(5::Int64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int64)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int64)) .. minBound])) = []
+ (take 7 [(5::Int64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int64),3..1]) = [5,3,1]
+ (take 7 [(5::Int64),3..2]) = [5,3]
+ (take 7 [(1::Int64),2..1]) = [1]
+ (take 7 [(2::Int64),1..2]) = [2]
+ (take 7 [(2::Int64),1..1]) = [2,1]
+ (take 7 [(2::Int64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
diff --git a/testsuite/tests/lib/should_run/enum02.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/should_run/enum02.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..3177d541f4
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum02.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,141 @@
+Testing Enum Int8:
+ (succ (0::Int8)) = 1
+ (succ (minBound::Int8)) = -127
+ (succ (maxBound::Int8)) = error "Enum.succ{Int8}: tried to take `succ' of maxBound"
+ pred (1::Int8) = 0
+ pred (maxBound::Int8) = 126
+ pred (minBound::Int8) = error "Enum.pred{Int8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int8) [1, fromIntegral (minBound::Int8), fromIntegral (maxBound::Int8)]) = [1,-128,127]
+ (toEnum (maxBound::Int))::Int8 = error "Enum.toEnum{Int8}: tag (9223372036854775807) is outside of bounds (-128,127)"
+ (map fromEnum [(1::Int8),minBound,maxBound]) = [1,-128,127]
+ (take 7 [(1::Int8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int8)-5)..]) = [122,123,124,125,126,127]
+ (take 7 [(1::Int8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int8),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int8),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-127,-128]
+ (take 7 [x, x-1 ..]) = [-123,-124,-125,-126,-127,-128]
+ (take 7 [x, (x+1) ..]) = [122,123,124,125,126,127]
+ (take 7 ([(1::Int8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int8) .. 1])) = [1]
+ (take 7 ([(1::Int8) .. 0])) = []
+ (take 7 ([(5::Int8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int8)) .. maxBound])) = [122,123,124,125,126,127]
+ (take 7 ([(minBound+(5::Int8)) .. minBound])) = []
+ (take 7 [(5::Int8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int8),3..1]) = [5,3,1]
+ (take 7 [(5::Int8),3..2]) = [5,3]
+ (take 7 [(1::Int8),2..1]) = [1]
+ (take 7 [(2::Int8),1..2]) = [2]
+ (take 7 [(2::Int8),1..1]) = [2,1]
+ (take 7 [(2::Int8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [123,124,125,126,127]
+ (take 7 [x,(x-1)..minBound]) = [-123,-124,-125,-126,-127,-128]
+Testing Enum Int16:
+ (succ (0::Int16)) = 1
+ (succ (minBound::Int16)) = -32767
+ (succ (maxBound::Int16)) = error "Enum.succ{Int16}: tried to take `succ' of maxBound"
+ pred (1::Int16) = 0
+ pred (maxBound::Int16) = 32766
+ pred (minBound::Int16) = error "Enum.pred{Int16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int16) [1, fromIntegral (minBound::Int16), fromIntegral (maxBound::Int16)]) = [1,-32768,32767]
+ (toEnum (maxBound::Int))::Int16 = error "Enum.toEnum{Int16}: tag (9223372036854775807) is outside of bounds (-32768,32767)"
+ (map fromEnum [(1::Int16),minBound,maxBound]) = [1,-32768,32767]
+ (take 7 [(1::Int16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int16)-5)..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 [(1::Int16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int16),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int16),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-32767,-32768]
+ (take 7 [x, x-1 ..]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+ (take 7 [x, (x+1) ..]) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(1::Int16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int16) .. 1])) = [1]
+ (take 7 ([(1::Int16) .. 0])) = []
+ (take 7 ([(5::Int16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int16)) .. maxBound])) = [32762,32763,32764,32765,32766,32767]
+ (take 7 ([(minBound+(5::Int16)) .. minBound])) = []
+ (take 7 [(5::Int16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int16),3..1]) = [5,3,1]
+ (take 7 [(5::Int16),3..2]) = [5,3]
+ (take 7 [(1::Int16),2..1]) = [1]
+ (take 7 [(2::Int16),1..2]) = [2]
+ (take 7 [(2::Int16),1..1]) = [2,1]
+ (take 7 [(2::Int16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [32763,32764,32765,32766,32767]
+ (take 7 [x,(x-1)..minBound]) = [-32763,-32764,-32765,-32766,-32767,-32768]
+Testing Enum Int32:
+ (succ (0::Int32)) = 1
+ (succ (minBound::Int32)) = -2147483647
+ (succ (maxBound::Int32)) = error "Enum.succ{Int32}: tried to take `succ' of maxBound"
+ pred (1::Int32) = 0
+ pred (maxBound::Int32) = 2147483646
+ pred (minBound::Int32) = error "Enum.pred{Int32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int32) [1, fromIntegral (minBound::Int32), fromIntegral (maxBound::Int32)]) = [1,-2147483648,2147483647]
+ (toEnum (maxBound::Int))::Int32 = error "Enum.toEnum{Int32}: tag (9223372036854775807) is outside of bounds (-2147483648,2147483647)"
+ (map fromEnum [(1::Int32),minBound,maxBound]) = [1,-2147483648,2147483647]
+ (take 7 [(1::Int32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int32)-5)..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [(1::Int32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int32),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int32),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-2147483647,-2147483648]
+ (take 7 [x, x-1 ..]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+ (take 7 [x, (x+1) ..]) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(1::Int32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int32) .. 1])) = [1]
+ (take 7 ([(1::Int32) .. 0])) = []
+ (take 7 ([(5::Int32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int32)) .. maxBound])) = [2147483642,2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 ([(minBound+(5::Int32)) .. minBound])) = []
+ (take 7 [(5::Int32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int32),3..1]) = [5,3,1]
+ (take 7 [(5::Int32),3..2]) = [5,3]
+ (take 7 [(1::Int32),2..1]) = [1]
+ (take 7 [(2::Int32),1..2]) = [2]
+ (take 7 [(2::Int32),1..1]) = [2,1]
+ (take 7 [(2::Int32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [2147483643,2147483644,2147483645,2147483646,2147483647]
+ (take 7 [x,(x-1)..minBound]) = [-2147483643,-2147483644,-2147483645,-2147483646,-2147483647,-2147483648]
+Testing Enum Int64:
+ (succ (0::Int64)) = 1
+ (succ (minBound::Int64)) = -9223372036854775807
+ (succ (maxBound::Int64)) = error "Enum.succ{Int64}: tried to take `succ' of maxBound"
+ pred (1::Int64) = 0
+ pred (maxBound::Int64) = 9223372036854775806
+ pred (minBound::Int64) = error "Enum.pred{Int64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Int64) [1, fromIntegral (minBound::Int64), fromIntegral (maxBound::Int64)]) = [1,-9223372036854775808,9223372036854775807]
+ (toEnum (maxBound::Int))::Int64 = 9223372036854775807
+ (map fromEnum [(1::Int64),fromIntegral (minBound::Int) ,fromIntegral (maxBound::Int)]) = [1,-9223372036854775808,9223372036854775807]
+ fromEnum (maxBound::Int64) = 9223372036854775807
+ (take 7 [(1::Int64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Int64)-5)..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [(1::Int64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Int64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Int64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Int64),0..]) = [1,0,-1,-2,-3,-4,-5]
+ (take 7 [(5::Int64),2..]) = [5,2,-1,-4,-7,-10,-13]
+ (take 7 [x, x-1 ..]) = [-9223372036854775807,-9223372036854775808]
+ (take 7 [x, x-1 ..]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
+ (take 7 [x, (x+1) ..]) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(1::Int64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Int64) .. 1])) = [1]
+ (take 7 ([(1::Int64) .. 0])) = []
+ (take 7 ([(5::Int64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Int64)) .. maxBound])) = [9223372036854775802,9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 ([(minBound+(5::Int64)) .. minBound])) = []
+ (take 7 [(5::Int64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Int64),3..1]) = [5,3,1]
+ (take 7 [(5::Int64),3..2]) = [5,3]
+ (take 7 [(1::Int64),2..1]) = [1]
+ (take 7 [(2::Int64),1..2]) = [2]
+ (take 7 [(2::Int64),1..1]) = [2,1]
+ (take 7 [(2::Int64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [9223372036854775803,9223372036854775804,9223372036854775805,9223372036854775806,9223372036854775807]
+ (take 7 [x,(x-1)..minBound]) = [-9223372036854775803,-9223372036854775804,-9223372036854775805,-9223372036854775806,-9223372036854775807,-9223372036854775808]
diff --git a/testsuite/tests/lib/should_run/enum03.hs b/testsuite/tests/lib/should_run/enum03.hs
new file mode 100644
index 0000000000..908f3dd1a0
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum03.hs
@@ -0,0 +1,266 @@
+-- !!! Testing the Word Enum instances.
+module Main(main) where
+
+import Prelude hiding (catch)
+import Control.Exception
+import Data.Word
+import Data.Int
+
+main = do
+ putStrLn "Testing Enum Word8:"
+ testEnumWord8
+ putStrLn "Testing Enum Word16:"
+ testEnumWord16
+ putStrLn "Testing Enum Word32:"
+ testEnumWord32
+ putStrLn "Testing Enum Word64:"
+ testEnumWord64
+
+
+#define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) })
+
+testEnumWord8 :: IO ()
+testEnumWord8 = do
+ -- succ
+ printTest ((succ (0::Word8)))
+ printTest ((succ (minBound::Word8)))
+ mayBomb (printTest ((succ (maxBound::Word8))))
+
+ -- pred
+ printTest (pred (1::Word8))
+ printTest (pred (maxBound::Word8))
+ mayBomb (printTest (pred (minBound::Word8)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Word8))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Word8),minBound,maxBound]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Word8)..]))
+ printTest ((take 7 [((maxBound::Word8)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Word8),2..]))
+ printTest ((take 7 [(1::Word8),7..]))
+ printTest ((take 7 [(1::Word8),1..]))
+ printTest ((take 7 [(1::Word8),0..]))
+ printTest ((take 7 [(5::Word8),2..]))
+ let x = (minBound::Word8) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Word8) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Word8) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Word8) .. 5])))
+ printTest ((take 4 ([(1::Word8) .. 1])))
+ printTest ((take 7 ([(1::Word8) .. 0])))
+ printTest ((take 7 ([(5::Word8) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Word8)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Word8)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Word8),4..1]))
+ printTest ((take 7 [(5::Word8),3..1]))
+ printTest ((take 7 [(5::Word8),3..2]))
+ printTest ((take 7 [(1::Word8),2..1]))
+ printTest ((take 7 [(2::Word8),1..2]))
+ printTest ((take 7 [(2::Word8),1..1]))
+ printTest ((take 7 [(2::Word8),3..1]))
+
+ let x = (maxBound::Word8) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Word8) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+testEnumWord16 :: IO ()
+testEnumWord16 = do
+ -- succ
+ printTest ((succ (0::Word16)))
+ printTest ((succ (minBound::Word16)))
+ mayBomb (printTest ((succ (maxBound::Word16))))
+
+ -- pred
+ printTest (pred (1::Word16))
+ printTest (pred (maxBound::Word16))
+ mayBomb (printTest (pred (minBound::Word16)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Word16) [1, fromIntegral (minBound::Word16)::Int, fromIntegral (maxBound::Word16)::Int]))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Word16))
+
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Word16),minBound,maxBound]))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Word16)..]))
+ printTest ((take 7 [((maxBound::Word16)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Word16),2..]))
+ printTest ((take 7 [(1::Word16),7..]))
+ printTest ((take 7 [(1::Word16),1..]))
+ printTest ((take 7 [(1::Word16),0..]))
+ printTest ((take 7 [(5::Word16),2..]))
+ let x = (minBound::Word16) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Word16) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Word16) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Word16) .. 5])))
+ printTest ((take 4 ([(1::Word16) .. 1])))
+ printTest ((take 7 ([(1::Word16) .. 0])))
+ printTest ((take 7 ([(5::Word16) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Word16)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Word16)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Word16),4..1]))
+ printTest ((take 7 [(5::Word16),3..1]))
+ printTest ((take 7 [(5::Word16),3..2]))
+ printTest ((take 7 [(1::Word16),2..1]))
+ printTest ((take 7 [(2::Word16),1..2]))
+ printTest ((take 7 [(2::Word16),1..1]))
+ printTest ((take 7 [(2::Word16),3..1]))
+
+ let x = (maxBound::Word16) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Word16) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+testEnumWord32 :: IO ()
+testEnumWord32 = do
+ -- succ
+ printTest ((succ (0::Word32)))
+ printTest ((succ (minBound::Word32)))
+ mayBomb (printTest ((succ (maxBound::Word32))))
+
+ -- pred
+ printTest (pred (1::Word32))
+ printTest (pred (maxBound::Word32))
+ mayBomb (printTest (pred (minBound::Word32)))
+
+ -- toEnum
+ printTest ((map (toEnum::Int->Word32) [1, fromIntegral (minBound::Word32)::Int, fromIntegral (maxBound::Int32)::Int]))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Word32))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Word32),minBound,fromIntegral (maxBound::Int)]))
+ mayBomb (printTest (fromEnum (maxBound::Word32)))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Word32)..]))
+ printTest ((take 7 [((maxBound::Word32)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Word32),2..]))
+ printTest ((take 7 [(1::Word32),7..]))
+ printTest ((take 7 [(1::Word32),1..]))
+ printTest ((take 7 [(1::Word32),0..]))
+ printTest ((take 7 [(5::Word32),2..]))
+ let x = (minBound::Word32) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Word32) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Word32) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Word32) .. 5])))
+ printTest ((take 4 ([(1::Word32) .. 1])))
+ printTest ((take 7 ([(1::Word32) .. 0])))
+ printTest ((take 7 ([(5::Word32) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Word32)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Word32)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Word32),4..1]))
+ printTest ((take 7 [(5::Word32),3..1]))
+ printTest ((take 7 [(5::Word32),3..2]))
+ printTest ((take 7 [(1::Word32),2..1]))
+ printTest ((take 7 [(2::Word32),1..2]))
+ printTest ((take 7 [(2::Word32),1..1]))
+ printTest ((take 7 [(2::Word32),3..1]))
+
+ let x = (maxBound::Word32) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Word32) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+testEnumWord64 :: IO ()
+testEnumWord64 = do
+ -- succ
+ printTest ((succ (0::Word64)))
+ printTest ((succ (minBound::Word64)))
+ mayBomb (printTest ((succ (maxBound::Word64))))
+
+ -- pred
+ printTest (pred (1::Word64))
+ printTest (pred (maxBound::Word64))
+ mayBomb (printTest (pred (minBound::Word64)))
+
+ -- toEnum
+ mayBomb (printTest ((map (toEnum::Int->Word64) [1, fromIntegral (minBound::Word64)::Int, maxBound::Int])))
+ mayBomb (printTest ((toEnum (maxBound::Int))::Word64))
+
+ -- fromEnum
+ printTest ((map fromEnum [(1::Word64),minBound,fromIntegral (maxBound::Int)]))
+ mayBomb (printTest (fromEnum (maxBound::Word64)))
+
+ -- [x..] aka enumFrom
+ printTest ((take 7 [(1::Word64)..]))
+ printTest ((take 7 [((maxBound::Word64)-5)..])) -- just in case it doesn't catch the upper bound..
+
+ -- [x,y..] aka enumFromThen
+ printTest ((take 7 [(1::Word64),2..]))
+ printTest ((take 7 [(1::Word64),7..]))
+ printTest ((take 7 [(1::Word64),1..]))
+ printTest ((take 7 [(1::Word64),0..]))
+ printTest ((take 7 [(5::Word64),2..]))
+ let x = (minBound::Word64) + 1
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (minBound::Word64) + 5
+ printTest ((take 7 [x, x-1 ..]))
+ let x = (maxBound::Word64) - 5
+ printTest ((take 7 [x, (x+1) ..]))
+
+ -- [x..y] aka enumFromTo
+ printTest ((take 7 ([(1::Word64) .. 5])))
+ printTest ((take 4 ([(1::Word64) .. 1])))
+ printTest ((take 7 ([(1::Word64) .. 0])))
+ printTest ((take 7 ([(5::Word64) .. 0])))
+ printTest ((take 7 ([(maxBound-(5::Word64)) .. maxBound])))
+ printTest ((take 7 ([(minBound+(5::Word64)) .. minBound])))
+
+ -- [x,y..z] aka enumFromThenTo
+ printTest ((take 7 [(5::Word64),4..1]))
+ printTest ((take 7 [(5::Word64),3..1]))
+ printTest ((take 7 [(5::Word64),3..2]))
+ printTest ((take 7 [(1::Word64),2..1]))
+ printTest ((take 7 [(2::Word64),1..2]))
+ printTest ((take 7 [(2::Word64),1..1]))
+ printTest ((take 7 [(2::Word64),3..1]))
+
+ let x = (maxBound::Word64) - 4
+ printTest ((take 7 [x,(x+1)..maxBound]))
+ let x = (minBound::Word64) + 5
+ printTest ((take 7 [x,(x-1)..minBound]))
+
+
+--
+--
+-- Utils
+--
+--
+
+
+mayBomb x = catch x (\(ErrorCall e) -> putStrLn ("error " ++ show e))
+ `catch` (\e -> putStrLn ("Fail: " ++ show (e :: SomeException)))
diff --git a/testsuite/tests/lib/should_run/enum03.stdout b/testsuite/tests/lib/should_run/enum03.stdout
new file mode 100644
index 0000000000..d6db561a72
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum03.stdout
@@ -0,0 +1,142 @@
+Testing Enum Word8:
+ (succ (0::Word8)) = 1
+ (succ (minBound::Word8)) = 1
+ (succ (maxBound::Word8)) = error "Enum.succ{Word8}: tried to take `succ' of maxBound"
+ pred (1::Word8) = 0
+ pred (maxBound::Word8) = 254
+ pred (minBound::Word8) = error "Enum.pred{Word8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]) = [1,0,255]
+ (toEnum (maxBound::Int))::Word8 = error "Enum.toEnum{Word8}: tag (2147483647) is outside of bounds (0,255)"
+ (map fromEnum [(1::Word8),minBound,maxBound]) = [1,0,255]
+ (take 7 [(1::Word8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word8)-5)..]) = [250,251,252,253,254,255]
+ (take 7 [(1::Word8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word8),0..]) = [1,0]
+ (take 7 [(5::Word8),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [250,251,252,253,254,255]
+ (take 7 ([(1::Word8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word8) .. 1])) = [1]
+ (take 7 ([(1::Word8) .. 0])) = []
+ (take 7 ([(5::Word8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word8)) .. maxBound])) = [250,251,252,253,254,255]
+ (take 7 ([(minBound+(5::Word8)) .. minBound])) = []
+ (take 7 [(5::Word8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word8),3..1]) = [5,3,1]
+ (take 7 [(5::Word8),3..2]) = [5,3]
+ (take 7 [(1::Word8),2..1]) = [1]
+ (take 7 [(2::Word8),1..2]) = [2]
+ (take 7 [(2::Word8),1..1]) = [2,1]
+ (take 7 [(2::Word8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [251,252,253,254,255]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word16:
+ (succ (0::Word16)) = 1
+ (succ (minBound::Word16)) = 1
+ (succ (maxBound::Word16)) = error "Enum.succ{Word16}: tried to take `succ' of maxBound"
+ pred (1::Word16) = 0
+ pred (maxBound::Word16) = 65534
+ pred (minBound::Word16) = error "Enum.pred{Word16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word16) [1, fromIntegral (minBound::Word16)::Int, fromIntegral (maxBound::Word16)::Int]) = [1,0,65535]
+ (toEnum (maxBound::Int))::Word16 = error "Enum.toEnum{Word16}: tag (2147483647) is outside of bounds (0,65535)"
+ (map fromEnum [(1::Word16),minBound,maxBound]) = [1,0,65535]
+ (take 7 [(1::Word16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word16)-5)..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 [(1::Word16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word16),0..]) = [1,0]
+ (take 7 [(5::Word16),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(1::Word16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word16) .. 1])) = [1]
+ (take 7 ([(1::Word16) .. 0])) = []
+ (take 7 ([(5::Word16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word16)) .. maxBound])) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(minBound+(5::Word16)) .. minBound])) = []
+ (take 7 [(5::Word16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word16),3..1]) = [5,3,1]
+ (take 7 [(5::Word16),3..2]) = [5,3]
+ (take 7 [(1::Word16),2..1]) = [1]
+ (take 7 [(2::Word16),1..2]) = [2]
+ (take 7 [(2::Word16),1..1]) = [2,1]
+ (take 7 [(2::Word16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [65531,65532,65533,65534,65535]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word32:
+ (succ (0::Word32)) = 1
+ (succ (minBound::Word32)) = 1
+ (succ (maxBound::Word32)) = error "Enum.succ{Word32}: tried to take `succ' of maxBound"
+ pred (1::Word32) = 0
+ pred (maxBound::Word32) = 4294967294
+ pred (minBound::Word32) = error "Enum.pred{Word32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word32) [1, fromIntegral (minBound::Word32)::Int, fromIntegral (maxBound::Int32)::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word32 = 2147483647
+ (map fromEnum [(1::Word32),minBound,fromIntegral (maxBound::Int)]) = [1,0,2147483647]
+ fromEnum (maxBound::Word32) = error "Enum.fromEnum{Word32}: value (4294967295) is outside of Int's bounds (-2147483648,2147483647)"
+ (take 7 [(1::Word32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word32)-5)..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [(1::Word32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word32),0..]) = [1,0]
+ (take 7 [(5::Word32),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(1::Word32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word32) .. 1])) = [1]
+ (take 7 ([(1::Word32) .. 0])) = []
+ (take 7 ([(5::Word32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word32)) .. maxBound])) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(minBound+(5::Word32)) .. minBound])) = []
+ (take 7 [(5::Word32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word32),3..1]) = [5,3,1]
+ (take 7 [(5::Word32),3..2]) = [5,3]
+ (take 7 [(1::Word32),2..1]) = [1]
+ (take 7 [(2::Word32),1..2]) = [2]
+ (take 7 [(2::Word32),1..1]) = [2,1]
+ (take 7 [(2::Word32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word64:
+ (succ (0::Word64)) = 1
+ (succ (minBound::Word64)) = 1
+ (succ (maxBound::Word64)) = error "Enum.succ{Word64}: tried to take `succ' of maxBound"
+ pred (1::Word64) = 0
+ pred (maxBound::Word64) = 18446744073709551614
+ pred (minBound::Word64) = error "Enum.pred{Word64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word64) [1, fromIntegral (minBound::Word64)::Int, maxBound::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word64 = 2147483647
+ (map fromEnum [(1::Word64),minBound,fromIntegral (maxBound::Int)]) = [1,0,2147483647]
+ fromEnum (maxBound::Word64) = error "Enum.fromEnum{Word64}: value (18446744073709551615) is outside of Int's bounds (-2147483648,2147483647)"
+ (take 7 [(1::Word64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word64)-5)..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [(1::Word64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word64),0..]) = [1,0]
+ (take 7 [(5::Word64),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(1::Word64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word64) .. 1])) = [1]
+ (take 7 ([(1::Word64) .. 0])) = []
+ (take 7 ([(5::Word64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word64)) .. maxBound])) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(minBound+(5::Word64)) .. minBound])) = []
+ (take 7 [(5::Word64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word64),3..1]) = [5,3,1]
+ (take 7 [(5::Word64),3..2]) = [5,3]
+ (take 7 [(1::Word64),2..1]) = [1]
+ (take 7 [(2::Word64),1..2]) = [2]
+ (take 7 [(2::Word64),1..1]) = [2,1]
+ (take 7 [(2::Word64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
diff --git a/testsuite/tests/lib/should_run/enum03.stdout-alpha-dec-osf3 b/testsuite/tests/lib/should_run/enum03.stdout-alpha-dec-osf3
new file mode 100644
index 0000000000..716782c46a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum03.stdout-alpha-dec-osf3
@@ -0,0 +1,142 @@
+Testing Enum Word8:
+ (succ (0::Word8)) = 1
+ (succ (minBound::Word8)) = 1
+ (succ (maxBound::Word8)) = error "Enum.succ{Word8}: tried to take `succ' of maxBound"
+ pred (1::Word8) = 0
+ pred (maxBound::Word8) = 254
+ pred (minBound::Word8) = error "Enum.pred{Word8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]) = [1,0,255]
+ (toEnum (maxBound::Int))::Word8 = error "Enum.toEnum{Word8}: tag (9223372036854775807) is outside of bounds (0,255)"
+ (map fromEnum [(1::Word8),minBound,maxBound]) = [1,0,255]
+ (take 7 [(1::Word8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word8)-5)..]) = [250,251,252,253,254,255]
+ (take 7 [(1::Word8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word8),0..]) = [1,0]
+ (take 7 [(5::Word8),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [250,251,252,253,254,255]
+ (take 7 ([(1::Word8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word8) .. 1])) = [1]
+ (take 7 ([(1::Word8) .. 0])) = []
+ (take 7 ([(5::Word8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word8)) .. maxBound])) = [250,251,252,253,254,255]
+ (take 7 ([(minBound+(5::Word8)) .. minBound])) = []
+ (take 7 [(5::Word8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word8),3..1]) = [5,3,1]
+ (take 7 [(5::Word8),3..2]) = [5,3]
+ (take 7 [(1::Word8),2..1]) = [1]
+ (take 7 [(2::Word8),1..2]) = [2]
+ (take 7 [(2::Word8),1..1]) = [2,1]
+ (take 7 [(2::Word8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [251,252,253,254,255]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word16:
+ (succ (0::Word16)) = 1
+ (succ (minBound::Word16)) = 1
+ (succ (maxBound::Word16)) = error "Enum.succ{Word16}: tried to take `succ' of maxBound"
+ pred (1::Word16) = 0
+ pred (maxBound::Word16) = 65534
+ pred (minBound::Word16) = error "Enum.pred{Word16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word16) [1, fromIntegral (minBound::Word16)::Int, fromIntegral (maxBound::Word16)::Int]) = [1,0,65535]
+ (toEnum (maxBound::Int))::Word16 = error "Enum.toEnum{Word16}: tag (9223372036854775807) is outside of bounds (0,65535)"
+ (map fromEnum [(1::Word16),minBound,maxBound]) = [1,0,65535]
+ (take 7 [(1::Word16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word16)-5)..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 [(1::Word16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word16),0..]) = [1,0]
+ (take 7 [(5::Word16),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(1::Word16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word16) .. 1])) = [1]
+ (take 7 ([(1::Word16) .. 0])) = []
+ (take 7 ([(5::Word16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word16)) .. maxBound])) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(minBound+(5::Word16)) .. minBound])) = []
+ (take 7 [(5::Word16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word16),3..1]) = [5,3,1]
+ (take 7 [(5::Word16),3..2]) = [5,3]
+ (take 7 [(1::Word16),2..1]) = [1]
+ (take 7 [(2::Word16),1..2]) = [2]
+ (take 7 [(2::Word16),1..1]) = [2,1]
+ (take 7 [(2::Word16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [65531,65532,65533,65534,65535]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word32:
+ (succ (0::Word32)) = 1
+ (succ (minBound::Word32)) = 1
+ (succ (maxBound::Word32)) = error "Enum.succ{Word32}: tried to take `succ' of maxBound"
+ pred (1::Word32) = 0
+ pred (maxBound::Word32) = 4294967294
+ pred (minBound::Word32) = error "Enum.pred{Word32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word32) [1, fromIntegral (minBound::Word32)::Int, fromIntegral (maxBound::Int32)::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word32 = error "Enum.toEnum{Word32}: tag (9223372036854775807) is outside of bounds (0,4294967295)"
+ (map fromEnum [(1::Word32),minBound,fromIntegral (maxBound::Int)]) = [1,0,4294967295]
+ fromEnum (maxBound::Word32) = 4294967295
+ (take 7 [(1::Word32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word32)-5)..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [(1::Word32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word32),0..]) = [1,0]
+ (take 7 [(5::Word32),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(1::Word32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word32) .. 1])) = [1]
+ (take 7 ([(1::Word32) .. 0])) = []
+ (take 7 ([(5::Word32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word32)) .. maxBound])) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(minBound+(5::Word32)) .. minBound])) = []
+ (take 7 [(5::Word32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word32),3..1]) = [5,3,1]
+ (take 7 [(5::Word32),3..2]) = [5,3]
+ (take 7 [(1::Word32),2..1]) = [1]
+ (take 7 [(2::Word32),1..2]) = [2]
+ (take 7 [(2::Word32),1..1]) = [2,1]
+ (take 7 [(2::Word32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word64:
+ (succ (0::Word64)) = 1
+ (succ (minBound::Word64)) = 1
+ (succ (maxBound::Word64)) = error "Enum.succ{Word64}: tried to take `succ' of maxBound"
+ pred (1::Word64) = 0
+ pred (maxBound::Word64) = 18446744073709551614
+ pred (minBound::Word64) = error "Enum.pred{Word64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word64) [1, fromIntegral (minBound::Word64)::Int, maxBound::Int]) = [1,0,9223372036854775807]
+ (toEnum (maxBound::Int))::Word64 = 9223372036854775807
+ (map fromEnum [(1::Word64),minBound,fromIntegral (maxBound::Int)]) = [1,0,9223372036854775807]
+ fromEnum (maxBound::Word64) = error "Enum.fromEnum{Word64}: value (18446744073709551615) is outside of Int's bounds (-9223372036854775808,9223372036854775807)"
+ (take 7 [(1::Word64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word64)-5)..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [(1::Word64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word64),0..]) = [1,0]
+ (take 7 [(5::Word64),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(1::Word64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word64) .. 1])) = [1]
+ (take 7 ([(1::Word64) .. 0])) = []
+ (take 7 ([(5::Word64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word64)) .. maxBound])) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(minBound+(5::Word64)) .. minBound])) = []
+ (take 7 [(5::Word64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word64),3..1]) = [5,3,1]
+ (take 7 [(5::Word64),3..2]) = [5,3]
+ (take 7 [(1::Word64),2..1]) = [1]
+ (take 7 [(2::Word64),1..2]) = [2]
+ (take 7 [(2::Word64),1..1]) = [2,1]
+ (take 7 [(2::Word64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
diff --git a/testsuite/tests/lib/should_run/enum03.stdout-hugs b/testsuite/tests/lib/should_run/enum03.stdout-hugs
new file mode 100644
index 0000000000..babc1c2e9e
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum03.stdout-hugs
@@ -0,0 +1,142 @@
+Testing Enum Word8:
+ (succ (0::Word8)) = 1
+ (succ (minBound::Word8)) = 1
+ (succ (maxBound::Word8)) = error "succ: applied to maxBound"
+ pred (1::Word8) = 0
+ pred (maxBound::Word8) = 254
+ pred (minBound::Word8) = error "pred: applied to minBound"
+ (map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]) = [1,0,255]
+ (toEnum (maxBound::Int))::Word8 = 255
+ (map fromEnum [(1::Word8),minBound,maxBound]) = [1,0,255]
+ (take 7 [(1::Word8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word8)-5)..]) = [250,251,252,253,254,255]
+ (take 7 [(1::Word8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word8),0..]) = [1,0]
+ (take 7 [(5::Word8),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [250,251,252,253,254,255]
+ (take 7 ([(1::Word8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word8) .. 1])) = [1]
+ (take 7 ([(1::Word8) .. 0])) = []
+ (take 7 ([(5::Word8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word8)) .. maxBound])) = [250,251,252,253,254,255]
+ (take 7 ([(minBound+(5::Word8)) .. minBound])) = []
+ (take 7 [(5::Word8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word8),3..1]) = [5,3,1]
+ (take 7 [(5::Word8),3..2]) = [5,3]
+ (take 7 [(1::Word8),2..1]) = [1]
+ (take 7 [(2::Word8),1..2]) = [2]
+ (take 7 [(2::Word8),1..1]) = [2,1]
+ (take 7 [(2::Word8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [251,252,253,254,255]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word16:
+ (succ (0::Word16)) = 1
+ (succ (minBound::Word16)) = 1
+ (succ (maxBound::Word16)) = error "succ: applied to maxBound"
+ pred (1::Word16) = 0
+ pred (maxBound::Word16) = 65534
+ pred (minBound::Word16) = error "pred: applied to minBound"
+ (map (toEnum::Int->Word16) [1, fromIntegral (minBound::Word16)::Int, fromIntegral (maxBound::Word16)::Int]) = [1,0,65535]
+ (toEnum (maxBound::Int))::Word16 = 65535
+ (map fromEnum [(1::Word16),minBound,maxBound]) = [1,0,65535]
+ (take 7 [(1::Word16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word16)-5)..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 [(1::Word16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word16),0..]) = [1,0]
+ (take 7 [(5::Word16),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(1::Word16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word16) .. 1])) = [1]
+ (take 7 ([(1::Word16) .. 0])) = []
+ (take 7 ([(5::Word16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word16)) .. maxBound])) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(minBound+(5::Word16)) .. minBound])) = []
+ (take 7 [(5::Word16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word16),3..1]) = [5,3,1]
+ (take 7 [(5::Word16),3..2]) = [5,3]
+ (take 7 [(1::Word16),2..1]) = [1]
+ (take 7 [(2::Word16),1..2]) = [2]
+ (take 7 [(2::Word16),1..1]) = [2,1]
+ (take 7 [(2::Word16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [65531,65532,65533,65534,65535]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word32:
+ (succ (0::Word32)) = 1
+ (succ (minBound::Word32)) = 1
+ (succ (maxBound::Word32)) = error "succ: applied to maxBound"
+ pred (1::Word32) = 0
+ pred (maxBound::Word32) = 4294967294
+ pred (minBound::Word32) = error "pred: applied to minBound"
+ (map (toEnum::Int->Word32) [1, fromIntegral (minBound::Word32)::Int, fromIntegral (maxBound::Int32)::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word32 = 2147483647
+ (map fromEnum [(1::Word32),minBound,fromIntegral (maxBound::Int)]) = [1,0,2147483647]
+ fromEnum (maxBound::Word32) = -1
+ (take 7 [(1::Word32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word32)-5)..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [(1::Word32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word32),0..]) = [1,0]
+ (take 7 [(5::Word32),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(1::Word32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word32) .. 1])) = [1]
+ (take 7 ([(1::Word32) .. 0])) = []
+ (take 7 ([(5::Word32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word32)) .. maxBound])) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(minBound+(5::Word32)) .. minBound])) = []
+ (take 7 [(5::Word32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word32),3..1]) = [5,3,1]
+ (take 7 [(5::Word32),3..2]) = [5,3]
+ (take 7 [(1::Word32),2..1]) = [1]
+ (take 7 [(2::Word32),1..2]) = [2]
+ (take 7 [(2::Word32),1..1]) = [2,1]
+ (take 7 [(2::Word32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word64:
+ (succ (0::Word64)) = 1
+ (succ (minBound::Word64)) = 1
+ (succ (maxBound::Word64)) = error "succ: applied to maxBound"
+ pred (1::Word64) = 0
+ pred (maxBound::Word64) = 18446744073709551614
+ pred (minBound::Word64) = error "pred: applied to minBound"
+ (map (toEnum::Int->Word64) [1, fromIntegral (minBound::Word64)::Int, maxBound::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word64 = 2147483647
+ (map fromEnum [(1::Word64),minBound,fromIntegral (maxBound::Int)]) = [1,0,2147483647]
+ fromEnum (maxBound::Word64) = Fail: arithmetic overflow
+ (take 7 [(1::Word64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word64)-5)..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [(1::Word64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word64),0..]) = [1,0]
+ (take 7 [(5::Word64),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(1::Word64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word64) .. 1])) = [1]
+ (take 7 ([(1::Word64) .. 0])) = []
+ (take 7 ([(5::Word64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word64)) .. maxBound])) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(minBound+(5::Word64)) .. minBound])) = []
+ (take 7 [(5::Word64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word64),3..1]) = [5,3,1]
+ (take 7 [(5::Word64),3..2]) = [5,3]
+ (take 7 [(1::Word64),2..1]) = [1]
+ (take 7 [(2::Word64),1..2]) = [2]
+ (take 7 [(2::Word64),1..1]) = [2,1]
+ (take 7 [(2::Word64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
diff --git a/testsuite/tests/lib/should_run/enum03.stdout-mips-sgi-irix b/testsuite/tests/lib/should_run/enum03.stdout-mips-sgi-irix
new file mode 100644
index 0000000000..716782c46a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum03.stdout-mips-sgi-irix
@@ -0,0 +1,142 @@
+Testing Enum Word8:
+ (succ (0::Word8)) = 1
+ (succ (minBound::Word8)) = 1
+ (succ (maxBound::Word8)) = error "Enum.succ{Word8}: tried to take `succ' of maxBound"
+ pred (1::Word8) = 0
+ pred (maxBound::Word8) = 254
+ pred (minBound::Word8) = error "Enum.pred{Word8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]) = [1,0,255]
+ (toEnum (maxBound::Int))::Word8 = error "Enum.toEnum{Word8}: tag (9223372036854775807) is outside of bounds (0,255)"
+ (map fromEnum [(1::Word8),minBound,maxBound]) = [1,0,255]
+ (take 7 [(1::Word8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word8)-5)..]) = [250,251,252,253,254,255]
+ (take 7 [(1::Word8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word8),0..]) = [1,0]
+ (take 7 [(5::Word8),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [250,251,252,253,254,255]
+ (take 7 ([(1::Word8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word8) .. 1])) = [1]
+ (take 7 ([(1::Word8) .. 0])) = []
+ (take 7 ([(5::Word8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word8)) .. maxBound])) = [250,251,252,253,254,255]
+ (take 7 ([(minBound+(5::Word8)) .. minBound])) = []
+ (take 7 [(5::Word8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word8),3..1]) = [5,3,1]
+ (take 7 [(5::Word8),3..2]) = [5,3]
+ (take 7 [(1::Word8),2..1]) = [1]
+ (take 7 [(2::Word8),1..2]) = [2]
+ (take 7 [(2::Word8),1..1]) = [2,1]
+ (take 7 [(2::Word8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [251,252,253,254,255]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word16:
+ (succ (0::Word16)) = 1
+ (succ (minBound::Word16)) = 1
+ (succ (maxBound::Word16)) = error "Enum.succ{Word16}: tried to take `succ' of maxBound"
+ pred (1::Word16) = 0
+ pred (maxBound::Word16) = 65534
+ pred (minBound::Word16) = error "Enum.pred{Word16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word16) [1, fromIntegral (minBound::Word16)::Int, fromIntegral (maxBound::Word16)::Int]) = [1,0,65535]
+ (toEnum (maxBound::Int))::Word16 = error "Enum.toEnum{Word16}: tag (9223372036854775807) is outside of bounds (0,65535)"
+ (map fromEnum [(1::Word16),minBound,maxBound]) = [1,0,65535]
+ (take 7 [(1::Word16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word16)-5)..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 [(1::Word16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word16),0..]) = [1,0]
+ (take 7 [(5::Word16),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(1::Word16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word16) .. 1])) = [1]
+ (take 7 ([(1::Word16) .. 0])) = []
+ (take 7 ([(5::Word16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word16)) .. maxBound])) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(minBound+(5::Word16)) .. minBound])) = []
+ (take 7 [(5::Word16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word16),3..1]) = [5,3,1]
+ (take 7 [(5::Word16),3..2]) = [5,3]
+ (take 7 [(1::Word16),2..1]) = [1]
+ (take 7 [(2::Word16),1..2]) = [2]
+ (take 7 [(2::Word16),1..1]) = [2,1]
+ (take 7 [(2::Word16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [65531,65532,65533,65534,65535]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word32:
+ (succ (0::Word32)) = 1
+ (succ (minBound::Word32)) = 1
+ (succ (maxBound::Word32)) = error "Enum.succ{Word32}: tried to take `succ' of maxBound"
+ pred (1::Word32) = 0
+ pred (maxBound::Word32) = 4294967294
+ pred (minBound::Word32) = error "Enum.pred{Word32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word32) [1, fromIntegral (minBound::Word32)::Int, fromIntegral (maxBound::Int32)::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word32 = error "Enum.toEnum{Word32}: tag (9223372036854775807) is outside of bounds (0,4294967295)"
+ (map fromEnum [(1::Word32),minBound,fromIntegral (maxBound::Int)]) = [1,0,4294967295]
+ fromEnum (maxBound::Word32) = 4294967295
+ (take 7 [(1::Word32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word32)-5)..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [(1::Word32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word32),0..]) = [1,0]
+ (take 7 [(5::Word32),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(1::Word32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word32) .. 1])) = [1]
+ (take 7 ([(1::Word32) .. 0])) = []
+ (take 7 ([(5::Word32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word32)) .. maxBound])) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(minBound+(5::Word32)) .. minBound])) = []
+ (take 7 [(5::Word32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word32),3..1]) = [5,3,1]
+ (take 7 [(5::Word32),3..2]) = [5,3]
+ (take 7 [(1::Word32),2..1]) = [1]
+ (take 7 [(2::Word32),1..2]) = [2]
+ (take 7 [(2::Word32),1..1]) = [2,1]
+ (take 7 [(2::Word32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word64:
+ (succ (0::Word64)) = 1
+ (succ (minBound::Word64)) = 1
+ (succ (maxBound::Word64)) = error "Enum.succ{Word64}: tried to take `succ' of maxBound"
+ pred (1::Word64) = 0
+ pred (maxBound::Word64) = 18446744073709551614
+ pred (minBound::Word64) = error "Enum.pred{Word64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word64) [1, fromIntegral (minBound::Word64)::Int, maxBound::Int]) = [1,0,9223372036854775807]
+ (toEnum (maxBound::Int))::Word64 = 9223372036854775807
+ (map fromEnum [(1::Word64),minBound,fromIntegral (maxBound::Int)]) = [1,0,9223372036854775807]
+ fromEnum (maxBound::Word64) = error "Enum.fromEnum{Word64}: value (18446744073709551615) is outside of Int's bounds (-9223372036854775808,9223372036854775807)"
+ (take 7 [(1::Word64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word64)-5)..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [(1::Word64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word64),0..]) = [1,0]
+ (take 7 [(5::Word64),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(1::Word64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word64) .. 1])) = [1]
+ (take 7 ([(1::Word64) .. 0])) = []
+ (take 7 ([(5::Word64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word64)) .. maxBound])) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(minBound+(5::Word64)) .. minBound])) = []
+ (take 7 [(5::Word64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word64),3..1]) = [5,3,1]
+ (take 7 [(5::Word64),3..2]) = [5,3]
+ (take 7 [(1::Word64),2..1]) = [1]
+ (take 7 [(2::Word64),1..2]) = [2]
+ (take 7 [(2::Word64),1..1]) = [2,1]
+ (take 7 [(2::Word64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
diff --git a/testsuite/tests/lib/should_run/enum03.stdout-ws-64 b/testsuite/tests/lib/should_run/enum03.stdout-ws-64
new file mode 100644
index 0000000000..716782c46a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum03.stdout-ws-64
@@ -0,0 +1,142 @@
+Testing Enum Word8:
+ (succ (0::Word8)) = 1
+ (succ (minBound::Word8)) = 1
+ (succ (maxBound::Word8)) = error "Enum.succ{Word8}: tried to take `succ' of maxBound"
+ pred (1::Word8) = 0
+ pred (maxBound::Word8) = 254
+ pred (minBound::Word8) = error "Enum.pred{Word8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]) = [1,0,255]
+ (toEnum (maxBound::Int))::Word8 = error "Enum.toEnum{Word8}: tag (9223372036854775807) is outside of bounds (0,255)"
+ (map fromEnum [(1::Word8),minBound,maxBound]) = [1,0,255]
+ (take 7 [(1::Word8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word8)-5)..]) = [250,251,252,253,254,255]
+ (take 7 [(1::Word8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word8),0..]) = [1,0]
+ (take 7 [(5::Word8),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [250,251,252,253,254,255]
+ (take 7 ([(1::Word8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word8) .. 1])) = [1]
+ (take 7 ([(1::Word8) .. 0])) = []
+ (take 7 ([(5::Word8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word8)) .. maxBound])) = [250,251,252,253,254,255]
+ (take 7 ([(minBound+(5::Word8)) .. minBound])) = []
+ (take 7 [(5::Word8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word8),3..1]) = [5,3,1]
+ (take 7 [(5::Word8),3..2]) = [5,3]
+ (take 7 [(1::Word8),2..1]) = [1]
+ (take 7 [(2::Word8),1..2]) = [2]
+ (take 7 [(2::Word8),1..1]) = [2,1]
+ (take 7 [(2::Word8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [251,252,253,254,255]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word16:
+ (succ (0::Word16)) = 1
+ (succ (minBound::Word16)) = 1
+ (succ (maxBound::Word16)) = error "Enum.succ{Word16}: tried to take `succ' of maxBound"
+ pred (1::Word16) = 0
+ pred (maxBound::Word16) = 65534
+ pred (minBound::Word16) = error "Enum.pred{Word16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word16) [1, fromIntegral (minBound::Word16)::Int, fromIntegral (maxBound::Word16)::Int]) = [1,0,65535]
+ (toEnum (maxBound::Int))::Word16 = error "Enum.toEnum{Word16}: tag (9223372036854775807) is outside of bounds (0,65535)"
+ (map fromEnum [(1::Word16),minBound,maxBound]) = [1,0,65535]
+ (take 7 [(1::Word16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word16)-5)..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 [(1::Word16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word16),0..]) = [1,0]
+ (take 7 [(5::Word16),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(1::Word16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word16) .. 1])) = [1]
+ (take 7 ([(1::Word16) .. 0])) = []
+ (take 7 ([(5::Word16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word16)) .. maxBound])) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(minBound+(5::Word16)) .. minBound])) = []
+ (take 7 [(5::Word16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word16),3..1]) = [5,3,1]
+ (take 7 [(5::Word16),3..2]) = [5,3]
+ (take 7 [(1::Word16),2..1]) = [1]
+ (take 7 [(2::Word16),1..2]) = [2]
+ (take 7 [(2::Word16),1..1]) = [2,1]
+ (take 7 [(2::Word16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [65531,65532,65533,65534,65535]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word32:
+ (succ (0::Word32)) = 1
+ (succ (minBound::Word32)) = 1
+ (succ (maxBound::Word32)) = error "Enum.succ{Word32}: tried to take `succ' of maxBound"
+ pred (1::Word32) = 0
+ pred (maxBound::Word32) = 4294967294
+ pred (minBound::Word32) = error "Enum.pred{Word32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word32) [1, fromIntegral (minBound::Word32)::Int, fromIntegral (maxBound::Int32)::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word32 = error "Enum.toEnum{Word32}: tag (9223372036854775807) is outside of bounds (0,4294967295)"
+ (map fromEnum [(1::Word32),minBound,fromIntegral (maxBound::Int)]) = [1,0,4294967295]
+ fromEnum (maxBound::Word32) = 4294967295
+ (take 7 [(1::Word32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word32)-5)..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [(1::Word32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word32),0..]) = [1,0]
+ (take 7 [(5::Word32),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(1::Word32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word32) .. 1])) = [1]
+ (take 7 ([(1::Word32) .. 0])) = []
+ (take 7 ([(5::Word32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word32)) .. maxBound])) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(minBound+(5::Word32)) .. minBound])) = []
+ (take 7 [(5::Word32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word32),3..1]) = [5,3,1]
+ (take 7 [(5::Word32),3..2]) = [5,3]
+ (take 7 [(1::Word32),2..1]) = [1]
+ (take 7 [(2::Word32),1..2]) = [2]
+ (take 7 [(2::Word32),1..1]) = [2,1]
+ (take 7 [(2::Word32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word64:
+ (succ (0::Word64)) = 1
+ (succ (minBound::Word64)) = 1
+ (succ (maxBound::Word64)) = error "Enum.succ{Word64}: tried to take `succ' of maxBound"
+ pred (1::Word64) = 0
+ pred (maxBound::Word64) = 18446744073709551614
+ pred (minBound::Word64) = error "Enum.pred{Word64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word64) [1, fromIntegral (minBound::Word64)::Int, maxBound::Int]) = [1,0,9223372036854775807]
+ (toEnum (maxBound::Int))::Word64 = 9223372036854775807
+ (map fromEnum [(1::Word64),minBound,fromIntegral (maxBound::Int)]) = [1,0,9223372036854775807]
+ fromEnum (maxBound::Word64) = error "Enum.fromEnum{Word64}: value (18446744073709551615) is outside of Int's bounds (-9223372036854775808,9223372036854775807)"
+ (take 7 [(1::Word64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word64)-5)..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [(1::Word64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word64),0..]) = [1,0]
+ (take 7 [(5::Word64),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(1::Word64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word64) .. 1])) = [1]
+ (take 7 ([(1::Word64) .. 0])) = []
+ (take 7 ([(5::Word64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word64)) .. maxBound])) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(minBound+(5::Word64)) .. minBound])) = []
+ (take 7 [(5::Word64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word64),3..1]) = [5,3,1]
+ (take 7 [(5::Word64),3..2]) = [5,3]
+ (take 7 [(1::Word64),2..1]) = [1]
+ (take 7 [(2::Word64),1..2]) = [2]
+ (take 7 [(2::Word64),1..1]) = [2,1]
+ (take 7 [(2::Word64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
diff --git a/testsuite/tests/lib/should_run/enum03.stdout-x86_64-unknown-openbsd b/testsuite/tests/lib/should_run/enum03.stdout-x86_64-unknown-openbsd
new file mode 100644
index 0000000000..716782c46a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum03.stdout-x86_64-unknown-openbsd
@@ -0,0 +1,142 @@
+Testing Enum Word8:
+ (succ (0::Word8)) = 1
+ (succ (minBound::Word8)) = 1
+ (succ (maxBound::Word8)) = error "Enum.succ{Word8}: tried to take `succ' of maxBound"
+ pred (1::Word8) = 0
+ pred (maxBound::Word8) = 254
+ pred (minBound::Word8) = error "Enum.pred{Word8}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]) = [1,0,255]
+ (toEnum (maxBound::Int))::Word8 = error "Enum.toEnum{Word8}: tag (9223372036854775807) is outside of bounds (0,255)"
+ (map fromEnum [(1::Word8),minBound,maxBound]) = [1,0,255]
+ (take 7 [(1::Word8)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word8)-5)..]) = [250,251,252,253,254,255]
+ (take 7 [(1::Word8),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word8),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word8),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word8),0..]) = [1,0]
+ (take 7 [(5::Word8),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [250,251,252,253,254,255]
+ (take 7 ([(1::Word8) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word8) .. 1])) = [1]
+ (take 7 ([(1::Word8) .. 0])) = []
+ (take 7 ([(5::Word8) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word8)) .. maxBound])) = [250,251,252,253,254,255]
+ (take 7 ([(minBound+(5::Word8)) .. minBound])) = []
+ (take 7 [(5::Word8),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word8),3..1]) = [5,3,1]
+ (take 7 [(5::Word8),3..2]) = [5,3]
+ (take 7 [(1::Word8),2..1]) = [1]
+ (take 7 [(2::Word8),1..2]) = [2]
+ (take 7 [(2::Word8),1..1]) = [2,1]
+ (take 7 [(2::Word8),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [251,252,253,254,255]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word16:
+ (succ (0::Word16)) = 1
+ (succ (minBound::Word16)) = 1
+ (succ (maxBound::Word16)) = error "Enum.succ{Word16}: tried to take `succ' of maxBound"
+ pred (1::Word16) = 0
+ pred (maxBound::Word16) = 65534
+ pred (minBound::Word16) = error "Enum.pred{Word16}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word16) [1, fromIntegral (minBound::Word16)::Int, fromIntegral (maxBound::Word16)::Int]) = [1,0,65535]
+ (toEnum (maxBound::Int))::Word16 = error "Enum.toEnum{Word16}: tag (9223372036854775807) is outside of bounds (0,65535)"
+ (map fromEnum [(1::Word16),minBound,maxBound]) = [1,0,65535]
+ (take 7 [(1::Word16)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word16)-5)..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 [(1::Word16),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word16),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word16),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word16),0..]) = [1,0]
+ (take 7 [(5::Word16),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(1::Word16) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word16) .. 1])) = [1]
+ (take 7 ([(1::Word16) .. 0])) = []
+ (take 7 ([(5::Word16) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word16)) .. maxBound])) = [65530,65531,65532,65533,65534,65535]
+ (take 7 ([(minBound+(5::Word16)) .. minBound])) = []
+ (take 7 [(5::Word16),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word16),3..1]) = [5,3,1]
+ (take 7 [(5::Word16),3..2]) = [5,3]
+ (take 7 [(1::Word16),2..1]) = [1]
+ (take 7 [(2::Word16),1..2]) = [2]
+ (take 7 [(2::Word16),1..1]) = [2,1]
+ (take 7 [(2::Word16),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [65531,65532,65533,65534,65535]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word32:
+ (succ (0::Word32)) = 1
+ (succ (minBound::Word32)) = 1
+ (succ (maxBound::Word32)) = error "Enum.succ{Word32}: tried to take `succ' of maxBound"
+ pred (1::Word32) = 0
+ pred (maxBound::Word32) = 4294967294
+ pred (minBound::Word32) = error "Enum.pred{Word32}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word32) [1, fromIntegral (minBound::Word32)::Int, fromIntegral (maxBound::Int32)::Int]) = [1,0,2147483647]
+ (toEnum (maxBound::Int))::Word32 = error "Enum.toEnum{Word32}: tag (9223372036854775807) is outside of bounds (0,4294967295)"
+ (map fromEnum [(1::Word32),minBound,fromIntegral (maxBound::Int)]) = [1,0,4294967295]
+ fromEnum (maxBound::Word32) = 4294967295
+ (take 7 [(1::Word32)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word32)-5)..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [(1::Word32),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word32),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word32),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word32),0..]) = [1,0]
+ (take 7 [(5::Word32),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(1::Word32) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word32) .. 1])) = [1]
+ (take 7 ([(1::Word32) .. 0])) = []
+ (take 7 ([(5::Word32) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word32)) .. maxBound])) = [4294967290,4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 ([(minBound+(5::Word32)) .. minBound])) = []
+ (take 7 [(5::Word32),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word32),3..1]) = [5,3,1]
+ (take 7 [(5::Word32),3..2]) = [5,3]
+ (take 7 [(1::Word32),2..1]) = [1]
+ (take 7 [(2::Word32),1..2]) = [2]
+ (take 7 [(2::Word32),1..1]) = [2,1]
+ (take 7 [(2::Word32),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [4294967291,4294967292,4294967293,4294967294,4294967295]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
+Testing Enum Word64:
+ (succ (0::Word64)) = 1
+ (succ (minBound::Word64)) = 1
+ (succ (maxBound::Word64)) = error "Enum.succ{Word64}: tried to take `succ' of maxBound"
+ pred (1::Word64) = 0
+ pred (maxBound::Word64) = 18446744073709551614
+ pred (minBound::Word64) = error "Enum.pred{Word64}: tried to take `pred' of minBound"
+ (map (toEnum::Int->Word64) [1, fromIntegral (minBound::Word64)::Int, maxBound::Int]) = [1,0,9223372036854775807]
+ (toEnum (maxBound::Int))::Word64 = 9223372036854775807
+ (map fromEnum [(1::Word64),minBound,fromIntegral (maxBound::Int)]) = [1,0,9223372036854775807]
+ fromEnum (maxBound::Word64) = error "Enum.fromEnum{Word64}: value (18446744073709551615) is outside of Int's bounds (-9223372036854775808,9223372036854775807)"
+ (take 7 [(1::Word64)..]) = [1,2,3,4,5,6,7]
+ (take 7 [((maxBound::Word64)-5)..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [(1::Word64),2..]) = [1,2,3,4,5,6,7]
+ (take 7 [(1::Word64),7..]) = [1,7,13,19,25,31,37]
+ (take 7 [(1::Word64),1..]) = [1,1,1,1,1,1,1]
+ (take 7 [(1::Word64),0..]) = [1,0]
+ (take 7 [(5::Word64),2..]) = [5,2]
+ (take 7 [x, x-1 ..]) = [1,0]
+ (take 7 [x, x-1 ..]) = [5,4,3,2,1,0]
+ (take 7 [x, (x+1) ..]) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(1::Word64) .. 5])) = [1,2,3,4,5]
+ (take 4 ([(1::Word64) .. 1])) = [1]
+ (take 7 ([(1::Word64) .. 0])) = []
+ (take 7 ([(5::Word64) .. 0])) = []
+ (take 7 ([(maxBound-(5::Word64)) .. maxBound])) = [18446744073709551610,18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 ([(minBound+(5::Word64)) .. minBound])) = []
+ (take 7 [(5::Word64),4..1]) = [5,4,3,2,1]
+ (take 7 [(5::Word64),3..1]) = [5,3,1]
+ (take 7 [(5::Word64),3..2]) = [5,3]
+ (take 7 [(1::Word64),2..1]) = [1]
+ (take 7 [(2::Word64),1..2]) = [2]
+ (take 7 [(2::Word64),1..1]) = [2,1]
+ (take 7 [(2::Word64),3..1]) = []
+ (take 7 [x,(x+1)..maxBound]) = [18446744073709551611,18446744073709551612,18446744073709551613,18446744073709551614,18446744073709551615]
+ (take 7 [x,(x-1)..minBound]) = [5,4,3,2,1,0]
diff --git a/testsuite/tests/lib/should_run/enum04.hs b/testsuite/tests/lib/should_run/enum04.hs
new file mode 100644
index 0000000000..fed9e8c4ef
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum04.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+import Control.Exception
+import Prelude hiding (catch)
+
+-- enumFrom on basic numeric types should be strict
+-- (possibly a bug in the Haskell Report: it specifies that
+-- these ops should be strict in the section on Enum, but the
+-- sample code in the Prelude doesn't agree, at least for
+-- Float and Double).
+
+main = do
+ catch (evaluate [error "" :: Int ..] >> return ()) (\(e::SomeException) -> putStrLn "ok1")
+ catch (evaluate [error "" :: Integer ..] >> return ()) (\(e::SomeException) -> putStrLn "ok2")
+ catch (evaluate [error "" :: Float ..] >> return ()) (\(e::SomeException) -> putStrLn "ok3")
+ catch (evaluate [error "" :: Double ..] >> return ()) (\(e::SomeException) -> putStrLn "ok4")
diff --git a/testsuite/tests/lib/should_run/enum04.stdout b/testsuite/tests/lib/should_run/enum04.stdout
new file mode 100644
index 0000000000..c8a3e21e6d
--- /dev/null
+++ b/testsuite/tests/lib/should_run/enum04.stdout
@@ -0,0 +1,4 @@
+ok1
+ok2
+ok3
+ok4
diff --git a/testsuite/tests/lib/should_run/exceptionsrun001.hs b/testsuite/tests/lib/should_run/exceptionsrun001.hs
new file mode 100644
index 0000000000..9c6febc049
--- /dev/null
+++ b/testsuite/tests/lib/should_run/exceptionsrun001.hs
@@ -0,0 +1,56 @@
+module Main where
+
+import Prelude hiding (catch)
+import Control.OldException
+
+main = do
+ ioTest
+ errorTest
+ noMethodTest
+ patMatchTest
+ guardTest
+ dynTest
+
+ioTest :: IO ()
+ioTest = catchJust userErrors (ioError (userError "wibble"))
+ (\ex -> putStr "user exception caught\n")
+
+errorTest :: IO ()
+errorTest = try (evaluate (1 + error "call to 'error'")) >>= \r ->
+ case r of
+ Left exception -> putStr "error call caught\n"
+ Right _ -> error "help!"
+
+instance (Show a, Eq a) => Num (Maybe a) where {}
+
+noMethodTest :: IO ()
+noMethodTest = try (evaluate (Just () + Just ())) >>= \ r ->
+ case r of
+ Left (NoMethodError err) -> putStr "no method error\n"
+ Right _ -> error "help!"
+
+patMatchTest :: IO ()
+patMatchTest = catch (case test1 [1..10] of () -> return ())
+ (\ex -> case ex of
+ PatternMatchFail err -> putStr err
+ other -> error "help!")
+
+test1 [] = ()
+
+guardTest = catch (case test2 of () -> return ())
+ (\ex -> case ex of
+ PatternMatchFail err -> putStr err
+ other -> error "help!")
+
+test2 | all (==0) [1] = ()
+
+dynTest = catchDyn (case throwDyn (42::Int, (+1)::Int->Int) of () -> return ())
+ (\(i,f) -> let x = f (i::Int) :: Int in putStr (show x))
+
+{-
+recSelTest
+recConTest
+recUpdTest
+assertTest
+arithTest
+-}
diff --git a/testsuite/tests/lib/should_run/exceptionsrun001.stdout b/testsuite/tests/lib/should_run/exceptionsrun001.stdout
new file mode 100644
index 0000000000..2d1930f8c9
--- /dev/null
+++ b/testsuite/tests/lib/should_run/exceptionsrun001.stdout
@@ -0,0 +1,6 @@
+user exception caught
+error call caught
+no method error
+exceptionsrun001.hs:38:1-13: Non-exhaustive patterns in function test1
+exceptionsrun001.hs:45:1-26: Non-exhaustive patterns in function test2
+43 \ No newline at end of file
diff --git a/testsuite/tests/lib/should_run/exceptionsrun002.hs b/testsuite/tests/lib/should_run/exceptionsrun002.hs
new file mode 100644
index 0000000000..13b642a3ab
--- /dev/null
+++ b/testsuite/tests/lib/should_run/exceptionsrun002.hs
@@ -0,0 +1,105 @@
+module Main where
+ {
+ import qualified Control.OldException as Exception;
+ import Data.IORef;
+ import Prelude;
+
+ safeCatch :: IO () -> IO ();
+ safeCatch f = Exception.catch f (\_ -> return ());
+
+ type Thrower = IO Bool;
+
+ type Catcher = IO Bool -> IO () -> IO ();
+
+ checkCatch :: Catcher -> Thrower -> IO Bool;
+ checkCatch catcher thrower = do
+ {
+ ref <- newIORef False;
+ safeCatch (catcher thrower (writeIORef ref True));
+ readIORef ref;
+ };
+
+ data Named a = MkNamed String a;
+
+ checkNamedCatch :: Named Catcher -> Named Thrower -> IO ();
+ checkNamedCatch (MkNamed cname catcher) (MkNamed tname thrower) = do
+ {
+ didCatch <- checkCatch catcher thrower;
+ putStrLn (cname ++ (if didCatch then " CAUGHT " else " MISSED ") ++ tname);
+ };
+
+ checkNamedCatches :: [Named Catcher] -> [Named Thrower] -> IO ();
+ checkNamedCatches [] _ = return ();
+ checkNamedCatches _ [] = return ();
+ checkNamedCatches [c] (t:tr) = do
+ {
+ checkNamedCatch c t;
+ checkNamedCatches [c] tr;
+ };
+ checkNamedCatches (c:cr) ts = do
+ {
+ checkNamedCatches [c] ts;
+ checkNamedCatches cr ts
+ };
+
+
+ -- throwers
+
+ returnThrower :: Named Thrower;
+ returnThrower = MkNamed "return" (return True);
+
+ returnUndefinedThrower :: Named Thrower;
+ returnUndefinedThrower = MkNamed "return undefined" (return undefined);
+
+ returnErrorThrower :: Named Thrower;
+ returnErrorThrower = MkNamed "return error" (return (error "some error"));
+
+ undefinedThrower :: Named Thrower;
+ undefinedThrower = MkNamed "undefined" undefined;
+
+ failThrower :: Named Thrower;
+ failThrower = MkNamed "fail" (fail "some failure");
+
+ errorThrower :: Named Thrower;
+ errorThrower = MkNamed "error" (error "some error");
+
+ throwThrower :: Named Thrower;
+ throwThrower = MkNamed "Exception.throw"
+ (Exception.throw (Exception.ErrorCall "throw error"));
+
+ ioErrorErrorCallThrower :: Named Thrower;
+ ioErrorErrorCallThrower = MkNamed "ioError ErrorCall"
+ (Exception.throwIO (Exception.ErrorCall "throw error"));
+
+ ioErrorIOExceptionThrower :: Named Thrower;
+ ioErrorIOExceptionThrower = MkNamed "ioError IOException"
+ (Exception.throwIO (Exception.IOException undefined));
+
+ returnThrowThrower :: Named Thrower;
+ returnThrowThrower = MkNamed "return Exception.throw"
+ (return (Exception.throw (Exception.ErrorCall "throw error")));
+
+
+ -- catchers
+
+ bindCatcher :: Named Catcher;
+ bindCatcher = MkNamed ">>" (>>);
+
+ preludeCatchCatcher :: Named Catcher;
+ preludeCatchCatcher = MkNamed "Prelude.catch"
+ (\f cc -> Prelude.catch (f >> (return ())) (const cc));
+
+ ceCatchCatcher :: Named Catcher;
+ ceCatchCatcher = MkNamed "Exception.catch"
+ (\f cc -> Exception.catch (f >> (return ())) (const cc));
+
+ finallyCatcher :: Named Catcher;
+ finallyCatcher = MkNamed "Exception.finally"
+ (\f cc -> Exception.finally (f >> (return ())) cc);
+
+ main = checkNamedCatches
+ [bindCatcher,preludeCatchCatcher,ceCatchCatcher,finallyCatcher]
+ [returnThrower,returnUndefinedThrower,returnThrowThrower,returnErrorThrower,failThrower,
+ errorThrower,throwThrower,ioErrorErrorCallThrower,ioErrorIOExceptionThrower,undefinedThrower];
+
+ }
diff --git a/testsuite/tests/lib/should_run/exceptionsrun002.stdout b/testsuite/tests/lib/should_run/exceptionsrun002.stdout
new file mode 100644
index 0000000000..e15116f5c0
--- /dev/null
+++ b/testsuite/tests/lib/should_run/exceptionsrun002.stdout
@@ -0,0 +1,40 @@
+>> CAUGHT return
+>> CAUGHT return undefined
+>> CAUGHT return Exception.throw
+>> CAUGHT return error
+>> MISSED fail
+>> MISSED error
+>> MISSED Exception.throw
+>> MISSED ioError ErrorCall
+>> MISSED ioError IOException
+>> MISSED undefined
+Prelude.catch MISSED return
+Prelude.catch MISSED return undefined
+Prelude.catch MISSED return Exception.throw
+Prelude.catch MISSED return error
+Prelude.catch CAUGHT fail
+Prelude.catch MISSED error
+Prelude.catch MISSED Exception.throw
+Prelude.catch MISSED ioError ErrorCall
+Prelude.catch CAUGHT ioError IOException
+Prelude.catch MISSED undefined
+Exception.catch MISSED return
+Exception.catch MISSED return undefined
+Exception.catch MISSED return Exception.throw
+Exception.catch MISSED return error
+Exception.catch CAUGHT fail
+Exception.catch CAUGHT error
+Exception.catch CAUGHT Exception.throw
+Exception.catch CAUGHT ioError ErrorCall
+Exception.catch CAUGHT ioError IOException
+Exception.catch CAUGHT undefined
+Exception.finally CAUGHT return
+Exception.finally CAUGHT return undefined
+Exception.finally CAUGHT return Exception.throw
+Exception.finally CAUGHT return error
+Exception.finally CAUGHT fail
+Exception.finally CAUGHT error
+Exception.finally CAUGHT Exception.throw
+Exception.finally CAUGHT ioError ErrorCall
+Exception.finally CAUGHT ioError IOException
+Exception.finally CAUGHT undefined
diff --git a/testsuite/tests/lib/should_run/length001.hs b/testsuite/tests/lib/should_run/length001.hs
new file mode 100644
index 0000000000..321a1b9dfc
--- /dev/null
+++ b/testsuite/tests/lib/should_run/length001.hs
@@ -0,0 +1,8 @@
+
+module Main (main) where
+
+import Data.List
+
+main :: IO ()
+main = do print (genericLength [1..10000000] :: Int)
+ print (genericLength [1..10000000] :: Integer)
diff --git a/testsuite/tests/lib/should_run/length001.stdout b/testsuite/tests/lib/should_run/length001.stdout
new file mode 100644
index 0000000000..4e65c4e0d2
--- /dev/null
+++ b/testsuite/tests/lib/should_run/length001.stdout
@@ -0,0 +1,2 @@
+10000000
+10000000
diff --git a/testsuite/tests/lib/should_run/list001.hs b/testsuite/tests/lib/should_run/list001.hs
new file mode 100644
index 0000000000..c0a1eced27
--- /dev/null
+++ b/testsuite/tests/lib/should_run/list001.hs
@@ -0,0 +1,152 @@
+module Main where
+
+import Data.List
+import Control.Exception
+import Prelude hiding (catch)
+
+-- This module briefly tests all the functions in PrelList and a few
+-- from List.
+
+-- ToDo: test strictness properties.
+
+main = do
+
+ -- head
+ print (head [1,2,3,4], head "a")
+ catch (print (head [] :: String)) (\(ErrorCall _) -> putStr "head []\n")
+
+ -- tail
+ print (tail [1,2,3,4], tail "a")
+ catch (print (tail [] :: String)) (\(ErrorCall _) -> putStr "tail []\n")
+
+ -- init
+ print (init [1,2,3,4], init "a")
+ catch (print (init [] :: String)) (\(ErrorCall _) -> putStr "init []\n")
+
+ -- last
+ print (last [1,2,3,4], last "a")
+ catch (print (last [] :: String)) (\(ErrorCall _) -> putStr "last []\n")
+
+ -- null
+ print [null [], null "abc"]
+
+ -- length
+ print (length [1..10])
+
+ -- foldl
+ print (foldl (+) 1 [1..10])
+
+ -- foldl1
+ print (foldl1 (+) [1..10])
+ catch (print (foldl1 (+) [] :: Int)) (\(ErrorCall _) -> putStr "foldl1 []\n")
+
+ -- scanl
+ print (scanl (+) 1 [1..10])
+
+ -- scanl1
+ print (scanl1 (+) [1..10])
+ print (scanl1 (+) [] :: [Int])
+
+ -- foldr1
+ print (foldr1 (+) [1..10])
+ catch (print (foldr1 (+) [] :: Int)) (\(ErrorCall _) -> putStr "foldr1 []\n")
+
+ -- scanr
+ print (scanr (+) 1 [1..10])
+
+ -- scanr1
+ print (scanr1 (+) [1..10])
+ print (scanr1 (+) [] :: [Int])
+
+ -- iterate
+ print (take 10 (cycle (take 4 (iterate (+1) 1))))
+
+ -- take
+ print (take 4 (repeat "x"), take 0 (repeat "x"), take 5 [1..4])
+ catch (print (take (-1) [1..10])) (\(ErrorCall _) -> putStr "take (-1)\n")
+
+ -- replicate
+ print [replicate 2 "abc", replicate 0 "abc", replicate 3 []]
+
+ -- drop
+ print [drop 5 [1..10], drop 0 [1..10], drop 5 [1..4]]
+ catch (print (drop (-1) [1..10])) (\(ErrorCall _) -> putStr "drop (-1)\n")
+
+ -- splitAt
+ print [splitAt 5 [1..10], splitAt 5 [1..4]]
+ catch (print (splitAt (-1) [1..10])) (\(ErrorCall _) -> putStr "splitAt (-1)\n")
+
+ -- scan
+ print (span (<5) [1..10])
+
+ -- break
+ print (break (<5) [1..10])
+
+ -- reverse
+ print [reverse [1..10], reverse []]
+
+ -- and
+ print [and [], and [True], and [False]]
+
+ -- or
+ print [or [], or [True], or [False]]
+
+ -- elem
+ print [elem 5 [1..10], elem 0 [1..10], elem 1 []]
+
+ -- notElem
+ print [notElem 5 [1..10], notElem 0 [1..10], notElem 1 []]
+
+ -- lookkup
+ print (lookup 4 (zip [1..10] (reverse [1..10])))
+
+ -- sum
+ print [sum [1..10], sum []]
+
+ -- product
+ print [product [1..10], product []]
+
+ -- maximum
+ print (maximum [1..10])
+ catch (print (maximum [] :: Int)) (\(ErrorCall _) -> putStr "maximum []\n")
+
+ -- minimum
+ print (minimum [1..10])
+ catch (print (minimum [] :: Int)) (\(ErrorCall _) -> putStr "minimum []\n")
+
+ -- concatMap
+ print (concatMap (:[]) [(1::Int)..10])
+
+ -- zip
+ print [zip [1] [2], zip [1] [], zip [] [2], zip [1..5] [2..6]]
+
+ -- zip3
+ print (zip3 [1,2] [3,4] [5,6])
+
+ -- zipWith
+ print [zipWith (+) [1,2] [3,4], zipWith (+) [1] [], zipWith (+) [] []]
+
+ -- unzip
+ print [unzip [(1,2),(3,4)], unzip []]
+
+ -- unzip3
+ print [unzip3 [(1,2,3),(3,4,5)], unzip3 []]
+
+ -- unlines
+ print (unlines (lines "a\nb\nc\n"), lines "", unlines [])
+
+ -- words
+ print (unwords (words "a b c d"), words "", unwords [])
+
+ -- deleteBy
+ print [deleteBy (==) 1 [0,1,1,2,3,4],
+ deleteBy (==) (error "deleteBy") []]
+
+ -- delete
+ print [delete 1 [0,1,1,2,3,4],
+ delete (error "delete") []]
+
+ -- \\
+ print [ [0,1,1,2,3,4] \\ [3,2,1],
+ [1,2,3,4] \\ [],
+ [] \\ [error "\\\\"] ]
diff --git a/testsuite/tests/lib/should_run/list001.stdout b/testsuite/tests/lib/should_run/list001.stdout
new file mode 100644
index 0000000000..b8254f066e
--- /dev/null
+++ b/testsuite/tests/lib/should_run/list001.stdout
@@ -0,0 +1,54 @@
+(1,'a')
+"head []
+([2,3,4],"")
+"tail []
+([1,2,3],"")
+"init []
+(4,'a')
+"last []
+[True,False]
+10
+56
+55
+foldl1 []
+[1,2,4,7,11,16,22,29,37,46,56]
+[1,3,6,10,15,21,28,36,45,55]
+[]
+55
+foldr1 []
+[56,55,53,50,46,41,35,28,20,11,1]
+[55,54,52,49,45,40,34,27,19,10]
+[]
+[1,2,3,4,1,2,3,4,1,2]
+(["x","x","x","x"],[],[1,2,3,4])
+[]
+[["abc","abc"],[],["","",""]]
+[[6,7,8,9,10],[1,2,3,4,5,6,7,8,9,10],[]]
+[1,2,3,4,5,6,7,8,9,10]
+[([1,2,3,4,5],[6,7,8,9,10]),([1,2,3,4],[])]
+([],[1,2,3,4,5,6,7,8,9,10])
+([1,2,3,4],[5,6,7,8,9,10])
+([],[1,2,3,4,5,6,7,8,9,10])
+[[10,9,8,7,6,5,4,3,2,1],[]]
+[True,True,False]
+[False,True,False]
+[True,False,False]
+[False,True,True]
+Just 7
+[55,0]
+[3628800,1]
+10
+maximum []
+1
+minimum []
+[1,2,3,4,5,6,7,8,9,10]
+[[(1,2)],[],[],[(1,2),(2,3),(3,4),(4,5),(5,6)]]
+[(1,3,5),(2,4,6)]
+[[4,6],[],[]]
+[([1,3],[2,4]),([],[])]
+[([1,3],[2,4],[3,5]),([],[],[])]
+("a\nb\nc\n",[],"")
+("a b c d",[],"")
+[[0,1,2,3,4],[]]
+[[0,1,2,3,4],[]]
+[[0,1,4],[1,2,3,4],[]]
diff --git a/testsuite/tests/lib/should_run/list001.stdout-ghc b/testsuite/tests/lib/should_run/list001.stdout-ghc
new file mode 100644
index 0000000000..16e780ac7b
--- /dev/null
+++ b/testsuite/tests/lib/should_run/list001.stdout-ghc
@@ -0,0 +1,54 @@
+(1,'a')
+head []
+([2,3,4],"")
+tail []
+([1,2,3],"")
+init []
+(4,'a')
+last []
+[True,False]
+10
+56
+55
+foldl1 []
+[1,2,4,7,11,16,22,29,37,46,56]
+[1,3,6,10,15,21,28,36,45,55]
+[]
+55
+foldr1 []
+[56,55,53,50,46,41,35,28,20,11,1]
+[55,54,52,49,45,40,34,27,19,10]
+[]
+[1,2,3,4,1,2,3,4,1,2]
+(["x","x","x","x"],[],[1,2,3,4])
+[]
+[["abc","abc"],[],["","",""]]
+[[6,7,8,9,10],[1,2,3,4,5,6,7,8,9,10],[]]
+[1,2,3,4,5,6,7,8,9,10]
+[([1,2,3,4,5],[6,7,8,9,10]),([1,2,3,4],[])]
+([],[1,2,3,4,5,6,7,8,9,10])
+([1,2,3,4],[5,6,7,8,9,10])
+([],[1,2,3,4,5,6,7,8,9,10])
+[[10,9,8,7,6,5,4,3,2,1],[]]
+[True,True,False]
+[False,True,False]
+[True,False,False]
+[False,True,True]
+Just 7
+[55,0]
+[3628800,1]
+10
+maximum []
+1
+minimum []
+[1,2,3,4,5,6,7,8,9,10]
+[[(1,2)],[],[],[(1,2),(2,3),(3,4),(4,5),(5,6)]]
+[(1,3,5),(2,4,6)]
+[[4,6],[],[]]
+[([1,3],[2,4]),([],[])]
+[([1,3],[2,4],[3,5]),([],[],[])]
+("a\nb\nc\n",[],"")
+("a b c d",[],"")
+[[0,1,2,3,4],[]]
+[[0,1,2,3,4],[]]
+[[0,1,4],[1,2,3,4],[]]
diff --git a/testsuite/tests/lib/should_run/list002.hs b/testsuite/tests/lib/should_run/list002.hs
new file mode 100644
index 0000000000..188ff8953d
--- /dev/null
+++ b/testsuite/tests/lib/should_run/list002.hs
@@ -0,0 +1,6 @@
+-- !!! Test that List.sortBy is stable.
+
+import Data.List
+
+main = print (sortBy (\(a,b) (a',b')->compare a a')
+ ([1,1,1,1,1,1,1,1,1,1]`zip`[1..10]))
diff --git a/testsuite/tests/lib/should_run/list002.stdout b/testsuite/tests/lib/should_run/list002.stdout
new file mode 100644
index 0000000000..18e1fcad8a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/list002.stdout
@@ -0,0 +1 @@
+[(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8),(1,9),(1,10)]
diff --git a/testsuite/tests/lib/should_run/list003.hs b/testsuite/tests/lib/should_run/list003.hs
new file mode 100644
index 0000000000..a792094438
--- /dev/null
+++ b/testsuite/tests/lib/should_run/list003.hs
@@ -0,0 +1,7 @@
+-- !!! Test that length doesn't give a stack overflow
+
+module Main (main) where
+
+main :: IO ()
+main = print $ length $ filter odd [0 .. 9999999]
+
diff --git a/testsuite/tests/lib/should_run/list003.stdout b/testsuite/tests/lib/should_run/list003.stdout
new file mode 100644
index 0000000000..447a331b1b
--- /dev/null
+++ b/testsuite/tests/lib/should_run/list003.stdout
@@ -0,0 +1 @@
+5000000
diff --git a/testsuite/tests/lib/should_run/memo001.hs b/testsuite/tests/lib/should_run/memo001.hs
new file mode 100644
index 0000000000..551bcd8cf4
--- /dev/null
+++ b/testsuite/tests/lib/should_run/memo001.hs
@@ -0,0 +1,19 @@
+module Main(main) where
+
+import Memo1
+
+testMemo = do
+ let keys = [ [1..n] | n <- [1..1000] ]
+ keys2 = [ [n,n-1..1] | n <- [1..1000] ]
+ mlength = memo length
+ putStr (show (map mlength (keys ++ keys ++ keys2 ++ keys2)))
+ putStr (show (mlength [1..100000]))
+
+-- mlength will memoize itself over each element of 'keys', returning
+-- the memoized result the second time around. Then we move onto
+-- keys2, and while we're doing this the first lot of memo table
+-- entries can be purged. Finally, we do a a large computation
+-- (length [1..10000]) to allow time for the memo table to be fully
+-- purged.
+
+main = testMemo
diff --git a/testsuite/tests/lib/should_run/memo001.stdout b/testsuite/tests/lib/should_run/memo001.stdout
new file mode 100644
index 0000000000..0e1bce9647
--- /dev/null
+++ b/testsuite/tests/lib/should_run/memo001.stdout
@@ -0,0 +1 @@
+[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,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,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,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,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,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,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,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000]100000 \ No newline at end of file
diff --git a/testsuite/tests/lib/should_run/memo002.hs b/testsuite/tests/lib/should_run/memo002.hs
new file mode 100644
index 0000000000..aa0a1d27c9
--- /dev/null
+++ b/testsuite/tests/lib/should_run/memo002.hs
@@ -0,0 +1,30 @@
+module Main where
+
+import Memo2 ( memo )
+import Data.List ( genericLength, genericReplicate )
+import System.Environment ( getArgs )
+
+main :: IO ()
+main = do (arg:_) <- getArgs
+ mapM_ printTriple [ (i,fib i,mfib i) | i <- [10..read arg] ]
+ where printTriple (i,fi,mfi) = do print i
+ print fi
+ print mfi
+ putStrLn ""
+
+-- There is not much point in memoising Integers, so we use unary "numbers" instead
+mfib :: Integer -> Integer
+mfib = genericLength . mfib' . flip genericReplicate ()
+
+mfib' :: [()] -> [()]
+mfib' = memo ufib
+
+ufib :: [()] -> [()]
+ufib [] = [()]
+ufib [()] = [()]
+ufib (():n1@(():n2)) = mfib' n1 ++ mfib' n2
+
+fib :: Integer -> Integer
+fib 0 = 1
+fib 1 = 1
+fib n = fib (n-1) + fib (n-2)
diff --git a/testsuite/tests/lib/should_run/memo002.stdout b/testsuite/tests/lib/should_run/memo002.stdout
new file mode 100644
index 0000000000..7369b408ef
--- /dev/null
+++ b/testsuite/tests/lib/should_run/memo002.stdout
@@ -0,0 +1,44 @@
+10
+89
+89
+
+11
+144
+144
+
+12
+233
+233
+
+13
+377
+377
+
+14
+610
+610
+
+15
+987
+987
+
+16
+1597
+1597
+
+17
+2584
+2584
+
+18
+4181
+4181
+
+19
+6765
+6765
+
+20
+10946
+10946
+
diff --git a/testsuite/tests/lib/should_run/packedstring001.hs b/testsuite/tests/lib/should_run/packedstring001.hs
new file mode 100644
index 0000000000..9ee24e232c
--- /dev/null
+++ b/testsuite/tests/lib/should_run/packedstring001.hs
@@ -0,0 +1,11 @@
+
+module Main (main) where
+
+import Char (isSpace)
+import Data.PackedString
+
+-- Bug in PackedString.lhs (fixed in rev 1.5)
+
+foo = packString "this is a test"
+main = print (filterPS (not.isSpace) foo)
+
diff --git a/testsuite/tests/lib/should_run/packedstring001.stdout b/testsuite/tests/lib/should_run/packedstring001.stdout
new file mode 100644
index 0000000000..fbd5abc3a0
--- /dev/null
+++ b/testsuite/tests/lib/should_run/packedstring001.stdout
@@ -0,0 +1 @@
+"thisisatest"
diff --git a/testsuite/tests/lib/should_run/rand001.hs b/testsuite/tests/lib/should_run/rand001.hs
new file mode 100644
index 0000000000..3567ae0dd8
--- /dev/null
+++ b/testsuite/tests/lib/should_run/rand001.hs
@@ -0,0 +1,22 @@
+module Main(main) where
+
+import System.Random
+
+tstRnd rng = checkRange rng (genRnd 50 rng)
+
+genRnd n rng = take n (randomRs rng (mkStdGen 2))
+
+checkRange (lo,hi) = all pred
+ where
+ pred
+ | lo <= hi = \ x -> x >= lo && x <= hi
+ | otherwise = \ x -> x >= hi && x <= lo
+
+main :: IO ()
+main = do
+ print (tstRnd (1,5::Double))
+ print (tstRnd (1,5::Int))
+ print (tstRnd (10,54::Integer))
+ print (tstRnd ((-6),2::Int))
+ print (tstRnd (2,(-6)::Int))
+
diff --git a/testsuite/tests/lib/should_run/rand001.stdout b/testsuite/tests/lib/should_run/rand001.stdout
new file mode 100644
index 0000000000..2e883c51de
--- /dev/null
+++ b/testsuite/tests/lib/should_run/rand001.stdout
@@ -0,0 +1,5 @@
+True
+True
+True
+True
+True
diff --git a/testsuite/tests/lib/should_run/ratio001.hs b/testsuite/tests/lib/should_run/ratio001.hs
new file mode 100644
index 0000000000..4d65dfbccf
--- /dev/null
+++ b/testsuite/tests/lib/should_run/ratio001.hs
@@ -0,0 +1,4 @@
+import Data.Ratio
+
+-- !!! Test that (%) has the right fixity
+main = print (2^3%5)
diff --git a/testsuite/tests/lib/should_run/ratio001.stdout b/testsuite/tests/lib/should_run/ratio001.stdout
new file mode 100644
index 0000000000..f7355f9a4a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/ratio001.stdout
@@ -0,0 +1 @@
+8 % 5
diff --git a/testsuite/tests/lib/should_run/ratio001.stdout-ghc b/testsuite/tests/lib/should_run/ratio001.stdout-ghc
new file mode 100644
index 0000000000..f7355f9a4a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/ratio001.stdout-ghc
@@ -0,0 +1 @@
+8 % 5
diff --git a/testsuite/tests/lib/should_run/reads001.hs b/testsuite/tests/lib/should_run/reads001.hs
new file mode 100644
index 0000000000..318367e7f4
--- /dev/null
+++ b/testsuite/tests/lib/should_run/reads001.hs
@@ -0,0 +1,10 @@
+-- Test the classic "\SOH" ambiguity
+
+module Main(main) where
+
+main = do { print soh ; print (length (fst (head soh))) ;
+ print so ; print (length (fst (head so))) }
+ where
+ so, soh :: [(String,String)]
+ soh = reads "\"\\SOH\"" -- Should read \SOH
+ so = reads "\"\\SOx\"" -- Should read \SO followed by x
diff --git a/testsuite/tests/lib/should_run/reads001.stdout b/testsuite/tests/lib/should_run/reads001.stdout
new file mode 100644
index 0000000000..23639933e8
--- /dev/null
+++ b/testsuite/tests/lib/should_run/reads001.stdout
@@ -0,0 +1,4 @@
+[("\SOH","")]
+1
+[("\SOx","")]
+2
diff --git a/testsuite/tests/lib/should_run/show001.hs b/testsuite/tests/lib/should_run/show001.hs
new file mode 100644
index 0000000000..69c27d01ea
--- /dev/null
+++ b/testsuite/tests/lib/should_run/show001.hs
@@ -0,0 +1,24 @@
+-- !!! Testing Show on Maybes and Eithers
+module Main(main) where
+
+x :: Maybe ()
+x = Nothing
+
+main :: IO ()
+main = do
+ print x
+ print (Just ())
+ print ((Just (Just ())) :: Maybe (Maybe ()))
+ print (Just x)
+ print ((Left 'a') :: Either Char Int)
+ print ((Right 'b') :: Either Int Char)
+ print ((Right x) :: Either Int (Maybe ()))
+ print ((Right (Just 'c')) :: Either Int (Maybe Char))
+ print ((Right (Right 'd')) :: Either Int (Either Char Char))
+ print ((Right (Left 'e')) :: Either Int (Either Char Int))
+ print ((Left 'f') :: Either Char Int)
+ print ((Left x) :: Either (Maybe ()) Char)
+ print ((Left (Just 'g')) :: Either (Maybe Char) ())
+ print ((Left (Right 'h')) :: Either (Either Int Char) Char)
+ print ((Left (Right 'i')) :: Either (Either Int Char) ())
+
diff --git a/testsuite/tests/lib/should_run/show001.stdout b/testsuite/tests/lib/should_run/show001.stdout
new file mode 100644
index 0000000000..3be0062e87
--- /dev/null
+++ b/testsuite/tests/lib/should_run/show001.stdout
@@ -0,0 +1,15 @@
+Nothing
+Just ()
+Just (Just ())
+Just Nothing
+Left 'a'
+Right 'b'
+Right Nothing
+Right (Just 'c')
+Right (Right 'd')
+Right (Left 'e')
+Left 'f'
+Left Nothing
+Left (Just 'g')
+Left (Right 'h')
+Left (Right 'i')
diff --git a/testsuite/tests/lib/should_run/stableptr001.hs b/testsuite/tests/lib/should_run/stableptr001.hs
new file mode 100644
index 0000000000..1bc857aba6
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr001.hs
@@ -0,0 +1,19 @@
+
+module Main where
+
+import Foreign
+
+-- simple test for building/dereferencing stable ptrs
+
+main
+ = do l <- mapM newStablePtr [1..100000]
+ sum <- stable_sum l
+ print sum
+
+stable_sum :: [StablePtr Integer] -> IO Integer
+stable_sum [] = return 0
+stable_sum (x:xs)
+ = do x' <- deRefStablePtr x
+ freeStablePtr x
+ xs' <- stable_sum xs
+ return (x' + xs')
diff --git a/testsuite/tests/lib/should_run/stableptr001.stdout b/testsuite/tests/lib/should_run/stableptr001.stdout
new file mode 100644
index 0000000000..90ee71a089
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr001.stdout
@@ -0,0 +1 @@
+5000050000
diff --git a/testsuite/tests/lib/should_run/stableptr003.hs b/testsuite/tests/lib/should_run/stableptr003.hs
new file mode 100644
index 0000000000..77f4e3c9dc
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr003.hs
@@ -0,0 +1,16 @@
+module Main where
+
+import Control.Monad
+import System.Mem.StableName
+import Control.Exception
+
+main = do
+ mapM_ evaluate list
+ stable_list1 <- mapM makeStableName list
+ stable_list2 <- mapM makeStableName list
+ unless (stable_list1 == stable_list2) $ do
+ let l1 = map hashStableName stable_list1
+ let l2 = map hashStableName stable_list2
+ print $ zip l1 l2
+
+list = [1..10000] :: [Integer]
diff --git a/testsuite/tests/lib/should_run/stableptr004.hs b/testsuite/tests/lib/should_run/stableptr004.hs
new file mode 100644
index 0000000000..2d6f567cae
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr004.hs
@@ -0,0 +1,12 @@
+import Foreign.StablePtr
+
+-- compile without optimisation.
+-- run with +RTS -D256 to see the stable pointer being garbage collected.
+
+main = do
+ let xs = [ 1 .. 50000 ]
+ let ys = [ 1 .. 60000 ]
+ s1 <- newStablePtr xs
+ print (sum xs)
+ freeStablePtr s1
+ print (sum ys)
diff --git a/testsuite/tests/lib/should_run/stableptr004.stdout b/testsuite/tests/lib/should_run/stableptr004.stdout
new file mode 100644
index 0000000000..30e717b5bd
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr004.stdout
@@ -0,0 +1,2 @@
+1250025000
+1800030000
diff --git a/testsuite/tests/lib/should_run/stableptr005.hs b/testsuite/tests/lib/should_run/stableptr005.hs
new file mode 100644
index 0000000000..dc4928ab6c
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr005.hs
@@ -0,0 +1,22 @@
+-- !!! triggered a temporary bug in freeStablePtr around 20020424
+
+module Main where
+import Foreign.StablePtr (newStablePtr, freeStablePtr)
+
+data Foo = A | B | C | D
+
+main :: IO ()
+main = do aSPtr <- newStablePtr A
+ bSPtr <- newStablePtr B
+ cSPtr <- newStablePtr C
+ cSPtr' <- newStablePtr C
+ freeStablePtr aSPtr
+ freeStablePtr bSPtr
+ freeStablePtr cSPtr
+ freeStablePtr cSPtr'
+ aSPtr <- newStablePtr A
+ bSPtr <- newStablePtr B
+ cSPtr <- newStablePtr C
+ dSPtr <- newStablePtr D
+ print "Hello World"
+
diff --git a/testsuite/tests/lib/should_run/stableptr005.stdout b/testsuite/tests/lib/should_run/stableptr005.stdout
new file mode 100644
index 0000000000..06ae699f22
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr005.stdout
@@ -0,0 +1 @@
+"Hello World"
diff --git a/testsuite/tests/lib/should_run/text001.hs b/testsuite/tests/lib/should_run/text001.hs
new file mode 100644
index 0000000000..18aab82dd9
--- /dev/null
+++ b/testsuite/tests/lib/should_run/text001.hs
@@ -0,0 +1,15 @@
+{- Bug report 28 May 99
+
+When compiled with ghc-4.02, everything's fine, it outputs "Value 7" as
+expected. But compiled with ghc-pre-4.03 it yields this error message.
+
+ Fail: Prelude.read: no parse
+-}
+
+module Main where
+
+data Msg = Value Int | Inc deriving (Show, Read)
+
+main = do let v = read "Value 7"::Msg
+ print v
+
diff --git a/testsuite/tests/lib/should_run/text001.stdout b/testsuite/tests/lib/should_run/text001.stdout
new file mode 100644
index 0000000000..a0c782242e
--- /dev/null
+++ b/testsuite/tests/lib/should_run/text001.stdout
@@ -0,0 +1 @@
+Value 7
diff --git a/testsuite/tests/lib/should_run/tup001.hs b/testsuite/tests/lib/should_run/tup001.hs
new file mode 100644
index 0000000000..a70e09027a
--- /dev/null
+++ b/testsuite/tests/lib/should_run/tup001.hs
@@ -0,0 +1,33 @@
+-- Test instances for tuples up to 15
+-- For Read, Show, Eq, Ord, Bounded
+
+module Main where
+
+data T = A | B | C | D | E | F | G | H | I | J | K | L | M | N | O
+ deriving( Eq, Ord, Show, Read, Bounded )
+
+t15 = (A,B,C,D,E,F,G,H,I,J,K,L,M,N,O)
+t14 = (A,B,C,D,E,F,G,H,I,J,K,L,M,N)
+t13 = (A,B,C,D,E,F,G,H,I,J,K,L,M)
+t12 = (A,B,C,D,E,F,G,H,I,J,K,L)
+t11 = (A,B,C,D,E,F,G,H,I,J,K)
+t10 = (A,B,C,D,E,F,G,H,I,J)
+t9 = (A,B,C,D,E,F,G,H,I)
+t8 = (A,B,C,D,E,F,G,H)
+t7 = (A,B,C,D,E,F,G)
+t6 = (A,B,C,D,E,F)
+t5 = (A,B,C,D,E)
+t4 = (A,B,C,D)
+t3 = (A,B,C)
+t2 = (A,B)
+t0 = ()
+
+big = (t0,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15)
+
+main = do print big
+ print (read (show big) `asTypeOf` big)
+ print (big == big)
+ print (big < big)
+ print (big > big)
+ print (minBound `asTypeOf` big)
+ print (maxBound `asTypeOf` big) \ No newline at end of file
diff --git a/testsuite/tests/lib/should_run/tup001.stdout b/testsuite/tests/lib/should_run/tup001.stdout
new file mode 100644
index 0000000000..540340b816
--- /dev/null
+++ b/testsuite/tests/lib/should_run/tup001.stdout
@@ -0,0 +1,7 @@
+((),(A,B),(A,B,C),(A,B,C,D),(A,B,C,D,E),(A,B,C,D,E,F),(A,B,C,D,E,F,G),(A,B,C,D,E,F,G,H),(A,B,C,D,E,F,G,H,I),(A,B,C,D,E,F,G,H,I,J),(A,B,C,D,E,F,G,H,I,J,K),(A,B,C,D,E,F,G,H,I,J,K,L),(A,B,C,D,E,F,G,H,I,J,K,L,M),(A,B,C,D,E,F,G,H,I,J,K,L,M,N),(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))
+((),(A,B),(A,B,C),(A,B,C,D),(A,B,C,D,E),(A,B,C,D,E,F),(A,B,C,D,E,F,G),(A,B,C,D,E,F,G,H),(A,B,C,D,E,F,G,H,I),(A,B,C,D,E,F,G,H,I,J),(A,B,C,D,E,F,G,H,I,J,K),(A,B,C,D,E,F,G,H,I,J,K,L),(A,B,C,D,E,F,G,H,I,J,K,L,M),(A,B,C,D,E,F,G,H,I,J,K,L,M,N),(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))
+True
+False
+False
+((),(A,A),(A,A,A),(A,A,A,A),(A,A,A,A,A),(A,A,A,A,A,A),(A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A,A,A,A,A,A,A),(A,A,A,A,A,A,A,A,A,A,A,A,A,A,A))
+((),(O,O),(O,O,O),(O,O,O,O),(O,O,O,O,O),(O,O,O,O,O,O),(O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O,O,O,O,O,O,O),(O,O,O,O,O,O,O,O,O,O,O,O,O,O,O))
diff --git a/testsuite/tests/lib/should_run/weak001.hs b/testsuite/tests/lib/should_run/weak001.hs
new file mode 100644
index 0000000000..60dc9c4a12
--- /dev/null
+++ b/testsuite/tests/lib/should_run/weak001.hs
@@ -0,0 +1,12 @@
+import Foreign
+import System.Mem.Weak
+
+kill:: Ptr a -> IO ()
+kill a = do
+ w <- mkWeakPtr a Nothing
+ addFinalizer a $
+ deRefWeak w >> return ()
+
+main:: IO ()
+main = sequence_ . take 10000 . repeat $
+ mallocBytes 100 >>= kill >> return ()
diff --git a/testsuite/tests/lib/socket/Makefile b/testsuite/tests/lib/socket/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/socket/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/socket/socket001.hs b/testsuite/tests/lib/socket/socket001.hs
new file mode 100644
index 0000000000..0af7afa0d7
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket001.hs
@@ -0,0 +1,58 @@
+{- server
+
+The purpose of this test driver is to test TCP Stream sockets.
+All values have been hard coded since the BSD library is not used to
+query the databases for the values. In therory this code is thus not
+portable but net007/Main.hs provides a portable version using the BSD
+module.
+
+This creates a stream socket bound to port 5000 and waits for incoming
+messages it then reads all available data before closing the
+connection to that peer.
+
+No form of error checking is provided other than that already provided
+by module SocketPrim.
+
+
+TESTS:
+ socket
+ bindSocket
+ listen
+ accept
+ readSocket
+ sClose
+
+-}
+
+
+module Main where
+
+import SocketPrim
+
+main = do
+ s <- socket AF_INET Stream 6
+ bindSocket s (SockAddrInet (fromIntegral 5000) iNADDR_ANY)
+ listen s 5
+
+ let
+ loop =
+ accept s >>= \ (s',peerAddr) ->
+ putStr "*** Start of Transfer ***\n" >>
+ h <- socketToHandle s'
+ let
+ read_all =
+ b <- hEOF h
+ c <- hGetChar h
+ putChar c
+
+ if nbytes /= 0 then
+ putStr str >>
+ read_all
+ else
+ putStr "\n*** End of Transfer ***\n" >>
+ sClose s'
+ in
+ read_all
+
+ loop
+
diff --git a/testsuite/tests/lib/socket/socket001.stdout b/testsuite/tests/lib/socket/socket001.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket001.stdout
diff --git a/testsuite/tests/lib/socket/socket002.hs b/testsuite/tests/lib/socket/socket002.hs
new file mode 100644
index 0000000000..1e7b19da0b
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket002.hs
@@ -0,0 +1,45 @@
+{- client
+
+Client side to net001/Main.hs.
+
+Note that the machine IP numbers have been hard coded into this
+program so it is unlikely that you will be able to run this test if
+you are not at dcs.gla.ac.uk :-(
+
+The reason for this is to aviod using the BSD module at this stage of
+testing.
+
+
+TESTS:
+ socket
+ connect
+ writeSocket
+ shutdown
+ inet_addr
+-}
+
+
+module Main where
+
+import SocketPrim
+
+
+starbuck = "130.209.240.81" -- SunOS 4.1.3 1 sun4c
+marcus = "130.209.247.2" -- SunOS 4.1.3 6 sun4m
+avon = "130.209.247.4" -- OSF1 V2.0 240 alpha
+karkar = "130.209.247.3" -- OSF1 V2.0 240 alpha
+nauru = "130.209.247.5" -- Linux 2.0.30 (RH-4.2) x86
+easter = "130.209.247.6" -- Linux 2.0.30 (RH-4.2) x86
+
+message = "Hello World"
+
+
+main =
+ socket AF_INET Stream 6 >>= \ s ->
+ inet_addr easter >>= \ ia ->
+ connect s (SockAddrInet (mkPortNumber 5000) ia) >>
+
+ writeSocket s message >>
+ shutdown s ShutdownBoth >>
+ sClose s
+
diff --git a/testsuite/tests/lib/socket/socket002.stdout b/testsuite/tests/lib/socket/socket002.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket002.stdout
diff --git a/testsuite/tests/lib/socket/socket003.hs b/testsuite/tests/lib/socket/socket003.hs
new file mode 100644
index 0000000000..ea88a34dde
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket003.hs
@@ -0,0 +1,43 @@
+{- server
+
+As for net001 but gets the system to allocate the next free port
+number. It also prints out the IP number of the peer.
+
+TESTS:
+ getSocketName
+ inet_ntoa
+
+-}
+
+module Main where
+
+import SocketPrim
+
+
+main =
+ socket AF_INET Stream 6 >>= \ s ->
+ bindSocket s (SockAddrInet aNY_PORT iNADDR_ANY) >>
+ getSocketName s >>= \ (SockAddrInet port _) ->
+ putStr ("Allocated Port Number: " ++ show port ++ "\n") >>
+ listen s 5 >>
+
+
+ let
+ loop =
+ accept s >>= \ (s',(SockAddrInet _ haddr)) ->
+ inet_ntoa haddr >>= \ na ->
+ putStr ("*** Start of Transfer from: " ++ na ++ "***\n") >>
+ let
+ read_all =
+ readSocket s' 4 >>= \ (str, nbytes) ->
+ if nbytes /= 0 then
+ putStr str >>
+ read_all
+ else
+ putStr "\n*** End of Transfer ***\n" >>
+ sClose s'
+ in
+ read_all
+ in
+ loop
+
diff --git a/testsuite/tests/lib/socket/socket003.stdout b/testsuite/tests/lib/socket/socket003.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket003.stdout
diff --git a/testsuite/tests/lib/socket/socket004.hs b/testsuite/tests/lib/socket/socket004.hs
new file mode 100644
index 0000000000..d7fbdc91bc
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket004.hs
@@ -0,0 +1,38 @@
+{- client
+
+As for net002 but reads port number and message as arguments.
+It also prints out the IP number of the peer machine.
+
+
+
+TESTS:
+ getPeerName
+-}
+
+
+module Main(main) where
+
+import SocketPrim
+import System
+
+
+starbuck = "130.209.240.81"
+marcus = "130.209.247.2"
+
+nauru = "130.209.247.5" -- Linux 2.0.30 (RH-4.2) x86
+easter = "130.209.247.6" -- Linux 2.0.30 (RH-4.2) x86
+
+
+main =
+ getArgs >>= \ [port, message] ->
+ socket AF_INET Stream 6 >>= \ s ->
+ inet_addr easter >>= \ i_addr ->
+ connect s (SockAddrInet (mkPortNumber (read port)) i_addr) >>
+
+ getPeerName s >>= \ (SockAddrInet p haddr) ->
+ inet_ntoa haddr >>= \ a ->
+ putStr ("Connected to : " ++ a ++ "\n") >>
+ writeSocket s message >>
+ shutdown s ShutdownBoth >>
+ sClose s
+
diff --git a/testsuite/tests/lib/socket/socket004.stdout b/testsuite/tests/lib/socket/socket004.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket004.stdout
diff --git a/testsuite/tests/lib/socket/socket005.hs b/testsuite/tests/lib/socket/socket005.hs
new file mode 100644
index 0000000000..ec504aa480
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket005.hs
@@ -0,0 +1,37 @@
+{- server
+
+Server as net001 but for Unix Domain Datagram sockets.
+
+TESTS:
+ socket
+ bindSocket
+ readSocket
+
+-}
+
+
+module Main where
+
+import SocketPrim
+
+
+main =
+ socket AF_UNIX Datagram 0 >>= \ s ->
+ bindSocket s (SockAddrUnix "sock") >>
+
+ let
+ loop =
+ putStr "*** Start of Transfer ***\n" >>
+ let
+ read_all =
+ readSocket s 1024 >>= \ (str, nbytes) ->
+ if nbytes /= 0 then
+ putStr str >>
+ read_all
+ else
+ putStr "\n*** End of Transfer ***\n"
+ in
+ read_all
+ in
+ loop
+
diff --git a/testsuite/tests/lib/socket/socket005.stdout b/testsuite/tests/lib/socket/socket005.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket005.stdout
diff --git a/testsuite/tests/lib/socket/socket006.hs b/testsuite/tests/lib/socket/socket006.hs
new file mode 100644
index 0000000000..e2ad13ae49
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket006.hs
@@ -0,0 +1,27 @@
+{- client
+
+Client side of net005
+
+TESTS:
+ socket
+ connect
+ writeSocket
+ shutdown
+ sClose
+-}
+
+
+module Main where
+
+import SocketPrim
+
+message = "Hello World"
+
+
+main =
+ socket AF_UNIX Datagram 0 >>= \ s ->
+ connect s (SockAddrUnix "sock") >>
+
+ writeSocket s message >>
+ shutdown s ShutdownBoth >>
+ sClose s
diff --git a/testsuite/tests/lib/socket/socket006.stdout b/testsuite/tests/lib/socket/socket006.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket006.stdout
diff --git a/testsuite/tests/lib/socket/socket007.hs b/testsuite/tests/lib/socket/socket007.hs
new file mode 100644
index 0000000000..fbc9ff04e0
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket007.hs
@@ -0,0 +1,44 @@
+{- server
+
+As net003 but uses the BSD module for portability. Also prints the
+common name of the host rather than its IP number.
+
+TESTS:
+ getProtocolNumber
+ getSocketName
+ getHostByAddr
+
+-}
+
+module Main where
+
+import BSD
+import SocketPrim
+
+main =
+ getProtocolNumber "tcp" >>= \ proto ->
+ socket AF_INET Stream proto >>= \ s ->
+ bindSocket s (SockAddrInet aNY_PORT iNADDR_ANY) >>
+ getSocketName s >>= \ (SockAddrInet port _) ->
+ putStr ("Allocated Port Number: " ++ show port ++ "\n") >>
+ listen s 5 >>
+
+
+ let
+ loop =
+ accept s >>= \ (s',(SockAddrInet _ haddr)) ->
+ getHostByAddr AF_INET haddr >>= \ (HostEntry hname _ _ _) ->
+ putStr ("*** Start of Transfer from: " ++ hname ++ "***\n") >>
+ let
+ read_all =
+ readSocket s' 4 >>= \ (str, nbytes) ->
+ if nbytes /= 0 then
+ putStr str >>
+ read_all
+ else
+ putStr "\n*** End of Transfer ***\n" >>
+ sClose s'
+ in
+ read_all
+ in
+ loop
diff --git a/testsuite/tests/lib/socket/socket007.stdout b/testsuite/tests/lib/socket/socket007.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket007.stdout
diff --git a/testsuite/tests/lib/socket/socket008.hs b/testsuite/tests/lib/socket/socket008.hs
new file mode 100644
index 0000000000..896763409e
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket008.hs
@@ -0,0 +1,21 @@
+module Main where
+
+import SocketPrim
+import BSD
+import System
+
+main =
+ getArgs >>= \ [host, port, message] ->
+ getProtocolNumber "tcp" >>= \ proto ->
+ socket AF_INET Stream proto >>= \ s ->
+ getHostByName host >>= \ (HostEntry _ _ _ haddrs) ->
+ connect s (SockAddrInet (mkPortNumber (read port))
+ (head haddrs)) >>
+
+ getPeerName s >>= \ (SockAddrInet _ haddr) ->
+ getHostByAddr AF_INET haddr >>= \ (HostEntry hname _ _ _) ->
+ putStr ("Connected to : " ++ hname ++ "\n") >>
+ writeSocket s message >>
+ shutdown s ShutdownBoth >>
+ sClose s
+
diff --git a/testsuite/tests/lib/socket/socket008.stdout b/testsuite/tests/lib/socket/socket008.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket008.stdout
diff --git a/testsuite/tests/lib/socket/socket009.hs b/testsuite/tests/lib/socket/socket009.hs
new file mode 100644
index 0000000000..c34334e691
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket009.hs
@@ -0,0 +1,28 @@
+-- Sigbjorn and I don't understand what this test is meant to do
+-- It simply hangs on stdin!
+
+import IO -- 1.3
+
+import System(getArgs)
+
+main = getArgs >>= \ [user,host] ->
+ let username = (user ++ "@" ++ host) in
+ openFile username ReadWriteMode >>= \ cd ->
+ hSetBuffering stdin NoBuffering >>
+ hSetBuffering stdout NoBuffering >>
+ hSetBuffering cd NoBuffering >>
+ hPutStr cd speakString >>
+ speak cd
+
+speakString = "Someone wants to speak with you\n"
+
+speak cd =
+ (hReady cd >>= \ ready ->
+ if ready then (hGetChar cd >>= putChar)
+ else return () >>
+
+ hReady stdin >>= \ ready ->
+ if ready then (getChar >>= hPutChar cd)
+ else return ()) >>
+
+ speak cd
diff --git a/testsuite/tests/lib/socket/socket009.stdout b/testsuite/tests/lib/socket/socket009.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/socket/socket009.stdout
diff --git a/testsuite/tests/lib/win32/Makefile b/testsuite/tests/lib/win32/Makefile
new file mode 100644
index 0000000000..66afc12be9
--- /dev/null
+++ b/testsuite/tests/lib/win32/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/win32/all.T b/testsuite/tests/lib/win32/all.T
new file mode 100644
index 0000000000..1e9378a5e6
--- /dev/null
+++ b/testsuite/tests/lib/win32/all.T
@@ -0,0 +1,10 @@
+def win_only(opts):
+ if config.platform != "i386-unknown-mingw32" and \
+ config.platform != "i386-unknown-cygwin32":
+ opts.skip = 1
+
+# This isn't a very good test to run automatically at the moment, since
+# it doesn't terminate
+test('win32001', skip, compile_and_run, ['-package lang -package win32'])
+
+test('win32002', win_only, compile_and_run, ['-package Win32'])
diff --git a/testsuite/tests/lib/win32/win32001.hs b/testsuite/tests/lib/win32/win32001.hs
new file mode 100644
index 0000000000..8765dcb0fd
--- /dev/null
+++ b/testsuite/tests/lib/win32/win32001.hs
@@ -0,0 +1,104 @@
+-- Haskell version of "Hello, World" using the Win32 library.
+-- Demonstrates how the Win32 library can be put to use.
+-- (c) sof 1999
+
+
+module Main(main) where
+
+import qualified Win32
+import Addr
+
+-- Toplevel main just creates a window and pumps messages.
+-- The window procedure (wndProc) we pass in is partially
+-- applied with the user action that takes care of responding
+-- to repaint messages (WM_PAINT).
+
+main :: IO ()
+main = do
+ lpps <- Win32.malloc Win32.sizeofPAINTSTRUCT
+ hwnd <- createWindow 200 200 (wndProc lpps onPaint)
+ messagePump hwnd
+
+-- OnPaint handler for a window - draw a string centred
+-- inside it.
+onPaint :: Win32.RECT -> Win32.HDC -> IO ()
+onPaint (_,_,w,h) hdc = do
+ Win32.setBkMode hdc Win32.tRANSPARENT
+ Win32.setTextColor hdc (Win32.rgb 255 255 0)
+ let y | h==10 = 0
+ | otherwise = ((h-10) `div` 2)
+ x | w==50 = 0
+ | otherwise = (w-50) `div` 2
+ Win32.textOut hdc x y "Hello, world"
+ return ()
+
+-- Simple window procedure - one way to improve and generalise
+-- it would be to pass it a message map (represented as a
+-- finite map from WindowMessages to actions, perhaps).
+
+wndProc :: Win32.LPPAINTSTRUCT
+ -> (Win32.RECT -> Win32.HDC -> IO ()) -- on paint action
+ -> Win32.HWND
+ -> Win32.WindowMessage
+ -> Win32.WPARAM
+ -> Win32.LPARAM
+ -> IO Win32.LRESULT
+wndProc lpps onPaint hwnd wmsg wParam lParam
+ | wmsg == Win32.wM_DESTROY = do
+ Win32.sendMessage hwnd Win32.wM_QUIT 1 0
+ return 0
+ | wmsg == Win32.wM_PAINT && hwnd /= nullAddr = do
+ r <- Win32.getClientRect hwnd
+ paintWith lpps hwnd (onPaint r)
+ return 0
+ | otherwise =
+ Win32.defWindowProc (Just hwnd) wmsg wParam lParam
+
+createWindow :: Int -> Int -> Win32.WindowClosure -> IO Win32.HWND
+createWindow width height wndProc = do
+ let winClass = Win32.mkClassName "Hello"
+ icon <- Win32.loadIcon Nothing Win32.iDI_APPLICATION
+ cursor <- Win32.loadCursor Nothing Win32.iDC_ARROW
+ bgBrush <- Win32.createSolidBrush (Win32.rgb 0 0 255)
+ mainInstance <- Win32.getModuleHandle Nothing
+ Win32.registerClass
+ ( Win32.cS_VREDRAW + Win32.cS_HREDRAW
+ , mainInstance
+ , Just icon
+ , Just cursor
+ , Just bgBrush
+ , Nothing
+ , winClass
+ )
+ w <- Win32.createWindow
+ winClass
+ "Hello, World example"
+ Win32.wS_OVERLAPPEDWINDOW
+ Nothing Nothing -- leave it to the shell to decide the position
+ -- at where to put the window initially
+ (Just width)
+ (Just height)
+ Nothing -- no parent, i.e, root window is the parent.
+ Nothing -- no menu handle
+ mainInstance
+ wndProc
+ Win32.showWindow w Win32.sW_SHOWNORMAL
+ Win32.updateWindow w
+ return w
+
+messagePump :: Win32.HWND -> IO ()
+messagePump hwnd = do
+ msg <- Win32.getMessage (Just hwnd) `catch` \ _ -> return nullAddr
+ if msg == nullAddr then
+ return ()
+ else do
+ Win32.translateMessage msg
+ Win32.dispatchMessage msg
+ messagePump hwnd
+
+paintWith :: Win32.LPPAINTSTRUCT -> Win32.HWND -> (Win32.HDC -> IO a) -> IO a
+paintWith lpps hwnd p = do
+ hdc <- Win32.beginPaint hwnd lpps
+ a <- p hdc
+ Win32.endPaint hwnd lpps
+ return a
diff --git a/testsuite/tests/lib/win32/win32002.hs b/testsuite/tests/lib/win32/win32002.hs
new file mode 100644
index 0000000000..0b57985333
--- /dev/null
+++ b/testsuite/tests/lib/win32/win32002.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+-- Test that the Win32 error code from getLastError is thread-local.
+
+import System.Win32
+import Control.Monad
+import Control.Concurrent
+
+main = do
+ setLastError 42
+ r <- getLastError
+ when (r /= 42) $ fail ("wrong: " ++ show r)
+ m <- newEmptyMVar
+ forkIO $ do setLastError 43; putMVar m ()
+ takeMVar m
+ r <- getLastError
+ when (r /= 42) $ fail ("wrong: " ++ show r)
+
+foreign import stdcall unsafe "windows.h SetLastError"
+ setLastError :: ErrCode -> IO ()