MCPcopy Create free account
hub / github.com/Simsys/qhexedit2 / compare

Method compare

test/testchunks.cpp:74–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void TestChunks::compare()
75{
76 QByteArray rHighLighted;
77 QByteArray rData = _chunks.data(0, -1, &rHighLighted);
78 bool error = false;
79
80 if (rData != _data)
81 error = true;
82 if (rHighLighted != _highlighted)
83 error = true;
84
85 _tCnt += 1;
86
87 int chunkSize = _chunks.chunkSize();
88 QString tName = QString("logs/%1_%2_%3").arg(_tName).arg(_tCnt).arg(chunkSize);
89 if (error || (_tCnt >= _saveFile))
90 {
91 QFile file1(tName + "_data.txt");
92 file1.open(QIODevice::WriteOnly);
93 file1.write(_data);
94 file1.close();
95
96 QFile file2(tName + "_highlighted.txt");
97 file2.open(QIODevice::WriteOnly);
98 file2.write(_highlighted);
99 file2.close();
100
101 QFile file3(tName + "_rData.txt");
102 file3.open(QIODevice::WriteOnly);
103 file3.write(rData);
104 file3.close();
105
106 QFile file4(tName + "_rHighlighted.txt");
107 file4.open(QIODevice::WriteOnly);
108 file4.write(rHighLighted);
109 file4.close();
110 }
111
112 if (error)
113 {
114 qDebug() << "NOK " << tName;
115 *_log << "NOK " << tName << "\n";
116 }
117 else
118 {
119 qDebug() << "OK " << tName;
120 *_log << "OK " << tName << "\n";
121 }
122
123}

Callers

nothing calls this directly

Calls 4

chunkSizeMethod · 0.80
dataMethod · 0.45
openMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected