Protocols::BitTorrent::Packets::Testing::UnchokeTest Class Reference

Inherits TestFixture.

Inheritance diagram for Protocols::BitTorrent::Packets::Testing::UnchokeTest:

Inheritance graph
[legend]
Collaboration diagram for Protocols::BitTorrent::Packets::Testing::UnchokeTest:

Collaboration graph
[legend]
List of all members.

Detailed Description

Tests for the packet class Unchoke.

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 UnchokeTest.cpp.

Public Member Functions

void setUp ()
void tearDown ()
void scenarioReadPacket (const QByteArray &rawHeader, const QByteArray &rawPayload, bool parsedOk)
 Tests parsing the packet fields from raw bytes.
void scenarioWritePacket (const QByteArray &rawHeader, const QByteArray &rawPayload)
 Tests writing the packet fields as raw bytes.
void scenarioReadSetWritePacket (const QByteArray &rawHeader, const QByteArray &rawPayload, const QByteArray &rawHeader2, const QByteArray &rawPayload2)
 Tests parsing a packet, modifying the fields then writing it again.
void testPacketProperties ()
 Tests constant packet properties.
void testReadPacketOK ()
void testReadPacketFails ()
void testWritePacketOK ()

Private Member Functions

 CPPUNIT_TEST_SUITE (UnchokeTest)
 CPPUNIT_TEST (testPacketProperties)
 CPPUNIT_TEST (testReadPacketOK)
 CPPUNIT_TEST (testReadPacketFails)
 CPPUNIT_TEST (testWritePacketOK)
 CPPUNIT_TEST_SUITE_END ()

Private Attributes

auto_ptr< Unchokepacket


Member Function Documentation

Protocols::BitTorrent::Packets::Testing::UnchokeTest::CPPUNIT_TEST testWritePacketOK   )  [private]
 

Protocols::BitTorrent::Packets::Testing::UnchokeTest::CPPUNIT_TEST testReadPacketFails   )  [private]
 

Protocols::BitTorrent::Packets::Testing::UnchokeTest::CPPUNIT_TEST testReadPacketOK   )  [private]
 

Protocols::BitTorrent::Packets::Testing::UnchokeTest::CPPUNIT_TEST testPacketProperties   )  [private]
 

Protocols::BitTorrent::Packets::Testing::UnchokeTest::CPPUNIT_TEST_SUITE UnchokeTest   )  [private]
 

Protocols::BitTorrent::Packets::Testing::UnchokeTest::CPPUNIT_TEST_SUITE_END  )  [private]
 

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::scenarioReadPacket const QByteArray &  rawHeader,
const QByteArray &  rawPayload,
bool  parsedOk
[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 78 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::scenarioReadSetWritePacket const QByteArray &  rawHeader,
const QByteArray &  rawPayload,
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 104 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::scenarioWritePacket 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 89 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::setUp  )  [inline]
 

Definition at line 63 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::tearDown  )  [inline]
 

Definition at line 68 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::testPacketProperties  )  [inline]
 

Tests constant packet properties.

Definition at line 115 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::testReadPacketFails  )  [inline]
 

Definition at line 128 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::testReadPacketOK  )  [inline]
 

Definition at line 121 of file UnchokeTest.cpp.

void Protocols::BitTorrent::Packets::Testing::UnchokeTest::testWritePacketOK  )  [inline]
 

Definition at line 135 of file UnchokeTest.cpp.


Member Data Documentation

auto_ptr<Unchoke> Protocols::BitTorrent::Packets::Testing::UnchokeTest::packet [private]
 

Definition at line 60 of file UnchokeTest.cpp.


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