Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list<const Figure *> * testCompterSupprimerSiBUG()
- {
- list<const Figure *> * figures = new list<const Figure *>();
- Cercle * c1 = new Cercle(Point(10, 20), 2);
- Cercle * c2 = new Cercle(Point(10, 20), 9);
- Cercle * c3 = new Cercle(Point(10, 20), 15);
- figures->push_back(new Cercle(Point(10, 20), 2));
- figures->push_back(new Cercle(Point(10, 20), 9));
- figures->push_back(new Cercle(Point(10, 20), 15));
- Ligne * l1 = new Ligne(Point(10, 20), Point(12, 44));
- Ligne * l2 = new Ligne(Point(6, 7), Point(1, 21));
- figures->push_back(new Ligne(Point(10, 20), Point(12, 44)));
- figures->push_back(new Ligne(Point(6, 7), Point(1, 21)));
- Image * i1 = new Image();
- i1->ajouter(*c1);
- i1->ajouter(*l1);
- figures->push_back(i1);
- Cercle * c4 = new Cercle(Point(10, 20), 150);
- figures->push_back(new Cercle(Point(10, 20), 150));
- Image * i2 = new Image();
- i2->ajouter(*c2);
- i2->ajouter(*c4);
- i2->ajouter(*i1);
- figures->push_back(i2);
- Image * i3 = new Image();
- i3->ajouter(*c3);
- i3->ajouter(*c4);
- i3->ajouter(*i2);
- i3->ajouter(*l2);
- figures->push_back(i3);
- for_each(figures->begin(), figures->end(), affiche);
- Condition * conditions[] =
- {
- new EstPetite(300),
- new EstUn(&Cercle::temoin),
- new EstUn(&Ligne::temoin),
- new EstUn(&Image::temoin),
- new Non(new EstUn(&Cercle::temoin)),
- new Non(new EstUn(&Ligne::temoin)),
- new Et(new EstUn(&Cercle::temoin), new EstPetite(300))
- };
- for (unsigned int i = 0; i < sizeof(conditions)/sizeof(conditions[0]); i++)
- {
- int n = Filtrage::compterSi(*figures, conditions[i], true);
- cout << conditions[i]->toString() << " : " << Filtrage::compterSi(*figures, conditions[i], true) << "V + ";
- cout << figures->size() - n << "F" << endl;
- }
- cout << endl << "SUPPRESSION supperficielle des cercles" <<endl;
- Filtrage::supprimerSi(*figures, conditions[1]);
- for_each(figures->begin(), figures->end(), affiche);
- cout << endl << "SUPPRESSION profonde des cercles" <<endl;
- Filtrage::supprimerSiProfond(*figures, conditions[1]);
- for_each(figures->begin(), figures->end(), affiche);
- for (unsigned int i = 0; i < sizeof(conditions) / sizeof(conditions[0]); i++)
- {
- cout << i << endl;
- delete conditions[i];
- }
- // for (auto val = figures->begin(); val != figures->end(); val++)
- // delete *val;
- delete c1;
- delete c2;
- delete c3;
- delete c4;
- delete l1;
- delete l2;
- return figures;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement