'test xrange with corner cases'

def test_xrange(self):

    import sys
    import os
    if (os.name == 'posix'):
        print 'Skipping    the    xrange    test    on    posix    https://github.com/IronLanguages/main/issues/1607'
        return
    maxint = sys.maxint
    numbers = [1, 2, (maxint / 2), (maxint - 1), maxint, (maxint + 1), (maxint + 2)]
    choices = [0]
    choices.extend(numbers)
    choices.extend([((-1) * x) for x in numbers])
    for x in choices:
        for y in choices:
            for z in choices:
                line = ('xrange(%s,    %s,    %s)' % (str(x), str(y), str(z)))
                printwith('case', line)
                try:
                    xr = eval(line)
                    xl = len(xr)
                    cnt = 0
                    first = last = first2 = last2 = 'n/a'
                    if (xl < 10):
                        for x in xr:
                            if (cnt == 0):
                                first = x
                            if (cnt == (xl - 1)):
                                last = x
                            cnt += 1
                    if (xl == 0):
                        first2 = xr[0]
                    if (xl > 1):
                        (first2, last2) = (xr[0], xr[(xl - 1)])
                    printwith('same', xr, xl, first, last, first2, last2)
                except:
                    printwith('same', sys.exc_type)
