mardi 28 mars 2017

Design for following situation having gtest procedure

In my current implementation i have 2 files (i am stuck and not getting any further)

//firstFile.cpp
class first
{
    //some object of xyz class
};

first f;  //global

TEST(Suite, Testcase
{
//do something
}



//secondFile.cpp
class second
{
public:
//some data members

void function()
}

Task :- I want to call TEST (consider it a special function, when it is called, object of first (i.e. global object defined will be created). In test i want to save some data for latter processing, which obviously i can't do in first class as it will be initialized on every TEST call.

Problem :- I though of having a separate class (in another .cpp file) which have required data structure to be saved. I want a way to access those data structure in TEST procedure and keep on adding the data over previous data with every TEST call. I can't have an object for second class in firstFile.cpp as it will also be created/destroyed on every call.

Any suggestion? Also i can't do anything about TEST procdedure, this is the way it is.

Aucun commentaire:

Enregistrer un commentaire