moved CompareStreams function to TranslatorTestAddOn.cpp so that multiple translator tests could use it

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3124 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber
2003-04-29 01:21:43 +00:00
parent 1f52e8a2df
commit d1363d0da5
@@ -18,6 +18,7 @@
#include <Errors.h>
#include <OS.h>
#include "../../../../add-ons/translators/stxttranslator/STXTTranslator.h"
#include "TranslatorTestAddOn.h"
// Suite
CppUnit::Test *
@@ -200,40 +201,6 @@ STXTTranslatorTest::IdentifyTest()
sizeof(aStyledFiles) / sizeof(const char *), false);
}
bool
CompareStreams(BPositionIO &a, BPositionIO &b)
{
off_t alen = 0, blen = 0;
uint8 *abuf = NULL, *bbuf = NULL;
a.Seek(0, SEEK_END);
alen = a.Position();
b.Seek(0, SEEK_END);
blen = b.Position();
if (alen != blen)
return false;
bool bresult = false;
abuf = new uint8[alen];
bbuf = new uint8[blen];
if (a.ReadAt(0, abuf, alen) == alen) {
if (b.ReadAt(0, bbuf, blen) == blen) {
if (memcmp(abuf, bbuf, alen) == 0)
bresult = true;
else
bresult = false;
}
}
delete[] abuf;
abuf = NULL;
delete[] bbuf;
bbuf = NULL;
return bresult;
}
void
TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster,
const char **paths, int32 len, bool bplain)