ReactOS  0.4.13-dev-73-gcfe54aa
CComObject.cpp File Reference
#include <atlbase.h>
#include <atlcom.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
Include dependency graph for CComObject.cpp:

Go to the source code of this file.

Classes

class  CTestObject
 
class  CDumExe
 

Macros

#define ok(value, ...)   ok_func(__FILE__, __LINE__, value, __VA_ARGS__)
 
#define START_TEST(x)   int main(void)
 

Functions

void ok_func (const char *file, int line, BOOL value, const char *fmt,...)
 
 START_TEST (CComObject)
 

Variables

int g_tests_executed = 0
 
int g_tests_failed = 0
 
static LONG g_CTOR = 0
 
static LONG g_DTOR = 0
 
static LONG g_BLIND = 0
 
CDumExe dum
 

Macro Definition Documentation

◆ ok

#define ok (   value,
  ... 
)    ok_func(__FILE__, __LINE__, value, __VA_ARGS__)

Definition at line 34 of file CComObject.cpp.

◆ START_TEST

#define START_TEST (   x)    int main(void)

Definition at line 35 of file CComObject.cpp.

Function Documentation

◆ ok_func()

void ok_func ( const char file,
int  line,
BOOL  value,
const char fmt,
  ... 
)

Definition at line 20 of file CComObject.cpp.

21  {
22  va_list va;
23  va_start(va, fmt);
24  if (!value)
25  {
26  printf("%s (%d): ", file, line);
27  vprintf(fmt, va);
29  }
31  va_end(va);
32  }
#define va_end(ap)
Definition: acmsvcex.h:90
Definition: parser.c:48
char * va_list
Definition: acmsvcex.h:78
_Check_return_opt_ _CRTIMP int __cdecl vprintf(_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
int g_tests_failed
Definition: CComObject.cpp:19
#define va_start(ap, A)
Definition: acmsvcex.h:91
Definition: dsound.c:943
int g_tests_executed
Definition: CComObject.cpp:18
#define printf
Definition: config.h:203
Definition: fci.c:126

◆ START_TEST()

START_TEST ( CComObject  )

Definition at line 94 of file CComObject.cpp.

95 {
96  g_CTOR = g_DTOR = g_BLIND = 0;
97 
98  CComObject<CTestObject>* pTest;
99  HRESULT hr = CComObject<CTestObject>::CreateInstance(&pTest);
100 
101  ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
102 
103  ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
104  ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
105  ok(g_BLIND == 0, "Expected 0, got %lu\n", g_BLIND);
106 
107  if (hr == S_OK)
108  {
109  ULONG ref = pTest->AddRef();
110  ok(ref == 1, "Expected 1, got %lu\n", ref);
111 
112  {
113  CComPtr<IUnknown> ppv;
114  hr = pTest->QueryInterface(IID_IUnknown, (void **) &ppv);
115  ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
116  ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
117  ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
118  ok(g_BLIND == 0, "Expected 0, got %lu\n", g_BLIND);
119 
120  CComPtr<IPersist> ppersist;
121  hr = pTest->QueryInterface(IID_IPersist, (void **)&ppersist);
122  ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
123  ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
124  ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
125  ok(g_BLIND == 0, "Expected 0, got %lu\n", g_BLIND);
126 
127  }
128 
129  {
130  CComPtr<IStdMarshalInfo> pstd;
131  hr = pTest->QueryInterface(IID_IStdMarshalInfo, (void **)&pstd);
132  ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
133  ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
134  ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
135  ok(g_BLIND == 1, "Expected 1, got %lu\n", g_BLIND);
136  }
137 
138  ref = pTest->Release();
139  ok(ref == 0, "Expected 0, got %lu\n", ref);
140  ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
141  ok(g_DTOR == 1, "Expected 1, got %lu\n", g_DTOR);
142  ok(g_BLIND == 1, "Expected 1, got %lu\n", g_BLIND);
143  }
144 
145 #ifndef HAVE_APITEST
146  printf("CComObject: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed);
147  return g_tests_failed;
148 #endif
149 }
HRESULT hr
Definition: shlfolder.c:183
const GUID IID_IPersist
Definition: proxy.cpp:14
REFIID LPVOID * ppv
Definition: atlbase.h:39
static LONG g_DTOR
Definition: CComObject.cpp:40
Definition: send.c:47
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static LONG g_CTOR
Definition: CComObject.cpp:39
int g_tests_failed
Definition: CComObject.cpp:19
static LONG g_BLIND
Definition: CComObject.cpp:41
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
int g_tests_executed
Definition: CComObject.cpp:18
#define printf
Definition: config.h:203

Variable Documentation

◆ dum

CDumExe dum

Definition at line 91 of file CComObject.cpp.

Referenced by SdbBeginWriteListTag(), and START_TEST().

◆ g_BLIND

LONG g_BLIND = 0
static

Definition at line 41 of file CComObject.cpp.

Referenced by CTestObject::FuncBlind(), and START_TEST().

◆ g_CTOR

LONG g_CTOR = 0
static

Definition at line 39 of file CComObject.cpp.

Referenced by CTestObject::CTestObject(), and START_TEST().

◆ g_DTOR

LONG g_DTOR = 0
static

Definition at line 40 of file CComObject.cpp.

Referenced by START_TEST(), and CTestObject::~CTestObject().

◆ g_tests_executed

int g_tests_executed = 0

Definition at line 18 of file CComObject.cpp.

Referenced by ok_func(), and START_TEST().

◆ g_tests_failed

int g_tests_failed = 0

Definition at line 19 of file CComObject.cpp.

Referenced by ok_func(), and START_TEST().