-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumericTest.h
More file actions
54 lines (36 loc) · 1.1 KB
/
NumericTest.h
File metadata and controls
54 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include "StreamSupport.h"
template <typename T>
inline T SetData()
{
return 34;
}
inline CComBSTR SetData()
{
return L"Test string";
}
template< class T>
class CNumericTest
{
public:
//------------------------------------------------------------------------------
// Test a one dimensional array of numbers
//------------------------------------------------------------------------------
static HRESULT Test()
{
CComVariant v1;
CComVariant v2;
CComPtr<IStream> pStream;
USES_CONVERSION;
v1 = SetData<T>();
// Create a memory stream.
HR( CreateMemoryStream( &pStream ) );
// Write out the variant to the stream, rewind the stream and read it back into another variant.
WriteVariantToStream( &v1, pStream );
HR( RewindStream( pStream ) );
ReadVariantFromStream( pStream, v2 );
if ( v1 != v2 )
HR( E_UNEXPECTED );
return S_OK;
} // Test
}; // class COneDimNumbersArrayTest