xref: /haiku/src/tests/kits/app/bmessage/MessageDoubleItemTest.h (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 //------------------------------------------------------------------------------
2 //	MessageDoubleItemTest.h
3 //
4 //------------------------------------------------------------------------------
5 
6 #ifndef MESSAGEDOUBLEITEMTEST_H
7 #define MESSAGEDOUBLEITEMTEST_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 	double,
25 	&BMessage::AddDouble,
26 	&BMessage::FindDouble,
27 	&BMessage::FindDouble,
28 	&BMessage::FindDouble,
29 	&BMessage::HasDouble,
30 	&BMessage::ReplaceDouble
31 >
32 TDoubleFuncPolicy;
33 
34 struct TDoubleInitPolicy : public ArrayTypeBase<double>
35 {
36 	inline static double Zero()	{ return 0; }
37 	inline static double Test1()	{ return 1.234; }
38 	inline static double Test2()	{ return 5.678; }
39 	inline static size_t SizeOf(const double&)	{ return sizeof (double); }
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 TDoubleAssertPolicy
51 {
52 	inline static double Zero()		{ return 0; }
53 	inline static double Invalid()	{ return 0; }
54 	inline static bool   Size(size_t size, double& d)
55 		{ return size == sizeof (d); }
56 };
57 
58 typedef TMessageItemTest
59 <
60 	double,
61 	B_DOUBLE_TYPE,
62 	TDoubleFuncPolicy,
63 	TDoubleInitPolicy,
64 	TDoubleAssertPolicy
65 >
66 TMessageDoubleItemTest;
67 
68 #endif	// MESSAGEDOUBLEITEMTEST_H
69 
70 /*
71  * $Log $
72  *
73  * $Id  $
74  *
75  */
76 
77