Skip to content

Commit

Permalink
Changed ADARAPacketTest so that it should compile on all platforms
Browse files Browse the repository at this point in the history
Refs #6559
  • Loading branch information
rgmiller committed Feb 13, 2013
1 parent 410a512 commit 2b72979
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
5 changes: 1 addition & 4 deletions Code/Mantid/Framework/DataHandling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,7 @@ set ( TEST_FILES
#LoadDAETest.h
#LoadSNSNexusTest.h # TODO has no active tests in it
#Needs fixing to not rely on network. SNSLiveEventDataListenerTest.h
#ADARAPacketTest.h
#Commenting out ADARAPacketTest because the RHEL6 compiler doesn't
#like the the way I was initializing data. Will fix and re-enable
#shortly.
ADARAPacketTest.h
AppendGeometryToSNSNexusTest.h
CompressEventsTest.h
CreateChopperModelTest.h
Expand Down
18 changes: 9 additions & 9 deletions Code/Mantid/Framework/DataHandling/test/ADARAPacketTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#include "Poco/DOM/DOMParser.h" // for parsing the XML device descriptions


// All of the sample packets that we need to run the tests are defined in the following
// header. The packets can get pretty long, which is why I didn't want them cluttering
// up this file.
#include "ADARAPackets.h"

class ADARAPacketTest : public CxxTest::TestSuite,
ADARA::Parser
{
Expand All @@ -31,7 +36,7 @@ class ADARAPacketTest : public CxxTest::TestSuite,
void testDeviceDescriptorPacket()
{
boost::shared_ptr<ADARA::DeviceDescriptorPkt> pkt =
basicPacketTests<ADARA::DeviceDescriptorPkt>( m_devDesPkt, sizeof(m_devDesPkt), 726785379, 0);
basicPacketTests<ADARA::DeviceDescriptorPkt>( devDesPkt, sizeof(devDesPkt), 726785379, 0);
if (pkt != NULL)
{
// Basic XML validation
Expand All @@ -43,7 +48,7 @@ class ADARAPacketTest : public CxxTest::TestSuite,
void testRunStatusPacketParser()
{
boost::shared_ptr<ADARA::RunStatusPkt> pkt =
basicPacketTests<ADARA::RunStatusPkt>( m_runStatusPkt, sizeof(m_runStatusPkt), 728504568, 5625794);
basicPacketTests<ADARA::RunStatusPkt>( runStatusPkt, sizeof(runStatusPkt), 728504568, 5625794);

if( pkt != NULL)
{
Expand All @@ -60,13 +65,13 @@ class ADARAPacketTest : public CxxTest::TestSuite,
void testSyncPacketParser()
{
// the basic tests cover everything in the sync packet
basicPacketTests<ADARA::SyncPkt>(m_syncPkt, sizeof(m_syncPkt), 728504568, 5617153);
basicPacketTests<ADARA::SyncPkt>(syncPkt, sizeof(syncPkt), 728504568, 5617153);
}

void testVariableDoublePacketParser()
{
boost::shared_ptr<ADARA::VariableDoublePkt> pkt =
basicPacketTests<ADARA::VariableDoublePkt>( m_variableDoublePkt, sizeof(m_variableDoublePkt), 728281149, 0);
basicPacketTests<ADARA::VariableDoublePkt>( variableDoublePkt, sizeof(variableDoublePkt), 728281149, 0);

if( pkt != NULL)
{
Expand Down Expand Up @@ -181,11 +186,6 @@ class ADARAPacketTest : public CxxTest::TestSuite,
bool pulseIdCompare( uint64_t pulseId, uint32_t high, uint32_t low)
{ return ( ((pulseId>>32) == high) && ((pulseId & 0xFFFFFFFF) == low) ); }

// All of the sample packets that we need to run the test are defined in the following
// header. The packets can get pretty long, which is why I didn't want them cluttering
// up this file.
#include "ADARAPackets.h"

};

#endif /* MANTID_DATAHANDLING_ADARAPACKETTEST_H_ */
20 changes: 12 additions & 8 deletions Code/Mantid/Framework/DataHandling/test/ADARAPackets.h
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
#ifndef MANTID_DATAHANDLING_ADARAPACKETS_H_
#define MANTID_DATAHANDLING_ADARAPACKETS_H_

#ifndef MANTID_DATAHANDLING_ADARAPACKETTEST_H_
#error "This file should only be included by MantidDataHandling/test/AdaraPacketTest.h"
#endif

// This file include sample packets for the AdaraPacketTest unit test. It's
// intended to be included by ADARAPacketTest.h down in the private section
// of the class. (This code is in a separate file to keep it from cluttring
// up the ADARAPacketTest.h file.
// This file includes sample packets for the AdaraPacketTest unit test. It's
// intended to be included by ADARAPacketTest.h (but outside of the class
// definition for AdaraPacketTest).
// This code is in a separate file to keep it from cluttering up the
// ADARAPacketTest.h file.

// Type: "Synchronization (File)" (version 0)
// Pulse ID: 728504568.5617153
// Packet Time: Jan 31, 2013 - 13:22:48.005
const unsigned char m_syncPkt[44] = {
const unsigned char syncPkt[44] = {
0x1c, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00, 0xf8, 0x18, 0x6c, 0x2b, 0x01, 0xb6, 0x55, 0x00,
0x53, 0x4e, 0x53, 0x41, 0x44, 0x41, 0x52, 0x41, 0x4f, 0x52, 0x4e, 0x4c, 0x00, 0x00, 0xf0, 0x7f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

// Type: "Run Status" (version 0)
// Pulse ID: 728504568.5625794
// Packet Time: Jan 31, 2013 - 13:22:48.005
const unsigned char m_runStatusPkt[28] = {
const unsigned char runStatusPkt[28] = {
0x0c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x40, 0x00, 0xf8, 0x18, 0x6c, 0x2b, 0xc2, 0xd7, 0x55, 0x00,
0xbf, 0x33, 0x00, 0x00, 0x01, 0x14, 0x6c, 0x2b, 0x00, 0x00, 0x00, 0x05 };


// Type: "Variable Value (double)" (version 0)
// Pulse ID: 728281149.0
// Packet Time: Jan 28, 2013 - 23:19:09.000
const unsigned char m_variableDoublePkt[36] = {
const unsigned char variableDoublePkt[36] = {
0x14, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x3d, 0xb0, 0x68, 0x2b, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xc6, 0x4b, 0x37,
0x89, 0x01, 0x14, 0x40 };

// Type: "Device Descriptor" (version 0)
// Pulse ID: 726785379.0
// Packet Time: Jan 11, 2013 - 15:49:39.000
const unsigned char m_devDesPkt[2600] = {
const unsigned char devDesPkt[2600] = {
0x18, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x63, 0xdd, 0x51, 0x2b, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31, 0x2e, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f,
Expand Down

0 comments on commit 2b72979

Please sign in to comment.