Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void testLP() {
- CTableLP t1(11, 5);
- cout << t1.insert(CKey(4), CValue(8)) << " == 0" << endl;
- cout << "P P P P 4 P P P P P P " << endl;
- t1.Print();
- cout << t1.insert(CKey(10), CValue(0)) << " == 0" << endl;
- cout << "P P P P 4 P P P P P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(0)) << " == -1" << endl;
- cout << "P P P P 4 P P P P P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(18), CValue(2)) << " == 0" << endl;
- cout << "P P P P 4 P P 18 P P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(10), CValue(15)) << " == 0" << endl;
- cout << "P P P P 4 P P 18 P P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(11), CValue(9)) << " == 0" << endl;
- cout << "11 P P P 4 P P 18 P P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(1), CValue(18)) << " == 0" << endl;
- cout << "11 1 P P 4 P P 18 P P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(17)) << " == -1" << endl;
- cout << "11 1 P P 4 P P 18 P P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(15), CValue(18)) << " == 1" << endl;
- cout << "11 1 P P 4 P P 18 P 15 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(16)) << " == -1" << endl;
- cout << "11 1 P P 4 P P 18 P 15 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(9)) << " == -1" << endl;
- cout << "11 1 P P 4 P P 18 P 15 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(19), CValue(18)) << " == 0" << endl;
- cout << "11 1 P P 4 P P 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(9)) << " == -1" << endl;
- cout << "11 1 P P 4 P P 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(9)) << " == -1" << endl;
- cout << "11 1 P P 4 P P 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(14), CValue(11)) << " == 0" << endl;
- cout << "11 1 P 14 4 P P 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(16), CValue(6)) << " == 0" << endl;
- cout << "11 1 P 14 4 16 P 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(17), CValue(11)) << " == 0" << endl;
- cout << "11 1 P 14 4 16 17 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(4), CValue(4)) << " == 0" << endl;
- cout << "11 1 P 14 4 16 17 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(11)) << " == 0" << endl;
- cout << "P 1 P 14 4 16 17 18 19 15 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(15)) << " == 1" << endl;
- cout << "P 1 P 14 4 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(3), CValue(13)) << " == 2" << endl;
- cout << "P 1 3 14 4 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(4)) << " == 0" << endl;
- cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(15)) << " == -1" << endl;
- cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(9)) << " == -1" << endl;
- cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(1), CValue(13)) << " == 0" << endl;
- cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(0), CValue(2)) << " == 0" << endl;
- cout << "0 1 3 14 P 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(15)) << " == -1" << endl;
- cout << "0 1 3 14 P 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(6)) << " == -1" << endl;
- cout << "0 1 3 14 P 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(13), CValue(7)) << " == 7" << endl;
- cout << "0 1 3 14 13 16 17 18 19 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(19)) << " == 0" << endl;
- cout << "0 1 13 14 P 16 17 18 3 P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(3), CValue(15)) << " == 1" << endl;
- cout << "0 1 13 14 P 16 17 18 3 P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(9), CValue(16)) << " == 0" << endl;
- cout << "0 1 13 14 P 16 17 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(18), CValue(10)) << " == 0" << endl;
- cout << "0 1 13 14 P 16 17 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(17)) << " == 0" << endl;
- cout << "0 1 13 14 P 16 P 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(4)) << " == -1" << endl;
- cout << "0 1 13 14 P 16 P 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(0), CValue(1)) << " == 0" << endl;
- cout << "0 1 13 14 P 16 P 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(14), CValue(5)) << " == 0" << endl;
- cout << "0 1 13 14 P 16 P 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(8), CValue(0)) << " == 4" << endl;
- cout << "0 1 13 14 P 16 8 18 3 9 10" << endl;
- t1.Print();
- cout << t1.remove(CKey(1)) << " == 0" << endl;
- cout << "0 8 13 14 P 16 P 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(5), CValue(7)) << " == 2" << endl;
- cout << "0 8 13 14 5 16 P 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(17), CValue(17)) << " == 0" << endl;
- cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(19)) << " == -1" << endl;
- cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(7)) << " == -1" << endl;
- cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(16), CValue(7)) << " == 0" << endl;
- cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(9)) << " == 0" << endl;
- cout << "0 8 13 14 5 16 17 18 3 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(13)) << " == 0" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(19)) << " == -1" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(11)) << " == -1" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
- t1.Print();
- cout << t1.remove(CKey(11)) << " == -1" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
- t1.Print();
- cout << t1.insert(CKey(0), CValue(17)) << " == 0" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
- t1.Print();
- cout << t1.isElem(CKey(0)) << " == 1" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
- t1.Print();
- cout << t1.isElem(CKey(233)) << " == 0" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
- t1.Print();
- CValue val;
- cout << t1.CTable::search(CKey(0), val) << " == 0" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
- t1.Print();
- cout << val.getValue() << endl;
- cout << t1.CTable::search(CKey(233), val) << " == -1" << endl;
- cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
- t1.Print();
- }
Add Comment
Please, Sign In to add comment