]> git.saurik.com Git - apple/xnu.git/blob - iokit/Tests/Tests.h
xnu-344.21.73.tar.gz
[apple/xnu.git] / iokit / Tests / Tests.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 #include <IOKit/IOLib.h>
26
27 #ifdef __cplusplus
28
29 #define logPrintf(x) \
30 do { \
31 kprintf x; \
32 } while (0)
33
34 #define verPrintf(x) logPrintf(x)
35
36 // Assumes 'bool res = true' in current scope
37 #define TEST_ASSERT(t, l, c) \
38 do { \
39 if ( !(c) ) { \
40 verPrintf(("TEST (%c) test %s failed\n", t, l)); \
41 res = false; \
42 } \
43 } while(0)
44
45 #define logSpace() do { } while(0)
46 #define checkPointSpace() ((void *) 0)
47 #define checkSpace(l, ckp, d) ((int) 1)
48
49 // In TestContainers.cc
50 extern const int numStrCache;
51 extern const char *strCache[];
52
53 extern void testString();
54 extern void testSymbol();
55 extern void testData();
56
57 // In TestCollections.cc
58 extern void testArray();
59 extern void testSet();
60 extern void testDictionary();
61 extern void testIterator();
62
63 // In TestDevice.cc
64 extern void testWorkLoop();
65
66 #include <libkern/c++/OSObject.h>
67
68 class IOWorkLoop;
69 class IOCommandQueue;
70 class IOInterruptEventSource;
71
72 class TestDevice;
73 typedef void (*TestDeviceAction)(TestDevice *, int, void *);
74
75 class TestDevice : public OSObject
76 {
77 OSDeclareDefaultStructors(TestDevice)
78
79 IOWorkLoop *workLoop;
80 int intCount;
81 IOCommandQueue *commQ;
82
83 public:
84 IOInterruptEventSource *intES;
85
86 virtual bool init();
87 virtual void free();
88
89 void rawCommandOccurred
90 (void *field0, void *field1, void *field2, void *field3);
91 kern_return_t enqueueCommand(bool sleep,
92 TestDeviceAction act, int tag, void *dataP);
93
94 void interruptAction(IOInterruptEventSource *event, int count);
95
96 void producer1Action(int tag);
97 void producer2Action(int tag, void *inCount);
98
99 void alarm();
100 };
101
102 #endif /* __cplusplus */