# ------------------------------ # projects/collatz/RunCollatz.py # Copyright (C) 2013 # Glenn P. Downing # ------------------------------- """ To run the program % python RunCollatz.py < RunCollatz.in > RunCollatz.out % chmod ugo+x RunCollatz.py % RunCollatz.py < RunCollatz.in > RunCollatz.out To document the program % pydoc -w Collatz """ # ------- # imports # ------- import sys from Collatz2 import collatz_solve # ---- # main # ---- collatz_solve(sys.stdin, sys.stdout)
def test_solve (self) : r = StringIO.StringIO("1 10\n100 200\n201 210\n900 1000\n") w = StringIO.StringIO() collatz_solve(r, w) self.assert_(w.getvalue() == "1 10 20\n100 200 125\n201 210 89\n900 1000 174\n")
def test (self) : r = StringIO("1 10\n100 200\n201 210\n900 1000\n") w = StringIO() collatz_solve(r, w) self.assertEqual(w.getvalue(), "1 10 1\n100 200 1\n201 210 1\n900 1000 1\n")
#!/usr/bin/env python # ------------------------------ # projects/collatz/RunCollatz.py # Copyright (C) 2013 # Glenn P. Downing # ------------------------------- """ To run the program % python RunCollatz.py < RunCollatz.in > RunCollatz.out % chmod ugo+x RunCollatz.py % RunCollatz.py < RunCollatz.in > RunCollatz.out To document the program % pydoc -w Collatz """ # ------- # imports # ------- import sys from Collatz2 import collatz_solve # ---- # main # ---- collatz_solve(sys.stdin, sys.stdout)