Commits

Anonymous committed 60a4cfd

Adding code for 2374427

Comments (0)

Files changed (2)

2374427/gen_bytes.py

+import sys
+
+if sys.platform == "win32":
+    import os, msvcrt
+    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
+for char in range(256):
+    sys.stdout.write(chr(char))

2374427/read_bytes.py

+import subprocess
+import sys
+
+proc = subprocess.Popen([sys.executable, 'gen_bytes.py'], stdout=subprocess.PIPE)
+res = proc.wait()
+bytes = proc.stdout.read()
+if not len(bytes) == 256:
+	print 'Received incorrect number of bytes: {0}'.format(len(bytes))
+	raise SystemExit(1)
+if not map(ord, bytes) == range(256):
+	print 'Received incorrect bytes: {0}'.format(map(ord, bytes))
+	raise SystemExit(2)
+print "Everything checks out"