Add tests for unflattening data in big endian format.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@851 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
jrand 2002-08-22 03:15:35 +00:00
parent 810bdfb6a4
commit 310f8ec314
8 changed files with 238 additions and 35 deletions

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyConstructionTest.cpp,v 1.2 2002/08/18 04:14:22 jrand Exp $
$Id: PropertyConstructionTest.cpp,v 1.3 2002/08/22 03:15:35 jrand Exp $
This file implements the construction test for the OpenBeOS BPropertyInfo
code. This class tests the following usecases:
@ -166,7 +166,8 @@
int32 prop_count,
int32 value_count,
ssize_t flat_size,
const char *flat_data)
const char *lflat_data,
const char *bflat_data)
{
assert(propTest->CountProperties() == prop_count);
assert(propTest->CountValues() == value_count);

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyConstructionTest.h,v 1.1 2002/08/18 03:44:21 jrand Exp $
$Id: PropertyConstructionTest.h,v 1.2 2002/08/22 03:15:35 jrand Exp $
This file defines a class for performing one test of BPropertyInfo
functionality.
@ -33,7 +33,8 @@ protected:
int32 prop_count,
int32 value_count,
ssize_t flat_size,
const char *flat_data);
const char *lflat_data,
const char *bflat_data);
public:
static Test *suite(void);

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyFindMatchTest.cpp,v 1.2 2002/08/18 04:14:22 jrand Exp $
$Id: PropertyFindMatchTest.cpp,v 1.3 2002/08/22 03:15:35 jrand Exp $
This file implements the FindMatch test for the OpenBeOS BPropertyInfo
code. This class tests the following usecases:
@ -48,7 +48,8 @@
int32 prop_count,
int32 value_count,
ssize_t flat_size,
const char *flat_data)
const char *lflat_data,
const char *bflat_data)
{
const uint32 *commands;
const uint32 *specifiers;

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyFindMatchTest.h,v 1.1 2002/08/18 03:44:21 jrand Exp $
$Id: PropertyFindMatchTest.h,v 1.2 2002/08/22 03:15:35 jrand Exp $
This file defines a class for performing one test of BPropertyInfo
functionality.
@ -33,7 +33,8 @@ protected:
int32 prop_count,
int32 value_count,
ssize_t flat_size,
const char *flat_data);
const char *lflat_data,
const char *bflat_data);
public:
static Test *suite(void);

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyFlattenTest.cpp,v 1.2 2002/08/18 04:14:22 jrand Exp $
$Id: PropertyFlattenTest.cpp,v 1.3 2002/08/22 03:15:35 jrand Exp $
This file implements the flatten test for the OpenBeOS BPropertyInfo code.
This class tests the following usecases:
@ -13,6 +13,7 @@
#include "PropertyFlattenTest.h"
#include <ByteOrder.h>
/*
@ -48,7 +49,8 @@
int32 prop_count,
int32 value_count,
ssize_t flat_size,
const char *flat_data)
const char *lflat_data,
const char *bflat_data)
{
char buffer[768];
@ -58,8 +60,12 @@
assert(!propTest->AllowsTypeCode(B_TIME_TYPE));
assert(propTest->FlattenedSize() == flat_size);
assert(propTest->Flatten(buffer, sizeof(buffer)/ sizeof(buffer[0])) == B_OK);
assert(memcmp(buffer, flat_data, propTest->FlattenedSize()) == 0);
if (B_HOST_IS_BENDIAN) {
assert(memcmp(buffer, bflat_data, propTest->FlattenedSize()) == 0);
} else {
assert(memcmp(buffer, lflat_data, propTest->FlattenedSize()) == 0);
}
}
/*

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyFlattenTest.h,v 1.1 2002/08/18 03:44:21 jrand Exp $
$Id: PropertyFlattenTest.h,v 1.2 2002/08/22 03:15:35 jrand Exp $
This file defines a class for performing one test of BPropertyInfo
functionality.
@ -25,7 +25,8 @@ protected:
int32 prop_count,
int32 value_count,
ssize_t flat_size,
const char *flat_data);
const char *lflat_data,
const char *bflat_data);
public:
static Test *suite(void);

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyTestcase.cpp,v 1.1 2002/08/18 03:44:21 jrand Exp $
$Id: PropertyTestcase.cpp,v 1.2 2002/08/22 03:15:35 jrand Exp $
This file implements the first test for the OpenBeOS BPropertyInfo code.
It tests the Construction use cases. It does so by doing the following:
@ -132,7 +132,7 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
/*
* Method: PropertyTestcase::PerformTest()
* Descr: This member function creates 27 different BPropertyInfo
* Descr: This member function creates 36 different BPropertyInfo
* instances and then passes each of them to TestProperty().
* The actual instances are:
* - NULL property_info, NULL value_info
@ -144,11 +144,14 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
* - sample property_info, NULL value_info
* - sample property_info, empty value_info
* - sample property_info, sample value_info
* Each of these are created in three different ways:
* Each of these are created in four different ways:
* - one where each structure is statically allocated
* - one where each structure is dynamically allocated
* - one where the BPropertyInfo is unflattened
* This results in 27 different combinations to perform tests
* - one where the BPropertyInfo is unflattened from little
* endian data (generated from BeOS R5 running on Intel)
* - one where the BPropertyInfo is unflattened from big
* endian data (generated from BeOS R5 running on a BeBox)
* This results in 36 different combinations to perform tests
* on.
*/
@ -161,7 +164,8 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
int prop_count;
int value_count;
int flat_size;
char flat_data[768];
char lflat_data[768];
char bflat_data[768];
} property_tests;
struct property_info prop1[] = { 0 };
@ -205,12 +209,14 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
0 // terminate list
};
property_tests theTests[] = {
static property_tests theTests[] = {
{ NULL, NULL, 0, 0, 9,
{0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0}
{0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1}
},
{ NULL, value1, 0, 0, 11,
{0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0}
{0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0}
},
{ NULL, value2, 0, 2, 85,
{0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0,
@ -220,13 +226,23 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
0x1, 0x0, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x32, 0x0, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x1,
0x0, 0x0, 0x0}
0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x2, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31,
0x0, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
0x65, 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x6, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x32, 0x0, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x0,
0x0, 0x0, 0x1}
},
{ prop1, NULL, 0, 0, 9,
{0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0}
{0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1}
},
{ prop1, value1, 0, 0, 11,
{0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0}
{0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0}
},
{ prop1, value2, 0, 2, 85,
{0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0,
@ -236,7 +252,15 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
0x1, 0x0, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x32, 0x0, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x1,
0x0, 0x0, 0x0}
0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x2, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31,
0x0, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
0x65, 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x6, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x32, 0x0, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x0,
0x0, 0x0, 0x1}
},
{ prop2, NULL, 4, 0, 570,
{0x0, 0x4, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x74, 0x65, 0x73,
@ -286,7 +310,57 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
0x0, 0x0, 0x0, 0x63, 0x74, 0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, 0x65, 0x31, 0x31, 0x0, 0x0, 0x0, 0x0, 0xb,
0x63, 0x74, 0x79, 0x70, 0x65, 0x31, 0x32, 0x0, 0x0, 0x0, 0x0,
0xc, 0x63, 0x74, 0x79, 0x70, 0x65, 0x31, 0x33, 0x0, 0x0, 0x0,
0x0, 0xd, 0x63, 0x74, 0x79, 0x70, 0x65, 0x31, 0x34, 0x0, 0x0,
0x0, 0x0, 0xe, 0x63, 0x74, 0x79, 0x70, 0x65, 0x31, 0x35, 0x0,
0x0, 0x0, 0x0, 0xf, 0x0, 0x0, 0x0, 0x0, 0x63, 0x74, 0x79, 0x70,
0x65, 0x32, 0x31, 0x0, 0x0, 0x0, 0x0, 0x15, 0x63, 0x74, 0x79,
0x70, 0x65, 0x32, 0x32, 0x0, 0x0, 0x0, 0x0, 0x16, 0x63, 0x74,
0x79, 0x70, 0x65, 0x32, 0x33, 0x0, 0x0, 0x0, 0x0, 0x17, 0x63,
0x74, 0x79, 0x70, 0x65, 0x32, 0x34, 0x0, 0x0, 0x0, 0x0, 0x18,
0x63, 0x74, 0x79, 0x70, 0x65, 0x32, 0x35, 0x0, 0x0, 0x0, 0x0,
0x19, 0x0, 0x0, 0x0, 0x0, 0x63, 0x74, 0x79, 0x70, 0x65, 0x33,
0x31, 0x0, 0x0, 0x0, 0x0, 0x1f, 0x63, 0x74, 0x79, 0x70, 0x65,
0x33, 0x32, 0x0, 0x0, 0x0, 0x0, 0x20, 0x63, 0x74, 0x79, 0x70,
0x65, 0x33, 0x33, 0x0, 0x0, 0x0, 0x0, 0x21, 0x63, 0x74, 0x79,
0x70, 0x65, 0x33, 0x34, 0x0, 0x0, 0x0, 0x0, 0x22, 0x63, 0x74,
0x79, 0x70, 0x65, 0x33, 0x35, 0x0, 0x0, 0x0, 0x0, 0x23, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0}
},
{ prop2, value1, 4, 0, 572,
{0x0, 0x4, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x74, 0x65, 0x73, 0x74,
@ -336,7 +410,56 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
0x63, 0x74, 0x79, 0x70, 0x65, 0x33, 0x35, 0x0, 0x23, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x3, 0x74, 0x65, 0x73,
0x74, 0x31, 0x0, 0x74, 0x65, 0x73, 0x74, 0x31, 0x3a, 0x20, 0x54,
0x65, 0x73, 0x74, 0x20, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x5f, 0x69,
0x6e, 0x66, 0x6f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50, 0x47, 0x45, 0x54,
0x50, 0x53, 0x45, 0x54, 0x50, 0x45, 0x58, 0x45, 0x50, 0x44, 0x45,
0x4c, 0x50, 0x43, 0x52, 0x54, 0x50, 0x43, 0x4e, 0x54, 0x0, 0x0,
0x0, 0x7, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0,
0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x6,
0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x3, 0x0,
0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0,
0x0, 0x9, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x0, 0x74, 0x65,
0x73, 0x74, 0x32, 0x0, 0x74, 0x65, 0x73, 0x74, 0x32, 0x3a, 0x20,
0x54, 0x65, 0x73, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61,
0x72, 0x64, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x0,
0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0,
0x0, 0x0, 0x0, 0x74, 0x65, 0x73, 0x74, 0x33, 0x0, 0x74, 0x65,
0x73, 0x74, 0x33, 0x3a, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x77,
0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x20, 0x73, 0x70, 0x65,
0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x0, 0x0, 0x0, 0x0, 0x2, 0x50,
0x47, 0x45, 0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x74,
0x65, 0x73, 0x74, 0x34, 0x0, 0x74, 0x65, 0x73, 0x74, 0x34, 0x3a,
0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x64, 0x63,
0x61, 0x72, 0x64, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66,
0x69, 0x65, 0x72, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0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 0x74, 0x79, 0x70, 0x65, 0x33, 0x34, 0x0, 0x0, 0x0, 0x0,
0x22, 0x63, 0x74, 0x79, 0x70, 0x65, 0x33, 0x35, 0x0, 0x0, 0x0,
0x0, 0x23, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
},
{ prop2, value2, 4, 2, 646,
{0x0, 0x4, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x74, 0x65, 0x73, 0x74,
@ -392,7 +515,63 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
0x73, 0x61, 0x67, 0x65, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
0x6, 0x0, 0x0, 0x0, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x0, 0x54,
0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20,
0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x1, 0x0, 0x0, 0x0}
0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x1, 0x0, 0x0, 0x0},
{0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x3, 0x74, 0x65, 0x73,
0x74, 0x31, 0x0, 0x74, 0x65, 0x73, 0x74, 0x31, 0x3a, 0x20, 0x54,
0x65, 0x73, 0x74, 0x20, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x5f, 0x69,
0x6e, 0x66, 0x6f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50, 0x47, 0x45, 0x54,
0x50, 0x53, 0x45, 0x54, 0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32, 0x35,
0x0, 0x0, 0x0, 0x0, 0x19, 0x0, 0x0, 0x0, 0x0, 0x63, 0x74, 0x79,
0x70, 0x65, 0x33, 0x31, 0x0, 0x0, 0x0, 0x0, 0x1f, 0x63, 0x74,
0x79, 0x70, 0x65, 0x33, 0x32, 0x0, 0x0, 0x0, 0x0, 0x20, 0x63,
0x74, 0x79, 0x70, 0x65, 0x33, 0x33, 0x0, 0x0, 0x0, 0x0, 0x21,
0x63, 0x74, 0x79, 0x70, 0x65, 0x33, 0x34, 0x0, 0x0, 0x0, 0x0,
0x22, 0x63, 0x74, 0x79, 0x70, 0x65, 0x33, 0x35, 0x0, 0x0, 0x0,
0x0, 0x23, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x5, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x0,
0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65,
0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x6, 0x56, 0x61, 0x6c, 0x75, 0x65,
0x32, 0x0, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74,
0x68, 0x65, 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, 0x0, 0x0, 0x0,
0x0, 0x1}
}
};
int i;
@ -404,7 +583,8 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
propTest = new BPropertyInfo(theTests[i].props, theTests[i].values);
TestProperty(propTest, theTests[i].props, theTests[i].values,
theTests[i].prop_count, theTests[i].value_count,
theTests[i].flat_size, theTests[i].flat_data);
theTests[i].flat_size, theTests[i].lflat_data,
theTests[i].bflat_data);
delete propTest;
propPtr = DuplicateProperties(theTests[i].props, theTests[i].prop_count);
@ -412,15 +592,26 @@ const uint32 PropertyTestcase::wildcardSpecifierTests[] = { uniqueSpecifier,
propTest = new BPropertyInfo(propPtr, valuePtr, true);
TestProperty(propTest, theTests[i].props, theTests[i].values,
theTests[i].prop_count, theTests[i].value_count,
theTests[i].flat_size, theTests[i].flat_data);
theTests[i].flat_size, theTests[i].lflat_data,
theTests[i].bflat_data);
delete propTest;
propTest = new BPropertyInfo;
assert(propTest->Unflatten(B_PROPERTY_INFO_TYPE, theTests[i].flat_data,
assert(propTest->Unflatten(B_PROPERTY_INFO_TYPE, theTests[i].lflat_data,
theTests[i].flat_size) == B_OK);
TestProperty(propTest, theTests[i].props, theTests[i].values,
theTests[i].prop_count, theTests[i].value_count,
theTests[i].flat_size, theTests[i].flat_data);
theTests[i].flat_size, theTests[i].lflat_data,
theTests[i].bflat_data);
delete propTest;
propTest = new BPropertyInfo;
assert(propTest->Unflatten(B_PROPERTY_INFO_TYPE, theTests[i].bflat_data,
theTests[i].flat_size) == B_OK);
TestProperty(propTest, theTests[i].props, theTests[i].values,
theTests[i].prop_count, theTests[i].value_count,
theTests[i].flat_size, theTests[i].lflat_data,
theTests[i].bflat_data);
delete propTest;
}
}

View File

@ -1,5 +1,5 @@
/*
$Id: PropertyTestcase.h,v 1.1 2002/08/18 03:44:21 jrand Exp $
$Id: PropertyTestcase.h,v 1.2 2002/08/22 03:15:35 jrand Exp $
This file defines a base class for performing all tests of BPropertyInfo
functionality.
@ -29,7 +29,8 @@ protected:
int32 prop_count,
int32 value_count,
ssize_t flat_size,
const char *flat_data) = 0;
const char *lflat_data,
const char *bflat_data) = 0;
static const char *uniquePropName;
static const uint32 uniqueCommand;