Skip to content

Commit cdc0d0d

Browse files
committed
Test files and source compatibility.
1 parent 7920c64 commit cdc0d0d

File tree

5 files changed

+98
-26
lines changed

5 files changed

+98
-26
lines changed

test/data/anon/argstat_cu.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<root >
3+
<level2 attr_5_1000="&#x0400;
4+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
5+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
6+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
7+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
8+
"/>
9+
</root>

test/data/anon/argstat_t2.xml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<root >
3+
<level2 attr_5_10="aaaaa"/>
4+
<level2 attr_5_10="aaaaa"/>
5+
<level2 attr_5_10="aaaaaa"/>
6+
<level2 attr_5_10="aaaaaaa"/>
7+
<level2 attr_5_10="aaaaaaaa"/>
8+
<level2 attr_5_10="aaaaaaaaa"/>
9+
<level2 attr_5_10="aaaaaaaaaa"/>
10+
11+
<level3 attr_5_10="aaaa aaaa"/>
12+
<level3 attr_5_10="aaaa aaaa"/>
13+
<level3 attr_5_10="aaaaa"/>
14+
<level3 attr_5_10="aa aaaa"/>
15+
16+
<level1 attr_5_10="aaa aaa a"/>
17+
<level1 attr_5_10="aaa aaa a"/>
18+
<level1 attr_5_10="aaaaa"/>
19+
20+
<level4 attr_5_10="aa aa aa"/>
21+
<level4 attr_5_10="aa aaa aa"/>
22+
<level4 attr_5_10="aa aa aa"/>
23+
<level4 attr_5_10="aa aa aa"/>
24+
<level4 attr_5_10="aa aa aa"/>
25+
<level4 attr_5_10="aaaa aa"/>
26+
<a>Aaa 1</a>
27+
<a>Aaa 1</a>
28+
<a>Aaa 1</a>
29+
<a>Aaa 10/</a>
30+
<a>Aaa 10/</a>
31+
<elementYes a1="This92 iS" a2="" a3="`bc" a4="" xml:lang="en"/>
32+
<elementNo/>
33+
<parent1>
34+
<p1>This92 iS</p1>
35+
<P2/>
36+
<P3/>
37+
<P4>a</P4>
38+
</parent1>
39+
<!-- this format is needed for tests control only -->
40+
<parent2>This92 iS<a/><b/>136446<c/></parent2>
41+
<parent1CDATA>
42+
<p1><![CDATA[This92 iS]]></p1>
43+
<P2><![CDATA[]]></P2>
44+
<P3><![CDATA[ ]]></P3>
45+
<P4><![CDATA[a]]></P4>
46+
</parent1CDATA>
47+
</root>

test/data/anon/argstat_tonly.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<root>
3+
<a>Aaa 1</a>
4+
<a>Aaa 1</a>
5+
<a>Aaa 1</a>
6+
<a>Aaa 10/</a>
7+
<a>Aaa 10/</a>
8+
<a>Aaa 10/</a>
9+
<a>Aaa 10/</a>
10+
<a>Aaa 10/</a>
11+
<a>Aaa 10/</a>
12+
<a>Aaa 10/</a>
13+
<a>Aaa 10/</a>
14+
<a>Aaa 10/</a>
15+
<a>Aaa 10/</a>
16+
</root>

test/testanonymize.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class TestAnonymize : public TestBase, AnonOperationBatchOutputFileProvider
144144
bool testAlgStatScanValueW4();
145145
bool testAlgStatScanValueW5();
146146
bool testAlgStatScanValueW6();
147-
bool testAlgStatScanValueCase(QStringList input, const int expectedTotal, QList<QPair<int,int>> &expectedItems );
147+
bool testAlgStatScanValueCase(QStringList input, const int expectedTotal, QList<QPair<int,int> > &expectedItems );
148148
//
149149
bool testAnonStatTargetValue();
150150
bool testStatValueForInputs( const QStringList &inputs, const QString expectedOutput);
@@ -159,10 +159,10 @@ class TestAnonymize : public TestBase, AnonOperationBatchOutputFileProvider
159159
bool testAnonStatWordChainOneWord();
160160
bool testAnonStatWordChainEmpty();
161161
bool testAlgStatWordChainCase(QList<QStringList> input, QStringList &expectedPatterns );
162-
bool testAlgStatScanWordChainCase(QStringList input, const int expectedTotal, QList<QPair<int,int>> &expectedItems );
162+
bool testAlgStatScanWordChainCase(QStringList input, const int expectedTotal, QList<QPair<int,int> > &expectedItems );
163163
//
164164
bool testUnitAnonStatAlgWord();
165-
bool testAlgStatScanWordCase(QStringList input, const int expectedTotal, QList<QPair<int,int>> &expectedItems, QStringList expectedPatterns );
165+
bool testAlgStatScanWordCase(QStringList input, const int expectedTotal, QList<QPair<int,int> > &expectedItems, QStringList expectedPatterns );
166166
bool testUnitAnonStatAlgWordErrors();
167167
bool testUnitAnonStatAlgWordHitPatterns1();
168168
bool testUnitAnonStatAlgWordHitPatternsNsame();

