88 *
99 */
1010
11- #include " testlib.h"
12-
13- #include < iostream>
14- #include < sstream>
15- #include < fstream>
16- #include < iomanip>
17- #include < string>
18- #include < cstdlib>
11+ #include < cassert>
12+ #include < climits>
13+ #include < cmath>
1914#include < cstdio>
15+ #include < cstdlib>
2016#include < cstring>
21- #include < cmath>
2217#include < ctime>
23- #include < climits>
24- #include < cassert>
18+ #include < iostream>
19+ #include < sstream>
20+ #include < string>
2521#include < vector>
26- #include < queue>
27- #include < stack>
28- #include < deque>
29- #include < set>
30- #include < map>
31- #include < bitset>
32- #include < utility>
33- #include < algorithm>
22+
23+ #include " testlib.h"
3424
3525using namespace std ;
3626
3727#define forn (i, n ) for (int i = 0 ; i < int (n); i++)
3828
3929string token;
4030
41- vector<long long > readStreamCase (InStream& in, TResult pe, int testCase, bool & prereadCase)
42- {
43- if (!prereadCase)
44- {
31+ vector<long long > readStreamCase (InStream& in, TResult pe, int testCase, bool & prereadCase) {
32+ if (!prereadCase) {
4533 string caseStr = in.readToken ();
4634 if (caseStr != " Case" )
47- quitf (pe, " Expected 'Case' but found '%s' [test case %d]" , compress (caseStr).c_str (), testCase);
35+ quitf (pe, " Expected 'Case' but found '%s' [test case %d]" , compress (caseStr).c_str (),
36+ testCase);
4837 }
4938
5039 string numExpStr;
@@ -54,14 +43,13 @@ vector<long long> readStreamCase(InStream& in, TResult pe, int testCase, bool& p
5443 numExpStr += " :" ;
5544 string numStr = in.readToken ();
5645 if (numExpStr != numStr)
57- quitf (pe, " Expected '%s' but found '%s' [test case %d]" , compress (numExpStr).c_str (), compress (numStr).c_str (), testCase);
46+ quitf (pe, " Expected '%s' but found '%s' [test case %d]" , compress (numExpStr).c_str (),
47+ compress (numStr).c_str (), testCase);
5848
5949 vector<long long > result;
60- while (!in.seekEof ())
61- {
50+ while (!in.seekEof ()) {
6251 in.readTokenTo (token);
63- if (token == " Case" )
64- {
52+ if (token == " Case" ) {
6553 prereadCase = true ;
6654 break ;
6755 }
@@ -72,31 +60,22 @@ vector<long long> readStreamCase(InStream& in, TResult pe, int testCase, bool& p
7260 return result;
7361}
7462
75- string longLongsToString (const vector<long long >& a)
76- {
77- if (a.empty ())
78- return " \"\" [size=0]" ;
79-
63+ string longLongsToString (const vector<long long >& a) {
64+ if (a.empty ()) return " \"\" [size=0]" ;
65+
8066 string elems;
81- if (a.size () <= 5 )
82- {
83- forn (i, a.size ())
84- elems += vtos (a[i]) + " " ;
85- }
86- else
87- {
88- forn (i, 3 )
89- elems += vtos (a[i]) + " " ;
67+ if (a.size () <= 5 ) {
68+ forn (i, a.size ()) elems += vtos (a[i]) + " " ;
69+ } else {
70+ forn (i, 3 ) elems += vtos (a[i]) + " " ;
9071 elems += " ... " ;
91- forn (i, 2 )
92- elems += vtos (a[a.size () - 2 + i]) + " " ;
72+ forn (i, 2 ) elems += vtos (a[a.size () - 2 + i]) + " " ;
9373 }
9474
9575 return format (" \" %s\" [size=%d]" , trim (elems).c_str (), (int )a.size ());
9676}
9777
98- int main (int argc, char * argv[])
99- {
78+ int main (int argc, char * argv[]) {
10079 setName (" Many int64s checker with testcase-support" );
10180 registerTestlibCmd (argc, argv);
10281
@@ -105,18 +84,17 @@ int main(int argc, char* argv[])
10584 bool ansPrereadCase = false ;
10685 bool oufPrereadCase = false ;
10786
108- while (!ans.seekEof ())
109- {
87+ while (!ans.seekEof ()) {
11088 testCase++;
11189
11290 vector<long long > ja = readStreamCase (ans, _fail, testCase, ansPrereadCase);
11391 vector<long long > pa = readStreamCase (ouf, _pe, testCase, oufPrereadCase);
11492
115- if (ja != pa)
116- {
93+ if (ja != pa) {
11794 string js = longLongsToString (ja);
11895 string ps = longLongsToString (pa);
119- quitf (_wa, " Sequences differ: jury has %s, but participant has %s [test case %d]" , js.c_str (), ps.c_str (), testCase);
96+ quitf (_wa, " Sequences differ: jury has %s, but participant has %s [test case %d]" ,
97+ js.c_str (), ps.c_str (), testCase);
12098 }
12199 }
122100
0 commit comments