diff --git a/example/main.py b/example/main.py index a528218..5593ecd 100644 --- a/example/main.py +++ b/example/main.py @@ -19,6 +19,8 @@ def judge(path, language): filename = "main.rs" elif language == river_pb2.Go: filename = "main.go" + elif language == river_pb2.Node: + filename = "main.js" with open(path.joinpath(filename), "rb") as fr: code = fr.read() with open(path.joinpath("in.txt"), "rb") as fr: @@ -44,34 +46,39 @@ def judge(path, language): def run(): with grpc.insecure_channel("localhost:4003") as channel: stub = river_pb2_grpc.RiverStub(channel) - for path in Path("java").iterdir(): + # for path in Path("java").iterdir(): + # print(f"开始评测 {path}") + # for item in stub.Judge(judge(path, river_pb2.Java)): + # print(item) + # print(f"{path} 评测完成") + # for path in Path("c").iterdir(): + # print(f"开始评测 {path}") + # for item in stub.Judge(judge(path, river_pb2.C)): + # print(item) + # print(f"{path} 评测完成") + # for path in Path("cpp").iterdir(): + # print(f"开始评测 {path}") + # for item in stub.Judge(judge(path, river_pb2.Cpp)): + # print(item) + # print(f"{path} 评测完成") + # for path in Path("py").iterdir(): + # print(f"开始评测 {path}") + # for item in stub.Judge(judge(path, river_pb2.Python)): + # print(item) + # print(f"{path} 评测完成") + # for path in Path("rust").iterdir(): + # print(f"开始评测 {path}") + # for item in stub.Judge(judge(path, river_pb2.Rust)): + # print(item) + # print(f"{path} 评测完成") + # for path in Path("go").iterdir(): + # print(f"开始评测 {path}") + # for item in stub.Judge(judge(path, river_pb2.Go)): + # print(item) + # print(f"{path} 评测完成") + for path in Path("node").iterdir(): print(f"开始评测 {path}") - for item in stub.Judge(judge(path, river_pb2.Java)): - print(item) - print(f"{path} 评测完成") - for path in Path("c").iterdir(): - print(f"开始评测 {path}") - for item in stub.Judge(judge(path, river_pb2.C)): - print(item) - print(f"{path} 评测完成") - for path in Path("cpp").iterdir(): - print(f"开始评测 {path}") - for item in stub.Judge(judge(path, river_pb2.Cpp)): - print(item) - print(f"{path} 评测完成") - for path in Path("py").iterdir(): - print(f"开始评测 {path}") - for item in stub.Judge(judge(path, river_pb2.Python)): - print(item) - print(f"{path} 评测完成") - for path in Path("rust").iterdir(): - print(f"开始评测 {path}") - for item in stub.Judge(judge(path, river_pb2.Rust)): - print(item) - print(f"{path} 评测完成") - for path in Path("go").iterdir(): - print(f"开始评测 {path}") - for item in stub.Judge(judge(path, river_pb2.Go)): + for item in stub.Judge(judge(path, river_pb2.Node)): print(item) print(f"{path} 评测完成") diff --git a/example/node/1000/in.txt b/example/node/1000/in.txt new file mode 100644 index 0000000..e69de29 diff --git a/example/node/1000/main.js b/example/node/1000/main.js new file mode 100644 index 0000000..019c0f4 --- /dev/null +++ b/example/node/1000/main.js @@ -0,0 +1 @@ +console.log("Hello World!"); diff --git a/example/node/1000/out.txt b/example/node/1000/out.txt new file mode 100644 index 0000000..c57eff5 --- /dev/null +++ b/example/node/1000/out.txt @@ -0,0 +1 @@ +Hello World! \ No newline at end of file diff --git a/example/node/1001/in.txt b/example/node/1001/in.txt new file mode 100644 index 0000000..1ed0fb7 --- /dev/null +++ b/example/node/1001/in.txt @@ -0,0 +1 @@ +2 3 \ No newline at end of file diff --git a/example/node/1001/main.js b/example/node/1001/main.js new file mode 100644 index 0000000..dd21090 --- /dev/null +++ b/example/node/1001/main.js @@ -0,0 +1,15 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +rl.on('line', (line) => { + var nums = line.split(' '); + var a = parseInt(nums[0]); + var b = parseInt(nums[1]); + var res = a + b; + console.log(res); + process.exit(0); +}); diff --git a/example/node/1001/out.txt b/example/node/1001/out.txt new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/example/node/1001/out.txt @@ -0,0 +1 @@ +5 \ No newline at end of file