2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for EngDeleteSemaphore
5 * PROGRAMMERS: Magnus Olsen
13 void Test_EngDeleteSemaphore()
16 PRTL_CRITICAL_SECTION lpcrit
;
18 /* test Create then delete */
19 hsem
= EngCreateSemaphore();
20 ok(hsem
!= NULL
, "EngCreateSemaphore failed\n");
22 lpcrit
= (PRTL_CRITICAL_SECTION
)hsem
;
23 EngDeleteSemaphore(hsem
);
25 // ok(lpcrit->LockCount > 0); doesn't work on XP
26 ok(lpcrit
->RecursionCount
== 0, "lpcrit->RecursionCount=%ld\n", lpcrit
->RecursionCount
);
27 ok(lpcrit
->OwningThread
== 0, "lpcrit->OwningThread=%p\n", lpcrit
->OwningThread
);
28 ok(lpcrit
->LockSemaphore
== 0, "lpcrit->LockSemaphore=%p\n", lpcrit
->LockSemaphore
);
29 ok(lpcrit
->SpinCount
== 0, "lpcrit->SpinCount=%ld\n", lpcrit
->SpinCount
);
31 //ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
32 if (lpcrit
->DebugInfo
)
34 ok(lpcrit
->DebugInfo
->Type
!= 0, "DebugInfo->Type=%d\n", lpcrit
->DebugInfo
->Type
);
35 ok(lpcrit
->DebugInfo
->CreatorBackTraceIndex
!= 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit
->DebugInfo
->CreatorBackTraceIndex
);
36 //ok(lpcrit->DebugInfo->EntryCount != 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
37 //ok(lpcrit->DebugInfo->ContentionCount != 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
40 /* test EngAcquireSemaphore and release it, then delete it */
41 hsem
= EngCreateSemaphore();
42 ok(hsem
!= NULL
, "EngCreateSemaphore failed\n");
44 lpcrit
= (PRTL_CRITICAL_SECTION
)hsem
;
46 EngAcquireSemaphore(hsem
);
47 EngReleaseSemaphore(hsem
);
48 EngDeleteSemaphore(hsem
);
50 //ok(lpcrit->LockCount > 0, "lpcrit->LockCount=%ld\n", lpcrit->LockCount);
51 ok(lpcrit
->RecursionCount
== 0, "lpcrit->RecursionCount=%ld\n", lpcrit
->RecursionCount
);
52 ok(lpcrit
->OwningThread
== 0, "lpcrit->OwningThread=%p\n", lpcrit
->OwningThread
);
53 ok(lpcrit
->LockSemaphore
== 0, "lpcrit->LockSemaphore=%p\n", lpcrit
->LockSemaphore
);
54 ok(lpcrit
->SpinCount
== 0, "lpcrit->SpinCount=%ld\n", lpcrit
->SpinCount
);
56 //ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
57 if (lpcrit
->DebugInfo
)
59 ok(lpcrit
->DebugInfo
->Type
!= 0, "DebugInfo->Type=%d\n", lpcrit
->DebugInfo
->Type
);
60 ok(lpcrit
->DebugInfo
->CreatorBackTraceIndex
!= 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit
->DebugInfo
->CreatorBackTraceIndex
);
61 //ok(lpcrit->DebugInfo->EntryCount != 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
62 //ok(lpcrit->DebugInfo->ContentionCount != 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
66 START_TEST(EngDeleteSemaphore
)
68 Test_EngDeleteSemaphore();