2 $Id: PropertyFlattenTest.cpp 1218 2002-09-28 00:19:49Z shatty $
4 This file implements the flatten test for the OpenBeOS BPropertyInfo code.
5 This class tests the following usecases:
15 #include "PropertyFlattenTest.h"
19 #include <ByteOrder.h>
23 * Method: PropertyFlattenTest::PropertyFlattenTest()
24 * Descr: This is the constructor for this class.
27 PropertyFlattenTest::PropertyFlattenTest(std::string name
) :
28 PropertyTestcase(name
)
34 * Method: PropertyFlattenTest::~PropertyFlattenTest()
35 * Descr: This is the destructor for this class.
38 PropertyFlattenTest::~PropertyFlattenTest()
44 * Method: PropertyFlattenTest::TestProperty()
45 * Descr: This member function performs this test.
48 void PropertyFlattenTest::TestProperty(
49 BPropertyInfo
*propTest
,
50 const property_info
*prop_list
,
51 const value_info
*value_list
,
55 const char *lflat_data
,
56 const char *bflat_data
)
60 assert(!propTest
->IsFixedSize());
61 assert(propTest
->TypeCode() == B_PROPERTY_INFO_TYPE
);
62 assert(propTest
->AllowsTypeCode(B_PROPERTY_INFO_TYPE
));
63 assert(!propTest
->AllowsTypeCode(B_TIME_TYPE
));
64 assert(propTest
->FlattenedSize() == flat_size
);
65 assert(propTest
->Flatten(buffer
, sizeof(buffer
)/ sizeof(buffer
[0])) == B_OK
);
66 if (B_HOST_IS_BENDIAN
) {
67 assert(memcmp(buffer
, bflat_data
, propTest
->FlattenedSize()) == 0);
69 assert(memcmp(buffer
, lflat_data
, propTest
->FlattenedSize()) == 0);
75 * Method: PropertyFlattenTest::suite()
76 * Descr: This static member function returns a test caller for performing
77 * all combinations of "PropertyFlattenTest".
80 Test
*PropertyFlattenTest::suite(void)
82 typedef CppUnit::TestCaller
<PropertyFlattenTest
>
83 PropertyFlattenTestCaller
;
85 return(new PropertyFlattenTestCaller("BPropertyInfo::Flatten Test", &PropertyFlattenTest::PerformTest
));