(__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define WXARC_MEMBER_TEMPLATES
#endif
-#if defined _MSC_VER && _MSC_VER >= 1310
+#if defined _MSC_VER && _MSC_VER >= 1310 && !defined __WIN64__
# define WXARC_MEMBER_TEMPLATES
#endif
#if defined __BORLANDC__ && __BORLANDC__ >= 0x530
: wxInputStream(),
m_options(in.m_options),
m_pos(in.m_pos),
- m_size(in.m_size)
+ m_size(in.m_size),
+ m_eoftype(in.m_eoftype)
{
m_data = new char[m_size];
memcpy(m_data, in.m_data, m_size);
{
if (!IsOk() || !size)
return 0;
- if (m_size <= m_pos) {
- m_lasterror = wxSTREAM_EOF;
- return 0;
+
+ size_t count;
+
+ if (m_pos >= m_size)
+ count = 0;
+ else if (m_size - m_pos < size)
+ count = m_size - m_pos;
+ else
+ count = size;
+
+ if (count) {
+ memcpy(buffer, m_data + m_pos, count);
+ m_pos += count;
}
- if (m_size - m_pos < size)
- size = m_size - m_pos;
- memcpy(buffer, m_data + m_pos, size);
- m_pos += size;
- return size;
+ if (((m_eoftype & AtLast) != 0 && m_pos >= m_size) || count < size)
+ if ((m_eoftype & WithError) != 0)
+ m_lasterror = wxSTREAM_READ_ERROR;
+ else
+ m_lasterror = wxSTREAM_EOF;
+
+ return count;
}
template <class ClassFactoryT>
ArchiveTestCase<ClassFactoryT>::ArchiveTestCase(
string name,
- int id,
ClassFactoryT *factory,
int options,
const wxString& archiver,
const wxString& unarchiver)
:
- CppUnit::TestCase(name),
+ CppUnit::TestCase(TestId::MakeId() + name),
m_factory(factory),
m_options(options),
m_timeStamp(1, wxDateTime::Mar, 2004, 12, 0),
- m_id(id),
+ m_id(TestId::GetId()),
m_archiver(archiver),
m_unarchiver(unarchiver)
{
// check archive could be created
CPPUNIT_ASSERT(out.GetLength() > 0);
- TestInputStream in(out);
+ TestInputStream in(out, m_id % ((m_options & PipeIn) ? 4 : 3));
TestIterator(in);
in.Rewind();
const TestEntry& testEntry = *it->second;
-#ifndef __WXMSW__
+#if 0 //ndef __WXMSW__
CPPUNIT_ASSERT_MESSAGE("timestamp check" + error_context,
testEntry.GetDateTime() ==
wxFileName(path).GetModificationTime());
}
+///////////////////////////////////////////////////////////////////////////////
+// Make the ids
+
+int TestId::m_seed = 6219;
+
+// static
+string TestId::MakeId()
+{
+ m_seed = (m_seed * 171) % 30269;
+ return (const char *)wxString::Format(_T("%-6d"), m_seed).mb_str();
+}
+
+
///////////////////////////////////////////////////////////////////////////////
// Suite base
ArchiveTestSuite::ArchiveTestSuite(string name)
: CppUnit::TestSuite("archive/" + name),
- m_id(0),
m_name(name.c_str(), *wxConvCurrent)
{
m_name = _T("wx") + m_name.Left(1).Upper() + m_name.Mid(1).Lower();
string descr = Description(m_name, options,
generic != 0, *j, *i);
- CppUnit::Test *test = makeTest(descr, m_id, options,
+ CppUnit::Test *test = makeTest(descr, options,
generic != 0, *j, *i);
- if (test) {
+ if (test)
addTest(test);
- m_id++;
- }
}
return this;
CppUnit::Test *ArchiveTestSuite::makeTest(
string WXUNUSED(descr),
- int WXUNUSED(id),
int WXUNUSED(options),
bool WXUNUSED(genericInterface),
const wxString& WXUNUSED(archiver),
const wxString& unarchiver)
{
wxString descr;
- descr << m_id << _T(" ");
if (genericInterface)
descr << _T("wxArchive (") << type << _T(")");