def doExp(): abc_lim = 32 arc_lim = 47 if not os.path.exists("./abc"): os.mkdir("./abc") if not os.path.exists("./arc"): os.mkdir("./arc") """ abcは19以前はは数字、20以降はアルファベット """ os.chdir("./abc") for i in range(1, abc_lim + 1): num = "0" if i < 10: num += "0" num += str(i) print("abc" + num) url = "http://abc" + num + ".contest.atcoder.jp/tasks/abc" + num + "_" if i <= 19: problem_list = ["1", "2", "3", "4"] else: problem_list = ["a", "b", "c", "d"] for pr in problem_list: url_in = url + pr ret = parser2.parse(url_in) f = open("abc" + num + pr, "w") for row in ret: f.write(row + "\n") f.close() # 作業ディレクトリに戻る os.chdir("..") """ arcは34以前はは数字、35以降はアルファベット """ os.chdir("./arc") for i in range(1, arc_lim + 1): num = "0" if i < 10: num += "0" num += str(i) print("arc" + num) url = "http://arc" + num + ".contest.atcoder.jp/tasks/arc" + num + "_" if i <= 34: problem_list = ["1", "2", "3", "4"] else: problem_list = ["a", "b", "c", "d"] for pr in problem_list: url_in = url + pr ret = parser2.parse(url_in) f = open("arc" + num + pr, "w") for row in ret: f.write(row + "\n") f.close() # 作業ディレクトリに戻る os.chdir("..")
import sys import parser2 import interp2 data = open('D:/laba2/robot').read() prog = parser2.parse(data) if not prog: raise SystemExit b = interp2.Interp(prog) try: b.run() raise SystemExit except RuntimeError: pass
def test_negative_float(): for i in range(0, 1000): f = -1 * (i / 100.0) assert f - 0.0000001 <= parse(str(f)) <= f + 0.0000001
def test_float(): for i in range(0, 1000): f = i / 100.0 assert f - 0.0000001 <= parse(str(f)) <= f + 0.0000001
def test_negative_integer(): for i in range(0, 1000): assert parse("-" + str(i)) == -i
def test_integer(): print("test_integer") for i in range(0, 1000): assert parse(str(i)) == i
def test_digit(): print("test_digit") for i in range(0, 10): assert parse(str(i)) == i