It is ok, but I would create that object in the testing class, rather then in the global scope (like explained in Test Fixtures: Using the Same Data Configuration for Multiple Tests).
For example, like this :
initData CreateData()
{
initData d;
// set values
return d;
}
class testFamily : public testing::Test
{
public:
testFamily() :
data( CreateData() )
{
}
~testFamily()
{
}
initData data;
};
TEST_F( testFamily, specificTest )
{
ASSERT_TRUE(boolean_algorithm(data));
}
Now, the data structure is calculated (or set) only in one place (CreateData()
function).