SHARE
TWEET

Set135 Tester

a guest Oct 13th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main()
  2. {
  3.     Set135<int>* emptyset = new Set135<int>();
  4.     Set135<int>* s1 = emptyset->add(1);
  5.     Set135<int>* s12 = s1->add(2);
  6.     // Test multi add doesn't add multi, and remove
  7.     Set135<int>* t1 = emptyset->add(1)->add(1);
  8.     cout << *(t1->remove(1)) << endl;
  9.     cout << *t1 << endl;
  10.     // addAll
  11.     cout << *(emptyset->addAll(s12)) << endl;
  12.     Set135<int>* s123 = s1->addAll(s12->add(3));
  13.     cout << *s123 << endl;
  14.     // retainAll, removeAll
  15.     cout << *(s123->add(4)->add(5)->retainAll(s12)) << endl;
  16.     cout << *(s123->removeAll(emptyset->add(2)->add(3)->add(4))) << endl;
  17.     cout << *(s123->retainAll(emptyset)) << endl;
  18.     // Boolean functions
  19.     bool booleanResult = ! emptyset->contains(1);
  20.     booleanResult &= s123->contains(1);
  21.     booleanResult &= ! s123->contains(0);
  22.     booleanResult &= ! emptyset->containsAll(s123);
  23.     booleanResult &= ! s12->containsAll(s123);
  24.     booleanResult &= s123->containsAll(s123);
  25.     booleanResult &= s123->containsAll(s1);
  26.     cout << booleanResult << endl;        
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top