dimanche 24 janvier 2016

Cpp unit testing for unordered_map

I am a beginner with cppunit testing framework and have to test an unordered_map. Here is the code for the same:

//This is Manager.hpp file: 
typedef size_t BDD_ID;  
class Manager {
  private:
        typedef struct  {
            BDD_ID bdd_id;
            string label;
            BDD_ID top; 
            BDD_ID high;
            BDD_ID low;
        }Node;  
        unordered_map<BDD_ID, Node> Unique_Table;
//This is ManagerTest.hpp file:
class ManagerTest : public TestFixture
{
    CPPUNIT_TEST_SUITE(ManagerTest);
    CPPUNIT_TEST_SUITE_END ();
private:
    Manager s1;
    unordered_map<BDD_ID, Node> Unique_table;//--> Is this declaration right???
};

Also, how to access what is stored in it? For eg: if i want to know, what is stored at high at 2nd i.e. high[2], how do I call this? Is it s1.Unique_Table.high.(2)?? Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire