xref: /haiku/src/tests/kits/app/bmessagerunner/BMessageRunnerCases (revision e439adc551049dce21e24e7a7039cebe295e989b)
1dace24c6SIngo WeinholdBMessageRunner(BMessenger target, const BMessage *message, bigtime_t interval,
2dace24c6SIngo Weinhold			   int32 count)
3dace24c6SIngo Weinholdcase 1:	target is invalid, message is valid, interval > 0, count > 0 =>
4dace24c6SIngo Weinhold		InitCheck() should return B_OK. The message runner turns to unusable
5dace24c6SIngo Weinhold		as soon as the first message had to be sent.
6dace24c6SIngo Weinhold		GetInfo() should return B_OK.
7dace24c6SIngo Weinholdcase 2:	target is valid, message is NULL, interval > 0, count > 0 =>
8dace24c6SIngo Weinhold		InitCheck() should return B_BAD_VALUE.
9dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
10dace24c6SIngo Weinholdcase 3:	target is valid, message is valid, interval == 0, count > 0 =>
11dace24c6SIngo Weinhold		R5: InitCheck() should return B_ERROR.
12dace24c6SIngo Weinhold			GetInfo() should return B_BAD_VALUE.
13dace24c6SIngo Weinhold		OBOS: InitCheck() should return B_OK.
14dace24c6SIngo Weinhold			  GetInfo() should return B_OK.
15dace24c6SIngo Weinhold			  A minimal time interval is used (50000).
16dace24c6SIngo Weinholdcase 4:	target is valid, message is valid, interval < 0, count > 0 =>
17dace24c6SIngo Weinhold		InitCheck() should return B_OK.
18dace24c6SIngo Weinhold		GetInfo() should return B_OK.
19dace24c6SIngo Weinhold		A minimal time interval is used (50000).
20dace24c6SIngo Weinholdcase 5:	target is valid, message is valid, interval == LONGLONG_MAX,
21dace24c6SIngo Weinhold		count > 0 =>
22dace24c6SIngo Weinhold		InitCheck() should return B_OK.
23dace24c6SIngo Weinhold		GetInfo() should return B_OK.
24dace24c6SIngo Weinhold		No message should be delivered.
25dace24c6SIngo Weinholdcase 6:	target is valid, message is valid, interval > 0, count == 0 =>
26dace24c6SIngo Weinhold		InitCheck() should return B_ERROR.
27dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
28dace24c6SIngo Weinholdcase 7:	target is valid, message is valid, interval > 0, count < 0 =>
29dace24c6SIngo Weinhold		InitCheck() should return B_OK.
30dace24c6SIngo Weinhold		GetInfo() should return B_OK.
31dace24c6SIngo Weinhold		Unlimited number of messages.
32dace24c6SIngo Weinholdcase 8:	target is valid, message is valid, interval > 0, count > 0 =>
33dace24c6SIngo Weinhold		InitCheck() should return B_OK.
34dace24c6SIngo Weinhold		GetInfo() should return B_OK.
35dace24c6SIngo Weinhold		count messages are sent.
36dace24c6SIngo Weinhold
37dace24c6SIngo WeinholdBMessageRunner(BMessenger target, const BMessage *message,
38dace24c6SIngo Weinhold			   bigtime_t interval, int32 count, BMessenger replyTo)
39dace24c6SIngo Weinholdcases 1-8 from first constructor
40dace24c6SIngo Weinholdcase 9:	target is valid, message is valid, interval > 0, count > 0,
41dace24c6SIngo Weinhold		replyTo is invalid =>
42dace24c6SIngo Weinhold		InitCheck() should return B_OK.
43dace24c6SIngo Weinhold		GetInfo() should return B_OK.
44dace24c6SIngo Weinhold		count messages are sent. The replies go to the registrar!
45dace24c6SIngo Weinholdcase 10:target is valid, message is valid, interval > 0, count > 0,
46dace24c6SIngo Weinhold		replyTo targets a different handler than be_app_messenger =>
47dace24c6SIngo Weinhold		InitCheck() should return B_OK.
48dace24c6SIngo Weinhold		GetInfo() should return B_OK.
49dace24c6SIngo Weinhold		count messages are sent. The replies go to the handler.
50dace24c6SIngo Weinhold
51dace24c6SIngo Weinholdstatus_t SetInterval(bigtime_t interval)
52dace24c6SIngo Weinholdcase 1:	object is not properly initialized, interval > 0 =>
53dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
54dace24c6SIngo Weinhold		InitCheck() should return B_ERROR.
55dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
56dace24c6SIngo Weinholdcase 2:	object was properly initialized, but has already delivered all its
57dace24c6SIngo Weinhold		messages and thus became unusable, interval > 0 =>
58dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
59dace24c6SIngo Weinhold		InitCheck() should return B_OK.
60dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
61dace24c6SIngo Weinholdcase 3:	object is properly initialized and has still one message to deliver,
62dace24c6SIngo Weinhold		interval > 0 =>
63dace24c6SIngo Weinhold		Should return B_OK.
64dace24c6SIngo Weinhold		InitCheck() should return B_OK.
65dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new interval.
66dace24c6SIngo Weinhold		The timer is reset. The last message arives after the time specified
67dace24c6SIngo Weinhold		by interval has passed.
68dace24c6SIngo Weinholdcase 4:	object is properly initialized and has still some messages to deliver,
69dace24c6SIngo Weinhold		interval > 0 =>
70dace24c6SIngo Weinhold		Should return B_OK.
71dace24c6SIngo Weinhold		InitCheck() should return B_OK.
72dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new interval.
73dace24c6SIngo Weinhold		The timer is reset. The messages start to arive after the time
74dace24c6SIngo Weinhold		specified by interval.
75dace24c6SIngo Weinholdcase 5:	object is properly initialized and has still an unlimited number of
76dace24c6SIngo Weinhold		messages to deliver, interval > 0 =>
77dace24c6SIngo Weinhold		Should return B_OK.
78dace24c6SIngo Weinhold		InitCheck() should return B_OK.
79dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new interval.
80dace24c6SIngo Weinhold		The timer is reset. The messages start to arive after the time
81dace24c6SIngo Weinhold		specified by interval.
82dace24c6SIngo Weinholdcase 6:	object is properly initialized and has still some messages to deliver,
83dace24c6SIngo Weinhold		interval == 0 =>
84dace24c6SIngo Weinhold		Should return B_OK.
85dace24c6SIngo Weinhold		InitCheck() should return B_OK.
86dace24c6SIngo Weinhold		R5: GetInfo() should return B_BAD_VALUE.
87dace24c6SIngo Weinhold			All messages are delivered, but at weird times.
88dace24c6SIngo Weinhold		OBOS: GetInfo() should return B_OK and the minimal interval.
89dace24c6SIngo Weinhold			  The timer is reset. The messages start to arive after the time
90dace24c6SIngo Weinhold			  specified by the minimal interval.
91dace24c6SIngo Weinholdcase 7:	object is properly initialized and has still some messages to deliver,
92dace24c6SIngo Weinhold		interval < 0 =>
93dace24c6SIngo Weinhold		Should return B_OK.
94dace24c6SIngo Weinhold		InitCheck() should return B_OK.
95dace24c6SIngo Weinhold		R5: GetInfo() should return B_BAD_VALUE.
96dace24c6SIngo Weinhold			All messages are delivered, but at weird times.
97dace24c6SIngo Weinhold		OBOS: GetInfo() should return B_OK and the minimal interval.
98dace24c6SIngo Weinhold			  The timer is reset. The messages start to arive after the time
99dace24c6SIngo Weinhold			  specified by the minimal interval.
100dace24c6SIngo Weinhold
101dace24c6SIngo Weinholdstatus_t SetCount(int32 count)
102dace24c6SIngo Weinholdcase 1:	object is not properly initialized, count > 0 =>
103dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
104dace24c6SIngo Weinhold		InitCheck() should return B_ERROR.
105dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
106dace24c6SIngo Weinholdcase 2:	object was properly initialized, but has already delivered all its
107dace24c6SIngo Weinhold		messages and thus became unusable, count > 0 =>
108dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
109dace24c6SIngo Weinhold		InitCheck() should return B_OK.
110dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
111dace24c6SIngo Weinholdcase 3:	object is properly initialized and has still one message to deliver,
112dace24c6SIngo Weinhold		count > 0 =>
113dace24c6SIngo Weinhold		Should return B_OK.
114dace24c6SIngo Weinhold		InitCheck() should return B_OK.
115dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
116dace24c6SIngo Weinhold		The timer is NOT reset. count messages should arrive.
117dace24c6SIngo Weinholdcase 4:	object is properly initialized and has still some messages to deliver,
118dace24c6SIngo Weinhold		count > 0 =>
119dace24c6SIngo Weinhold		Should return B_OK.
120dace24c6SIngo Weinhold		InitCheck() should return B_OK.
121dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
122dace24c6SIngo Weinhold		The timer is NOT reset. count messages should arrive.
123dace24c6SIngo Weinholdcase 5:	object is properly initialized and has still an unlimited number of
124dace24c6SIngo Weinhold		messages to deliver, count > 0 =>
125dace24c6SIngo Weinhold		Should return B_OK.
126dace24c6SIngo Weinhold		InitCheck() should return B_OK.
127dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
128dace24c6SIngo Weinhold		The timer is NOT reset. count messages should arrive.
129dace24c6SIngo Weinholdcase 6:	object is properly initialized and has still some messages to deliver,
130dace24c6SIngo Weinhold		count == 0 =>
131dace24c6SIngo Weinhold		Should return B_OK.
132dace24c6SIngo Weinhold		InitCheck() should return B_OK.
133dace24c6SIngo Weinhold		R5: GetInfo() should return B_OK and count 0!
134dace24c6SIngo Weinhold			The timer is NOT reset and a message arives after the time specified
135dace24c6SIngo Weinhold			by the interval!
136dace24c6SIngo Weinhold		OBOS: GetInfo() should return B_BAD_VALUE.
137dace24c6SIngo Weinholdcase 7:	object is properly initialized and has still some messages to deliver,
138dace24c6SIngo Weinhold		count < 0 =>
139dace24c6SIngo Weinhold		Should return B_OK.
140dace24c6SIngo Weinhold		InitCheck() should return B_OK.
141dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
142dace24c6SIngo Weinhold		The timer is NOT reset. Unlimited number of messages.
143*e439adc5SIngo Weinhold
144*e439adc5SIngo Weinholdstatus_t GetInfo(bigtime_t *interval, int32 *count) const
145*e439adc5SIngo Weinholdcase 1:	object is properly initialized, interval or count are NULL =>
146*e439adc5SIngo Weinhold		Should return B_OK.
147*e439adc5SIngo Weinhold		InitCheck() should return B_OK.
148*e439adc5SIngo Weinholdcase 2:	object is not properly initialized, interval or count are NULL =>
149*e439adc5SIngo Weinhold		Should return B_BAD_VALUE.
150*e439adc5SIngo Weinhold		InitCheck() should return B_ERROR.
151*e439adc5SIngo WeinholdOther cases are side effects of other methods' tests.
152*e439adc5SIngo Weinhold
153