LRAUV  revA
StrValue_Test.h
Go to the documentation of this file.
1 
9 #ifndef _STRVALUE_TEST_H_
10 
11 
12 #include "StrValue.h"
13 
14 #include "UChar.h"
15 #include "Int.h"
16 #include "Float2.h"
17 #include "Float3.h"
18 #include "Float.h"
19 #include "Double4.h"
20 #include "Double6.h"
21 #include "Double.h"
22 
23 #include "units/Units.h"
24 
25 #include <cxxtest/TestSuite.h>
26 
32 class StrValue_Test : public CxxTest::TestSuite
33 {
34 public:
35 
37  void testSetFrom( void )
38  {
39  StrValue strValue;
40 
41  StrValue testStr( "Hello!" );
42  TS_ASSERT( strValue.setFrom( testStr ) );
43  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "Hello!", 6 );
44 
45  UChar testUChar( Units::ENUM, 1 );
46  TS_ASSERT( strValue.setFrom( testUChar ) );
47  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "1 enum", 6 );
48 
49  Int testInt( Units::ENUM, 2 );
50  TS_ASSERT( strValue.setFrom( testInt ) );
51  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "2 enum", 6 );
52 
53  Float2 testFloat2( Units::METER, 3.4375 );
54  TS_ASSERT( strValue.setFrom( testFloat2 ) );
55  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "3.4375", 6 );
56 
57  Float3 testFloat3( Units::METER, 4.5 );
58  TS_ASSERT( strValue.setFrom( testFloat3 ) );
59  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "4.5", 3 );
60 
61  Float testFloat( Units::METER, 5.625 );
62  TS_ASSERT( strValue.setFrom( testFloat ) );
63  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "5.625", 5 );
64 
65  Double4 testDouble4( Units::METER, 6.75 );
66  TS_ASSERT( strValue.setFrom( testDouble4 ) );
67  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "6.75", 4 );
68 
69  Double6 testDouble6( Units::METER, 7.875 );
70  TS_ASSERT( strValue.setFrom( testDouble6 ) );
71  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "7.875", 5 );
72 
73  Double testDouble( Units::METER, 8.9375 );
74  TS_ASSERT( strValue.setFrom( testDouble ) );
75  TS_ASSERT_SAME_DATA( strValue.asString().cStr(), "8.9375", 6 );
76 
77  }
78 
79 };
80 
81 #endif // _STRVALUE_TEST_H
Contains the Double4 class definition.
Contains the Double6 class definition.
Wraps a double precision (8-byte) floating point number and unit for storage in a DataElement...
Definition: Double.h:36
Wraps a single precision (4-byte) floating point number and unit for storage in a DataElement...
Definition: Float3.h:37
Wraps a 32-bit (4-byte) signed integer and unit for storage in a DataElement.
Definition: Int.h:32
Unit tests for StrValue class.
Definition: StrValue_Test.h:32
Contains the Float class definition.
void testSetFrom(void)
tests the setFrom Method
Definition: StrValue_Test.h:37
Wraps a 32-bit (4-byte) signed integer and unit for storage in a DataElement.
Definition: UChar.h:33
Wraps a single precision (4-byte) floating point number and unit for storage in a DataElement...
Definition: Float2.h:37
Contains the StrValue class definition.
Wraps a double precision (8-byte) floating point number and unit for storage in a DataElement...
Definition: Double6.h:36
virtual const Str & asString() const
Definition: StrValue.cpp:129
Contains the Int class definition.
const char * cStr() const
Definition: Str.h:188
Contains the Units class declaration.
Contains the UChar class definition.
static const BaseUnit ENUM
Definition: Units.h:229
Contains the Float3 class definition.
virtual bool setFrom(const Unit &unit, unsigned char value)
set from unsigned char value
Definition: StrValue.h:160
Wraps a double precision (8-byte) floating point number and unit for storage in a DataElement...
Definition: Double4.h:33
Wraps a string (see Str) as a DataValue, so strings can be written to and read from the slate...
Definition: StrValue.h:34
Contains the Double class definition.
Wraps a single precision (4-byte) floating point number and unit for storage in a DataElement...
Definition: Float.h:36
static const BaseUnit METER
Definition: Units.h:42
Contains the Float2 class definition.