xref: /haiku/src/tests/kits/app/bmessage/MessageFloatItemTest.h (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
1 //------------------------------------------------------------------------------
2 //	MessageFloatItemTest.h
3 //
4 //------------------------------------------------------------------------------
5 
6 #ifndef MESSAGEFLOATITEMTEST_H
7 #define MESSAGEFLOATITEMTEST_H
8 
9 // Standard Includes -----------------------------------------------------------
10 
11 // System Includes -------------------------------------------------------------
12 
13 // Project Includes ------------------------------------------------------------
14 
15 // Local Includes --------------------------------------------------------------
16 #include "MessageItemTest.h"
17 
18 // Local Defines ---------------------------------------------------------------
19 
20 // Globals ---------------------------------------------------------------------
21 
22 typedef TMessageItemFuncPolicy
23 <
24 	float,
25 	&BMessage::AddFloat,
26 	&BMessage::FindFloat,
27 	&BMessage::FindFloat,
28 	&BMessage::FindFloat,
29 	&BMessage::HasFloat,
30 	&BMessage::ReplaceFloat
31 >
32 TFloatFuncPolicy;
33 
34 struct TFloatInitPolicy : public ArrayTypeBase<float>
35 {
36 	inline static float Zero()	{ return 0; }
37 	inline static float Test1()	{ return 1.234; }
38 	inline static float Test2()	{ return 5.678; }
39 	inline static size_t SizeOf(const float&)	{ return sizeof (float); }
40 	inline static ArrayType Array()
41 	{
42 		ArrayType array;
43 		array.push_back(1.23);
44 		array.push_back(4.56);
45 		array.push_back(7.89);
46 		return array;
47 	}
48 };
49 
50 struct TFloatAssertPolicy
51 {
52 	inline static float Zero()		{ return 0; }
53 	inline static float Invalid()	{ return 0; }
54 	inline static bool  Size(size_t size, float& f)
55 		{ return size == sizeof (f); }
56 };
57 
58 typedef TMessageItemTest
59 <
60 	float,
61 	B_FLOAT_TYPE,
62 	TFloatFuncPolicy,
63 	TFloatInitPolicy,
64 	TFloatAssertPolicy
65 >
66 TMessageFloatItemTest;
67 
68 
69 #endif	// MESSAGEFLOATITEMTEST_H
70 
71 /*
72  * $Log $
73  *
74  * $Id  $
75  *
76  */
77 
78