vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / app / bmessage / MessageBRectItemTest.h
blob7c51d84c7c944d7aed8778b19730e2ce2d236c3b
1 //------------------------------------------------------------------------------
2 // MessageBRectItemTest.h
3 //
4 //------------------------------------------------------------------------------
6 #ifndef MESSAGEBRECTITEMTEST_H
7 #define MESSAGEBRECTITEMTEST_H
9 // Standard Includes -----------------------------------------------------------
11 // System Includes -------------------------------------------------------------
13 // Project Includes ------------------------------------------------------------
15 // Local Includes --------------------------------------------------------------
16 #include "MessageItemTest.h"
18 // Local Defines ---------------------------------------------------------------
20 // Globals ---------------------------------------------------------------------
22 typedef TMessageItemFuncPolicy
24 BRect,
25 &BMessage::AddRect,
26 &BMessage::FindRect,
27 &BMessage::FindRect,
28 &BMessage::FindRect,
29 &BMessage::HasRect,
30 &BMessage::ReplaceRect
32 TBRectFuncPolicy;
34 struct TBRectInitPolicy : public ArrayTypeBase<BRect>
36 inline static BRect Zero() { return BRect(0, 0, 0, 0); }
37 inline static BRect Test1() { return BRect(1, 2, 3, 4); }
38 inline static BRect Test2() { return BRect(5, 6, 7, 8); }
39 inline static size_t SizeOf(const BRect&) { return sizeof (BRect); }
40 inline static ArrayType Array()
42 ArrayType array;
43 array.push_back(BRect(1, 2, 3, 4));
44 array.push_back(BRect(4, 5, 6, 7));
45 array.push_back(BRect(7, 8, 9, 10));
46 return array;
50 struct TBRectAssertPolicy
52 inline static BRect Zero() { return BRect(0, 0, 0, 0); }
53 inline static BRect Invalid() { return BRect(0, 0, -1, -1); }
54 inline static bool Size(size_t size, BRect& r)
55 { return size == sizeof (r); }
58 typedef TMessageItemTest
60 BRect,
61 B_RECT_TYPE,
62 TBRectFuncPolicy,
63 TBRectInitPolicy,
64 TBRectAssertPolicy
66 TMessageBRectItemTest;
68 std::ostream& operator<<(std::ostream& os, const BRect& rect)
70 int precision = os.precision();
71 os.precision(1);
72 os << "rect"
73 << "(l:" << rect.left
74 << " t:" << rect.top
75 << " r:" << rect.right
76 << " b:" << rect.bottom
77 << ")";
78 os.precision(precision);
80 return os;
83 #endif // MESSAGEBRECTITEMTEST_H
86 * $Log $
88 * $Id $