-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAuto_test_compare.cpp
More file actions
42 lines (37 loc) · 1.02 KB
/
Auto_test_compare.cpp
File metadata and controls
42 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <bits/stdc++.h>
#define FOR(i, l, r) for (int i = l; i <= r; i++)
using namespace std;
typedef long long ll;
bool diff(string file1, string file2) {
ll ans1, ans2;
ifstream out(file1.c_str());
out >> ans1;
ifstream ans(file2.c_str());
ans >> ans2;
cout << ans1 << " " << ans2 << '\n';
return (ans1 == ans2);
}
int main() {
long sign[] = {-1, 1};
FOR(current_test, 1, 100) {
// use rng instead of rand().
// for exp: generate an long n randomly: long n = rng();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ofstream inp("input.txt");
// input making goes here.
inp.close();
system("g++ -o run test2.cpp");
system("./run");
// system("g++ -o run test.cpp");
// system("./run");
system("javac test.java");
system("java test");
if (diff("ans.txt", "output.txt") == 0) {
cout << "Test #" << current_test << ": WRONG!";
break;
}
else cout << "Test #" << current_test << ": CORRECT";
cout << '\n';
}
return 0;
}