feat: test cases
This commit is contained in:
parent
11a33358f6
commit
4f2c57a0ee
10
a.cc
10
a.cc
|
@ -1,6 +1,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
int main() {
|
|
||||||
int a, b;
|
int main(int argc, char *argv[]) {
|
||||||
std::cin >> a >> b;
|
std::string str;
|
||||||
std::cout << a + b << '\n';
|
std::cin >> str;
|
||||||
|
std::cout << str;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
1 1
|
|
|
@ -1 +0,0 @@
|
||||||
2
|
|
|
@ -1,7 +0,0 @@
|
||||||
3072
|
|
||||||
234890234
|
|
||||||
342342
|
|
||||||
1234234
|
|
||||||
300072
|
|
||||||
43234
|
|
||||||
1243
|
|
|
@ -1 +0,0 @@
|
||||||
3072
|
|
|
@ -1 +0,0 @@
|
||||||
1024 2048
|
|
|
@ -1 +0,0 @@
|
||||||
3072
|
|
|
@ -1 +0,0 @@
|
||||||
1024 2048
|
|
|
@ -1 +0,0 @@
|
||||||
37200
|
|
1
cases/empty.in
Normal file
1
cases/empty.in
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
cases/empty.out
Normal file
1
cases/empty.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
5
cases/multi-line-correct.out
Normal file
5
cases/multi-line-correct.out
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
jklasdfklasdfjklf asdfhklasdfjl cvsdlfkdjsfklv
|
||||||
|
1024 2048
|
||||||
|
asdfjkl asdfkljdaslasdfjkl asdfjkl
|
||||||
|
1024 2048
|
||||||
|
psdfklj
|
3
cases/multi-line-err1.out
Normal file
3
cases/multi-line-err1.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
asdfljsdfklasdfjklasdfjjkl
|
||||||
|
1024 2048
|
||||||
|
asdfjksdfjkl
|
3
cases/multi-line-err2.out
Normal file
3
cases/multi-line-err2.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
1024 2048
|
||||||
|
asdfjksdfjkl
|
||||||
|
asdfljsdfklasdfjklasdfjjkl
|
3
cases/multi-line-err3.out
Normal file
3
cases/multi-line-err3.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
1024 2048
|
||||||
|
asdfjksdfjkl
|
||||||
|
asdfljsdfklasdfjklasdfjjkl
|
5
cases/multi-line.in
Normal file
5
cases/multi-line.in
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
jklasdfklasdfjklf asdfhklasdfjl cvsdlfkdjsfklv
|
||||||
|
1024 2048
|
||||||
|
asdfjkl asdfkljdaslasdfjkl asdfjkl
|
||||||
|
1024 2048
|
||||||
|
psdfklj
|
1
cases/one-line-whitespace.out
Normal file
1
cases/one-line-whitespace.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1024 2048
|
95
conf.toml
95
conf.toml
|
@ -44,38 +44,107 @@ name = "stderr"
|
||||||
max = 4_096
|
max = 4_096
|
||||||
[stages.executor.with.default.copyInCached]
|
[stages.executor.with.default.copyInCached]
|
||||||
a = "a"
|
a = "a"
|
||||||
|
|
||||||
|
|
||||||
|
# empty
|
||||||
[[stages.executor.with.cases]]
|
[[stages.executor.with.cases]]
|
||||||
[stages.executor.with.cases.stdin]
|
[stages.executor.with.cases.stdin]
|
||||||
src = "./cases/1.in"
|
src = "./cases/empty.in"
|
||||||
[[stages.executor.with.cases]]
|
[[stages.executor.with.cases]]
|
||||||
[stages.executor.with.cases.stdin]
|
[stages.executor.with.cases.stdin]
|
||||||
src = "./cases/2.in"
|
src = "./cases/empty.in"
|
||||||
[[stages.executor.with.cases]]
|
[[stages.executor.with.cases]]
|
||||||
[stages.executor.with.cases.stdin]
|
[stages.executor.with.cases.stdin]
|
||||||
src = "./cases/3.in"
|
src = "./cases/empty.in"
|
||||||
|
|
||||||
|
|
||||||
|
# one-line
|
||||||
[[stages.executor.with.cases]]
|
[[stages.executor.with.cases]]
|
||||||
[stages.executor.with.cases.stdin]
|
[stages.executor.with.cases.stdin]
|
||||||
src = "./cases/4.in"
|
src = "./cases/one-line.in"
|
||||||
[[stages.executor.with.cases]]
|
[[stages.executor.with.cases]]
|
||||||
[stages.executor.with.cases.stdin]
|
[stages.executor.with.cases.stdin]
|
||||||
src = "./cases/5.in"
|
src = "./cases/one-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/one-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/one-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/one-line.in"
|
||||||
|
|
||||||
|
|
||||||
|
# one-line
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/multi-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/multi-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/multi-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/multi-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/multi-line.in"
|
||||||
|
[[stages.executor.with.cases]]
|
||||||
|
[stages.executor.with.cases.stdin]
|
||||||
|
src = "./cases/multi-line.in"
|
||||||
[stages.parser]
|
[stages.parser]
|
||||||
name = "diff"
|
name = "diff"
|
||||||
|
|
||||||
|
|
||||||
|
# empty
|
||||||
[[stages.parser.with.cases]]
|
[[stages.parser.with.cases]]
|
||||||
score = 100
|
score = 100
|
||||||
stdoutPath = "./cases/1.out"
|
stdoutPath = "./cases/empty.out"
|
||||||
[[stages.parser.with.cases]]
|
[[stages.parser.with.cases]]
|
||||||
score = 100
|
score = 100
|
||||||
stdoutPath = "./cases/2.out"
|
stdoutPath = "./cases/one-line.out"
|
||||||
[[stages.parser.with.cases]]
|
[[stages.parser.with.cases]]
|
||||||
score = 100
|
score = 100
|
||||||
stdoutPath = "./cases/3.out"
|
stdoutPath = "./cases/multi-line-err1.out"
|
||||||
ignoreWhitespace=true
|
|
||||||
|
|
||||||
|
# one-line
|
||||||
[[stages.parser.with.cases]]
|
[[stages.parser.with.cases]]
|
||||||
score = 100
|
score = 100
|
||||||
stdoutPath = "./cases/4.out"
|
stdoutPath = "./cases/empty.out"
|
||||||
ignoreWhitespace=true
|
|
||||||
[[stages.parser.with.cases]]
|
[[stages.parser.with.cases]]
|
||||||
score = 100
|
score = 100
|
||||||
stdoutPath = "./cases/5.out"
|
stdoutPath = "./cases/one-line.out"
|
||||||
ignoreWhitespace=false
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/multi-line-err1.out"
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/multi-line-err2.out"
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/multi-line-err3.out"
|
||||||
|
|
||||||
|
|
||||||
|
# multi-line
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/empty.out"
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/one-line.out"
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/multi-line-correct.out"
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/multi-line-err1.out"
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/multi-line-err2.out"
|
||||||
|
[[stages.parser.with.cases]]
|
||||||
|
score = 100
|
||||||
|
stdoutPath = "./cases/multi-line-err3.out"
|
||||||
|
|
28
convert.py
Normal file
28
convert.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
# 读取 JSON 文件内容
|
||||||
|
with open("joj3_result.json", "r", encoding="utf-8") as file:
|
||||||
|
json_data = file.read()
|
||||||
|
|
||||||
|
# 解析 JSON 数据
|
||||||
|
data = json.loads(json_data)
|
||||||
|
|
||||||
|
# 定义正则表达式以提取 diff 代码块
|
||||||
|
diff_pattern = re.compile(r"```diff\n(.*?)\n```", re.DOTALL)
|
||||||
|
|
||||||
|
# 提取所有 diff 代码块
|
||||||
|
diff_blocks = []
|
||||||
|
|
||||||
|
for item in data:
|
||||||
|
if "results" in item:
|
||||||
|
for result in item["results"]:
|
||||||
|
comment = result.get("comment", "")
|
||||||
|
matches = diff_pattern.findall(comment)
|
||||||
|
diff_blocks.extend(matches)
|
||||||
|
|
||||||
|
# 处理 \n 符号并打印 diff 代码块
|
||||||
|
for i, diff in enumerate(diff_blocks):
|
||||||
|
# 将 \n 替换为实际换行符
|
||||||
|
formatted_diff = diff.replace("\\n", "\n")
|
||||||
|
print(f"Diff block {i+1}:\n{formatted_diff}\n")
|
Loading…
Reference in New Issue
Block a user