Protocols::Gnutella::Packets::Testing::QueryTest Class Reference

Inherits TestFixture.

Inheritance diagram for Protocols::Gnutella::Packets::Testing::QueryTest:

Inheritance graph
[legend]
Collaboration diagram for Protocols::Gnutella::Packets::Testing::QueryTest:

Collaboration graph
[legend]
List of all members.

Detailed Description

Tests for the packet class Query.

scenarioReadPacket() verifies that a packet's payload and header fields are a) correctly parsed from raw bytes, or b) could not be parsed.

scenarioWritePacket() verifies that a packet's payload and header fields are correctly written as raw bytes.

scenarioReadSetWritePacket() verifies that the fields of a correctly read packet could be modified and written as raw bytes.

Blackbox considerations:

Definition at line 51 of file QueryTest.cpp.

Public Member Functions

void setUp ()
void tearDown ()
void scenarioReadPacket (const QByteArray &rawHeader, const QByteArray &rawPayload, bool parsedOk, const MinSpeed &minSpeed, const QByteArray &searchCriteria, const QueryData &extension)
 Tests parsing the packet fields from raw bytes.
void scenarioWritePacket (const MinSpeed &minSpeed, const QByteArray &searchCriteria, const QueryData &extension, const QByteArray &rawHeader, const QByteArray &rawPayload)
 Tests writing the packet fields as raw bytes.
void scenarioReadSetWritePacket (const QByteArray &rawHeader, const QByteArray &rawPayload, const MinSpeed &minSpeed, const QByteArray &searchCriteria, const QueryData &extension, const QByteArray &rawHeader2, const QByteArray &rawPayload2)
 Tests parsing a packet, modifying the fields then writing it again.
void testPacketProperties ()
 Tests constant packet properties.
void testReadPacketHasExtension ()
void testReadPacketNoExtension ()
void testWritePacketHasExtension ()
void testWritePacketNoExtension ()
void testReadSetWritePacketOK ()

Private Member Functions

 CPPUNIT_TEST_SUITE (QueryTest)
 CPPUNIT_TEST (testPacketProperties)
 CPPUNIT_TEST (testReadPacketHasExtension)
 CPPUNIT_TEST (testReadPacketNoExtension)
 CPPUNIT_TEST (testWritePacketHasExtension)
 CPPUNIT_TEST (testWritePacketNoExtension)
 CPPUNIT_TEST (testReadSetWritePacketOK)
 CPPUNIT_TEST_SUITE_END ()

Private Attributes

auto_ptr< Querypacket


Member Function Documentation

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST testReadSetWritePacketOK   )  [private]
 

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST testWritePacketNoExtension   )  [private]
 

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST testWritePacketHasExtension   )  [private]
 

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST testReadPacketNoExtension   )  [private]
 

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST testReadPacketHasExtension   )  [private]
 

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST testPacketProperties   )  [private]
 

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST_SUITE QueryTest   )  [private]
 

Protocols::Gnutella::Packets::Testing::QueryTest::CPPUNIT_TEST_SUITE_END  )  [private]
 

void Protocols::Gnutella::Packets::Testing::QueryTest::scenarioReadPacket const QByteArray &  rawHeader,
const QByteArray &  rawPayload,
bool  parsedOk,
const MinSpeed minSpeed,
const QByteArray &  searchCriteria,
const QueryData extension
[inline]
 

Tests parsing the packet fields from raw bytes.

Parses raw bytes and then verifies that all payload fields have correct values.

Definition at line 80 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::scenarioReadSetWritePacket const QByteArray &  rawHeader,
const QByteArray &  rawPayload,
const MinSpeed minSpeed,
const QByteArray &  searchCriteria,
const QueryData extension,
const QByteArray &  rawHeader2,
const QByteArray &  rawPayload2
[inline]
 

Tests parsing a packet, modifying the fields then writing it again.

This scenario implicitly tests blackbox behavior!

The main aim of this scenario is to verify that the payload fields are invalidated (blackbox behavior) after setting them and that the correct values are written afterwards. As single test case for this scenario will be enough.

Definition at line 121 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::scenarioWritePacket const MinSpeed minSpeed,
const QByteArray &  searchCriteria,
const QueryData extension,
const QByteArray &  rawHeader,
const QByteArray &  rawPayload
[inline]
 

Tests writing the packet fields as raw bytes.

Sets the fields of a default constructed object and verifies that they are correctly written as write bytes.

Definition at line 99 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::setUp  )  [inline]
 

Definition at line 65 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::tearDown  )  [inline]
 

Definition at line 70 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::testPacketProperties  )  [inline]
 

Tests constant packet properties.

Definition at line 139 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::testReadPacketHasExtension  )  [inline]
 

Definition at line 145 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::testReadPacketNoExtension  )  [inline]
 

Definition at line 155 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::testReadSetWritePacketOK  )  [inline]
 

Definition at line 183 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::testWritePacketHasExtension  )  [inline]
 

Definition at line 165 of file QueryTest.cpp.

void Protocols::Gnutella::Packets::Testing::QueryTest::testWritePacketNoExtension  )  [inline]
 

Definition at line 174 of file QueryTest.cpp.


Member Data Documentation

auto_ptr<Query> Protocols::Gnutella::Packets::Testing::QueryTest::packet [private]
 

Definition at line 62 of file QueryTest.cpp.


The documentation for this class was generated from the following file: