from iodev import * print "testing generic IODevice" def testseek(typ,pos): typename=typ.str val=typ.seek(pos) if val!=None: print " %s seek(%8d)=%10.6f" % (typename,pos,val) else: print " Bad seek" g = IODevice(1000000) testseek(g, 0) # should be fast testseek(g, 1000) # should also be fast testseek(g, 1001) # should also be fast testseek(g, 1000) # should also be fast testseek(g, 999999) # should be fast testseek(g, 1000000) # should fail print "testing Tape device" t = Tape() # use default size testseek(t, 0) # should be fast testseek(t, 100) # perhaps not quite as fast testseek(t, 1000) # slower still testseek(t, 1001) # fast! testseek(t, 1000) # fast or slow? # dare you try testseek(t, 10000) ? print "testing Disk device" d = Disk() testseek(d, 0) testseek(d, 100) testseek(d, 1000) testseek(d, 1001) testseek(d, 1000)