Lichen

tests/numbers.py

343:e0879c83a439
2016-12-07 Paul Boddie Added support for reading to the end of a stream's input, fixing EOFError raising in fread by returning shorter amounts of data when EOF occurs, only raising an exception if no data was read before EOF occurred. Made the test input longer to exercise tests of reading remaining data.
     1 import sys     2      3 print sys.maxint     4 print sys.minint     5      6 print sys.maxint + sys.minint     7      8 i = 2 ** 30     9 print i                                 # 1073741824    10     11 j = -2 ** 30    12 print j                                 # -1073741824    13     14 print i + j                             # 0    15     16 try:    17     print i - j    18 except OverflowError:    19     print "i - j: overflow occurred"    20     21 print i / i                             # 1    22 print i / j                             # -1    23 print j / j                             # 1    24 print j / i                             # -1    25     26 try:    27     print i * j    28 except OverflowError:    29     print "i * j: overflow occurred"    30     31 print i - i                             # 0    32 print j - j                             # 0    33 print ~j                                # 1073741823    34 print i & ~j                            # 0    35 print i - 1 & ~j                        # 1073741823