test/testhelpers/testanonymize_stat.cpp

+23-23
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ bool TestAnonymize::testUnitAlgStatScanValue()
146146
return true;
147147
}
148148

149-
bool TestAnonymize::testAlgStatScanValueCase(QStringList input, const int expectedTotal, QList<QPair<int,int>> &expectedItems )
149+
bool TestAnonymize::testAlgStatScanValueCase(QStringList input, const int expectedTotal, QList<QPair<int,int> > &expectedItems )
150150
{
151151
AnonStatAlgValue anonAlgValue;
152152
AnonAlgStatContext context;
@@ -186,8 +186,8 @@ bool TestAnonymize::testAlgStatScanValueCase(QStringList input, const int expect
186186
return true;
187187
}
188188

189-
static QList<QPair<int,int>> itemsForArray( const int count, const int occurrences1[], const int occurrences2[]) {
190-
QList<QPair<int,int>> result ;
189+
static QList<QPair<int,int> > itemsForArray( const int count, const int occurrences1[], const int occurrences2[]) {
190+
QList<QPair<int,int> > result ;
191191
FORINT(i, count) {
192192
QPair<int,int> newPair(occurrences1[i], occurrences2[i]);
193193
result.append(newPair);
@@ -198,7 +198,7 @@ static QList<QPair<int,int>> itemsForArray( const int count, const int occurrenc
198198
bool TestAnonymize::testAlgStatScanValueNull()
199199
{
200200
_subTestName = "testAlgStatScanValue/testAlgStatScanValueNull";
201-
QList<QPair<int,int>> expected ;
201+
QList<QPair<int,int> > expected ;
202202
if(!testAlgStatScanValueCase(QStringList(), 0, expected)) {
203203
return false ;
204204
}
@@ -208,7 +208,7 @@ bool TestAnonymize::testAlgStatScanValueNull()
208208
bool TestAnonymize::testAlgStatScanValueEmpty()
209209
{
210210
_subTestName = "testAlgStatScanValue/testAlgStatScanValueEmpty";
211-
QList<QPair<int,int>> expected = itemsForArray(0, NULL, NULL);
211+
QList<QPair<int,int> > expected = itemsForArray(0, NULL, NULL);
212212
if(!testAlgStatScanValueCase(QStringList()<<"", 1, expected)) {
213213
return false ;
214214
}
@@ -220,7 +220,7 @@ bool TestAnonymize::testAlgStatScanValueOneWord()
220220
_subTestName = "testAlgStatScanValue/testAlgStatScanValueOneWord";
221221
const int expectedKey[] = {1};
222222
const int expectedCount[] = {1};
223-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
223+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
224224
if(!testAlgStatScanValueCase(QStringList()<<"abc", 1, expected)) {
225225
return false ;
226226
}
@@ -232,7 +232,7 @@ bool TestAnonymize::testAlgStatScanValueDoubleWord()
232232
_subTestName = "testAlgStatScanValue/testAlgStatScanValueDoubleWord";
233233
const int expectedKey[] = {2};
234234
const int expectedCount[] = {1};
235-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
235+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
236236
if(!testAlgStatScanValueCase(QStringList()<<"abc def", 1, expected)) {
237237
return false ;
238238
}
@@ -244,7 +244,7 @@ bool TestAnonymize::testAlgStatScanValue3Word()
244244
_subTestName = "testAlgStatScanValue/testAlgStatScanValue3Word";
245245
const int expectedKey[] = {3};
246246
const int expectedCount[] = {1};
247-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
247+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
248248
if(!testAlgStatScanValueCase(QStringList()<<"abc def k", 1, expected)) {
249249
return false ;
250250
}
@@ -256,7 +256,7 @@ bool TestAnonymize::testAlgStatScanValueW1()
256256
_subTestName = "testAlgStatScanValue/testAlgStatScanValueW1";
257257
const int expectedKey[] = {3, 1};
258258
const int expectedCount[] = {1, 1};
259-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
259+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
260260
if(!testAlgStatScanValueCase(QStringList()<<"abc def k"<<"abc", 2, expected)) {
261261
return false ;
262262
}
@@ -268,7 +268,7 @@ bool TestAnonymize::testAlgStatScanValueW2()
268268
_subTestName = "testAlgStatScanValue/testAlgStatScanValueW2";
269269
const int expectedKey[] = {1, 2, 3};
270270
const int expectedCount[] = {2, 1, 1};
271-
QList<QPair<int,int>> expected = itemsForArray(3, expectedKey, expectedCount);
271+
QList<QPair<int,int> > expected = itemsForArray(3, expectedKey, expectedCount);
272272
if(!testAlgStatScanValueCase(QStringList()<<"abc def k"<<"abc"<<"abc"<<"abc e", 4, expected)) {
273273
return false ;
274274
}
@@ -280,7 +280,7 @@ bool TestAnonymize::testAlgStatScanValueW3()
280280
_subTestName = "testAlgStatScanValue/testAlgStatScanValueW3";
281281
const int expectedKey[] = {1};
282282
const int expectedCount[] = {1};
283-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
283+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
284284
if(!testAlgStatScanValueCase(QStringList()<<"abc\u00C4\00C8\u00E0def", 1, expected)) {
285285
return false ;
286286
}
@@ -292,7 +292,7 @@ bool TestAnonymize::testAlgStatScanValueW4()
292292
_subTestName = "testAlgStatScanValue/testAlgStatScanValueW4";
293293
const int expectedKey[] = {1};
294294
const int expectedCount[] = {1};
295-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
295+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
296296
if(!testAlgStatScanValueCase(QStringList()<<"abc\u00C4\u00C8\u00E0def,4", 1, expected)) {
297297
return false ;
298298
}
@@ -304,7 +304,7 @@ bool TestAnonymize::testAlgStatScanValueW5()
304304
_subTestName = "testAlgStatScanValue/testAlgStatScanValueW5";
305305
const int expectedKey[] = {2};
306306
const int expectedCount[] = {1};
307-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
307+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
308308
if(!testAlgStatScanValueCase(QStringList()<<"abc\u00C4\t\u00C8\u00E0def,4", 1, expected)) {
309309
return false ;
310310
}
@@ -316,7 +316,7 @@ bool TestAnonymize::testAlgStatScanValueW6()
316316
_subTestName = "testAlgStatScanValue/testAlgStatScanValueW6";
317317
const int expectedKey[] = {7};
318318
const int expectedCount[] = {1};
319-
QList<QPair<int,int>> expected = itemsForArray(1, expectedKey, expectedCount);
319+
QList<QPair<int,int> > expected = itemsForArray(1, expectedKey, expectedCount);
320320
if(!testAlgStatScanValueCase(QStringList()<<"abc\u00C4\t\u00C8 \u00E0def,\n45\r6 7\t\t\n\r///", 1, expected)) {
321321
return false ;
322322
}
@@ -609,7 +609,7 @@ bool TestAnonymize::testUnitAnonStatAlgPattern()
609609

610610
//--------------------------
611611

612-
bool TestAnonymize::testAlgStatScanWordCase(QStringList input, const int expectedTotal, QList<QPair<int,int>> &expectedItems, QStringList expectedPatterns )
612+
bool TestAnonymize::testAlgStatScanWordCase(QStringList input, const int expectedTotal, QList<QPair<int,int> > &expectedItems, QStringList expectedPatterns )
613613
{
614614
AnonStatAlgWord anonStatAlgWord;
615615
AnonAlgStatContext context;
@@ -713,7 +713,7 @@ bool TestAnonymize::testUnitAnonStatAlgWordHitPatterns1()
713713
_subTestName = "testUnitAnonStatAlgWordHitPatterns1";
714714
const int expectedKey[] = {0};
715715
const int expectedCount[] = {1};
716-
QList<QPair<int,int>> expectedPairs = itemsForArray(1, expectedKey, expectedCount);
716+
QList<QPair<int,int> > expectedPairs = itemsForArray(1, expectedKey, expectedCount);
717717
if(!testAlgStatScanWordCase(QStringList()<<"abc", 1, expectedPairs, QStringList()<<"aaa")) {
718718
return false ;
719719
}
@@ -725,7 +725,7 @@ bool TestAnonymize::testUnitAnonStatAlgWordHitPatternsNsame()
725725
_subTestName = "testUnitAnonStatAlgWordHitPatternsNsame";
726726
const int expectedKey[] = {0};
727727
const int expectedCount[] = {3};
728-
QList<QPair<int,int>> expectedPairs = itemsForArray(1, expectedKey, expectedCount);
728+
QList<QPair<int,int> > expectedPairs = itemsForArray(1, expectedKey, expectedCount);
729729
if(!testAlgStatScanWordCase(QStringList()<<"abc"<<"abc"<<"abc", 3, expectedPairs, QStringList()<<"aaa")) {
730730
return false ;
731731
}
@@ -737,7 +737,7 @@ bool TestAnonymize::testUnitAnonStatAlgWordHitPatternsN()
737737
_subTestName = "testUnitAnonStatAlgWordHitPatternsN";
738738
const int expectedKey[] = {0,1,2};
739739
const int expectedCount[] = {1,2,1};
740-
QList<QPair<int,int>> expectedPairs = itemsForArray(3, expectedKey, expectedCount);
740+
QList<QPair<int,int> > expectedPairs = itemsForArray(3, expectedKey, expectedCount);
741741
if(!testAlgStatScanWordCase(QStringList()<<"abc"<<"789"<<"012"<<"Nf/1", 4, expectedPairs, QStringList()<<"aaa"<<"000"<<"Aa/0")) {
742742
return false ;
743743
}
@@ -1080,7 +1080,7 @@ bool TestAnonymize::checkBaseStatIntervals(AnonAlgFreqCount *accumulator, const
10801080
return true;
10811081
}
10821082

1083-
bool TestAnonymize::checkStatIntervals(const QStringList &inputs, const QList<QPair<double, double>> &expected )
1083+
bool TestAnonymize::checkStatIntervals(const QStringList &inputs, const QList<QPair<double, double> > &expected )
10841084
{
10851085
AnonStatAlgValue chain;
10861086
AnonAlgStatContext context;
@@ -1174,23 +1174,23 @@ bool TestAnonymize::testAnonStatMean()
11741174
return false;
11751175
}
11761176
{
1177-
QList<QPair<double, double>> expected ;
1177+
QList<QPair<double, double> > expected ;
11781178
QPair<double, double> d1(0, 1);
11791179
expected.append(d1);
11801180
if(!checkStatIntervals(QStringList()<<"1", expected)) {
11811181
return false;
11821182
}
11831183
}
11841184
{
1185-
QList<QPair<double, double>> expected ;
1185+
QList<QPair<double, double> > expected ;
11861186
QPair<double, double> d1(0, 1);
11871187
expected.append(d1);
11881188
if(!checkStatIntervals(QStringList()<<"1"<<"1", expected)) {
11891189
return false;
11901190
}
11911191
}
11921192
{
1193-
QList<QPair<double, double>> expected ;
1193+
QList<QPair<double, double> > expected ;
11941194
QPair<double, double> d1(0, 0.75);
11951195
QPair<double, double> d2(0.75, 1);
11961196
expected.append(d1);
@@ -1200,7 +1200,7 @@ bool TestAnonymize::testAnonStatMean()
12001200
}
12011201
}
12021202
{
1203-
QList<QPair<double, double>> expected ;
1203+
QList<QPair<double, double> > expected ;
12041204
QPair<double, double> d1(0.75, 1);
12051205
QPair<double, double> d2(0, 0.5);
12061206
QPair<double, double> d3(0.5, 0.75);

0 commit comments

Comments
 (0)