Skip to content

Commit 87da76f

Browse files
committed
fix
1 parent b0872ef commit 87da76f

2 files changed

Lines changed: 36 additions & 23 deletions

File tree

tests/data/TestContest1/source/user1/helloworld.cpp

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,34 @@
22

33
using namespace std;
44

5-
int f(int n){vector<int> a(1);
6-
for(int i=0;i<n;i++)
7-
{
8-
a[i]=100;
9-
}}
10-
int main()
11-
{
5+
int f(int n) {
6+
vector<int> a(1);
7+
for (int i = 0; i < n; i++) {
8+
a[i] = 100;
9+
}
10+
}
11+
int *p;
12+
int main() {
1213
int s;
1314
cin >> s;
14-
switch (s)
15-
{
16-
case 1: cout << "AC" << endl; break;
17-
case 2: cout << "WA" << endl; break;
18-
case 3: while(1)new int[1<<24];
19-
case 4: while(1); break;
20-
case 5: f(100); break;
21-
default : break;
15+
switch (s) {
16+
case 1:
17+
cout << "AC" << endl;
18+
break;
19+
case 2:
20+
cout << "WA" << endl;
21+
break;
22+
case 3:
23+
while (1)
24+
p = new int[1 << 24], p[1 << 20] = 1;
25+
case 4:
26+
while (1)
27+
;
28+
break;
29+
case 5:
30+
f(100);
31+
break;
32+
default:
33+
break;
2234
}
2335
}

tests/test1/main.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static Settings *createSettings(QObject *parent = nullptr) {
3434
s->setDefaultFullScore(100);
3535
s->setDefaultTimeLimit(1000);
3636
s->setDefaultMemoryLimit(512);
37+
s->setDefaultExtraTimeRatio(0.1);
3738
s->setCompileTimeLimit(10000);
3839
s->setSpecialJudgeTimeLimit(10000);
3940
s->setFileSizeLimit(50);
@@ -58,7 +59,7 @@ static Settings *createSettings(QObject *parent = nullptr) {
5859
gpp->setCompilerLocation(gppPath);
5960
gpp->setTimeLimitRatio(1.0);
6061
gpp->setMemoryLimitRatio(1.0);
61-
gpp->setDisableMemoryLimitCheck(true); // memory check needs watcher on Unix
62+
gpp->setDisableMemoryLimitCheck(false); // memory check needs watcher on Unix
6263
gpp->setInterpreterAsWatcher(false);
6364
gpp->addConfiguration("default", "%s.* -o %s -O2 -lm", "");
6465
s->addCompiler(gpp);
@@ -76,9 +77,9 @@ static Settings *createSettings(QObject *parent = nullptr) {
7677
py->setCompilerName("python");
7778
py->setSourceExtensions("py");
7879
py->setInterpreterLocation(pythonPath);
79-
py->setTimeLimitRatio(5.0); // give python more time
80+
py->setTimeLimitRatio(2.0); // give python more time
8081
py->setMemoryLimitRatio(1.0);
81-
py->setDisableMemoryLimitCheck(true);
82+
py->setDisableMemoryLimitCheck(false);
8283
py->setInterpreterAsWatcher(false);
8384
py->addConfiguration("default", "", "%s.py");
8485
s->addCompiler(py);
@@ -132,7 +133,7 @@ class TestContest : public QObject {
132133
// Without this, the inline shared_ptr `Lemon::base::logger` is null
133134
// and any Settings setter that calls DEBUG() will crash.
134135
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
135-
console_sink->set_level(spdlog::level::warn);
136+
console_sink->set_level(spdlog::level::info);
136137
Lemon::base::logger = std::make_shared<spdlog::logger>(spdlog::logger("test", {console_sink}));
137138

138139
m_contestDir = QString(TEST_DATA_DIR) + "/TestContest1";
@@ -288,10 +289,10 @@ class TestContest : public QObject {
288289
const auto &res = user2->getResult(helloworldIdx);
289290
QCOMPARE(res.size(), 6);
290291
for (int tc = 0; tc < 6; tc++) {
291-
QVERIFY2(res[tc][0] == CorrectAnswer,
292-
qPrintable(QString("user2 helloworld case %1: expected AC, got %2")
293-
.arg(tc)
294-
.arg(res[tc][0])));
292+
QVERIFY2(
293+
res[tc][0] == CorrectAnswer,
294+
qPrintable(
295+
QString("user2 helloworld case %1: expected AC, got %2").arg(tc).arg(res[tc][0])));
295296
}
296297
}
297298

0 commit comments

Comments
 (0)