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