Exemplo n.º 1
0
void TestSchemaEvolution::loopOnDataMembers(TClass *tcl) {
  TList *dms = tcl->GetListOfDataMembers();
  TIter next(dms);
  while (TObject *obj = next()) {
    TClass *cl = TClass::GetClass(((TDataMember *)obj)->GetFullTypeName());
    if (cl && cl->HasDictionary()) {
      unique_classes_.insert(std::make_pair(cl->GetName(), cl->GetClassVersion()));
      analyseClass(cl);
    }
  }
}
Exemplo n.º 2
0
void TestSchemaEvolution::loopOnBases(TClass *tcl) {
  TList *bases = tcl->GetListOfBases();
  TIter next(bases);
  while (TObject *obj = next()) {
    TClass *cl = TClass::GetClass(obj->GetName());
    if (cl && cl->HasDictionary()) {
      unique_classes_.insert(std::make_pair(cl->GetName(), cl->GetClassVersion()));
      analyseClass(cl);
    }
  }
}
Exemplo n.º 3
0
int runGetMissingDictionaries()
{
   // Method to assert the dictionaries.

   TClass* myClass = TClass::GetClass("TestClass");
   if (myClass->HasDictionary())
      Error("TClass::HasDictionary", "The class %s does not have a dictionary.", "TestClass");

   THashTable expectedResult;
   // Hard coded expected results.
   expectedResult.Add(TClass::GetClass("NoDictClass"));
   expectedResult.Add(TClass::GetClass("TestClass"));
   expectedResult.Add(TClass::GetClass("MemberHidden"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<NoDictClass*> >"));
   expectedResult.Add(TClass::GetClass("Tmplt<int>"));
   expectedResult.Add(TClass::GetClass("Member"));
   expectedResult.Add(TClass::GetClass("Tmplt<Member>"));
   expectedResult.Add(TClass::GetClass("Tmplt<Base>"));
   expectedResult.Add(TClass::GetClass("Outer<Double32_t>"));
   expectedResult.Add(TClass::GetClass("Tmplt<TmpParam>"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<TmpTmpParam> >"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<Tmplt<ExtraTmp> > >"));
   expectedResult.Add(TClass::GetClass("ParamList<ParamL1,ParamL2>"));
   expectedResult.Add(TClass::GetClass("TypedefExample"));
   expectedResult.Add(TClass::GetClass("BasicTests::TestAll"));

   cerr<<"No recursion:"<<endl; // Write on the same stream of the errors below
   THashTable missingDictClassesNoRecursion;
   // Assert GetMissingDictionaries without recursion.
   myClass->GetMissingDictionaries(missingDictClassesNoRecursion, false);
   //missingDictClassesNoRecursion.Print();
   if (!missingDictClassesNoRecursion.IsEmpty()) {
      if (missingDictClassesNoRecursion.GetEntries() != expectedResult.GetEntries()) {
         Error("TClass::GetMissingClassDictionaries", "The set of classes with missing dictionaries does not contain the correct number of elements (expected: %d got %d).",expectedResult.GetEntries(),missingDictClassesNoRecursion.GetEntries());
      }
      TIterator* it = missingDictClassesNoRecursion.MakeIterator();
      TClass* cl = 0;
      while ((cl = (TClass*)it->Next())) {
         if (!expectedResult.FindObject(cl)) {
            Error("TCling::GetMissingDictionaries", "Class %s is not in the expected set.", cl->GetName());
         }
      }
      it = expectedResult.MakeIterator();
      while ((cl = (TClass*)it->Next())) {
         if (!missingDictClassesNoRecursion.FindObject(cl)) {
            Error("TCling::GetMissingDictionaries", "Class %s with no dictionaries is not in the set.", cl->GetName());
         }
      }
   } else {
      Error("TClass::GetMissingClassDictionaries", "The set of missing classes is not created");
   }


   // Assert GetMissingDictionaries with recursion.
   // Hard code expected results with recursion.
   expectedResult.Add(TClass::GetClass("ArrayTry"));
   expectedResult.Add(TClass::GetClass("NoA"));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<NoDictClass*> >"));
   expectedResult.Add(TClass::GetClass("Tmplt<NoDictClass*>"));
   expectedResult.Add(TClass::GetClass("vector<Member>"));
   expectedResult.Add(TClass::GetClass("Base"));
   expectedResult.Add(TClass::GetClass("vector<Base>"));
   expectedResult.Add(TClass::GetClass("Inner<Double32_t>"));
   expectedResult.Add(TClass::GetClass("TmpParam"));
   expectedResult.Add(TClass::GetClass("TmpTmpParam"));
   expectedResult.Add(TClass::GetClass("Tmplt<TmpTmpParam>"));
   expectedResult.Add(TClass::GetClass("ExtraTmp"));
   expectedResult.Add(TClass::GetClass("Tmplt<ExtraTmp>"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<ExtraTmp> >"));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<Tmplt<ExtraTmp> > >"));
   expectedResult.Add(TClass::GetClass("vector<NoDictClass*> "));
   expectedResult.Add(TClass::GetClass("vector<TmpTmpParam>"));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<ExtraTmp> >"));
   expectedResult.Add(TClass::GetClass("vector<ExtraTmp> "));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<TmpTmpParam> >"));
   expectedResult.Add(TClass::GetClass("vector<TmpParam>"));
   expectedResult.Add(TClass::GetClass("vector<Double32_t>"));
   expectedResult.Add(TClass::GetClass("ParamL1"));
   expectedResult.Add(TClass::GetClass("ParamL2"));
   expectedResult.Add(TClass::GetClass("vector<ParamL2*>"));
   expectedResult.Add(TClass::GetClass("BasicTests::NoDictTypdefs"));
   expectedResult.Add(TClass::GetClass("BasicTests::NoDict"));
   expectedResult.Add(TClass::GetClass("BasicTests::HasVecDoubleTD32"));
   expectedResult.Add(TClass::GetClass("BasicTests::HasVecDouble32"));
   expectedResult.Add(TClass::GetClass("map<unsigned short,Double32_t>"));

   cerr<<"With recursion:"<<endl; // Write on the same stream of the errors below
   THashTable missingDictClassesRecursion;
   myClass->GetMissingDictionaries(missingDictClassesRecursion, true);
   //missingDictClassesRecursion.Print();
   if (!missingDictClassesRecursion.IsEmpty()) {
      if (missingDictClassesRecursion.GetEntries() != expectedResult.GetEntries()) {
         Error("TClass::GetMissingClassDictionaries", "The set of classes with missing dictionaries does not contain the correct number of elements (expected: %d got %d).",expectedResult.GetEntries(),missingDictClassesRecursion.GetEntries());
//         expectedResult.ls();
//         missingDictClassesRecursion.ls();
      }
      TIterator* it = missingDictClassesRecursion.MakeIterator();
      TClass* cl = 0;
      while ((cl = (TClass*)it->Next())) {
         if (!expectedResult.FindObject(cl)) {
            Error("TCling::GetMissingDictionaries", "Class %s is not in the expected set.", cl->GetName());
         }
      }
      it = expectedResult.MakeIterator();
      while ((cl = (TClass*)it->Next())) {
         if (!missingDictClassesRecursion.FindObject(cl)) {
            Error("TCling::GetMissingDictionaries", "Class %s with no dictionaries is not in the set.", cl->GetName());
         }
      }
   } else {
      Error("TClass::GetMissingClassDictionaries", "The set of missing classes is not created");
   }

  return 0;
}