LRAUV  revA
ElementURI_Test.h
Go to the documentation of this file.
1 
9 #ifndef _ELEMENTURI_TEST_H_
10 #define _ELEMENTURI_TEST_H_
11 
12 
13 #include "ElementURI.h"
14 #include "io/StrIOStream.h"
15 
16 #include <cxxtest/TestSuite.h>
17 
23 class ElementURI_Test : public CxxTest::TestSuite
24 {
25 public:
26 
28  void testRead( void )
29  {
30  Str str( " code=0006 elementURI=\"height_above_sea_floor\"\n" );
31  StrIOStream strIOStream( str );
32 
33  ElementURI* elementURI = ElementURI::Read( strIOStream );
34  TS_ASSERT( NULL != elementURI );
35  if( NULL != elementURI )
36  {
37  TS_ASSERT_EQUALS( elementURI->getCode(), 0x0006 );
38  TS_ASSERT_SAME_DATA( elementURI->cStr(), "height_above_sea_floor", 23 );
39  TS_ASSERT( elementURI->isUniversal() );
40  delete elementURI;
41  }
42 
43  str = " code=01CE elementURI=\"Batt_Ocean_Server.BattTemp_7\"";
44  strIOStream.rewind();
45 
46  elementURI = ElementURI::Read( strIOStream );
47  TS_ASSERT( NULL != elementURI );
48  if( NULL != elementURI )
49  {
50  TS_ASSERT_EQUALS( elementURI->getCode(), 0x01CE );
51  TS_ASSERT_SAME_DATA( elementURI->cStr(), "Batt_Ocean_Server.BattTemp_7", 29 );
52  TS_ASSERT( !elementURI->isUniversal() );
53  delete elementURI;
54  }
55 
56  }
57 
58 };
59 
60 #endif // _ELEMENTURI_TEST_H
void testRead(void)
Test ElementURI::Read.
Definition: ElementURI_Test.h:28
Wraps a Str with an IOStream class.
Definition: StrIOStream.h:24
Replacement for standard template class string.
Definition: Str.h:12
static ElementURI * Read(InStream &inStream)
Definition: ElementURI.cpp:162
Contains the ElementURI class definition.
const char * cStr() const
Definition: Str.h:188
unsigned short getCode() const
Definition: ElementURI.h:74
Contains the StrIOStream class declaration.
Code unit that represents a unique name for a DataElement.
Definition: ElementURI.h:27
Unit tests for ElementURI class.
Definition: ElementURI_Test.h:23
virtual bool isUniversal() const
Definition: ElementURI.h:84
void rewind()
Definition: StrIOStream.h:66