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