Guest User

Untitled

a guest
Apr 12th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void testLP() {
  2.     CTableLP t1(11, 5);
  3.     cout << t1.insert(CKey(4), CValue(8)) << "  == 0" << endl;
  4.     cout << "P P P P 4 P P P P P P " << endl;
  5.     t1.Print();
  6.    
  7.     cout << t1.insert(CKey(10), CValue(0)) << " == 0" << endl;
  8.     cout << "P P P P 4 P P P P P 10 " << endl;
  9.     t1.Print();
  10.    
  11.     cout << t1.remove(CKey(0)) << " == -1" << endl;
  12.     cout << "P P P P 4 P P P P P 10 " << endl;
  13.     t1.Print();
  14.    
  15.     cout << t1.insert(CKey(18), CValue(2)) << " == 0" << endl;
  16.     cout << "P P P P 4 P P 18 P P 10 " << endl;
  17.     t1.Print();
  18.    
  19.     cout << t1.insert(CKey(10), CValue(15)) << " == 0" << endl;
  20.     cout << "P P P P 4 P P 18 P P 10 " << endl;
  21.     t1.Print();
  22.    
  23.     cout << t1.insert(CKey(11), CValue(9)) << " == 0" << endl;
  24.     cout << "11 P P P 4 P P 18 P P 10 " << endl;
  25.     t1.Print();
  26.    
  27.     cout << t1.insert(CKey(1), CValue(18)) << " == 0" << endl;
  28.     cout << "11 1 P P 4 P P 18 P P 10 " << endl;
  29.     t1.Print();
  30.    
  31.     cout << t1.remove(CKey(17)) << " == -1" << endl;
  32.     cout << "11 1 P P 4 P P 18 P P 10 " << endl;
  33.     t1.Print();
  34.    
  35.     cout << t1.insert(CKey(15), CValue(18)) << " == 1" << endl;
  36.     cout << "11 1 P P 4 P P 18 P 15 10 " << endl;
  37.     t1.Print();
  38.    
  39.     cout << t1.remove(CKey(16)) << " == -1" << endl;
  40.     cout << "11 1 P P 4 P P 18 P 15 10 " << endl;
  41.     t1.Print();
  42.    
  43.     cout << t1.remove(CKey(9)) << " == -1" << endl;
  44.     cout << "11 1 P P 4 P P 18 P 15 10 " << endl;
  45.     t1.Print();
  46.    
  47.     cout << t1.insert(CKey(19), CValue(18)) << " == 0" << endl;
  48.     cout << "11 1 P P 4 P P 18 19 15 10 " << endl;
  49.     t1.Print();
  50.    
  51.     cout << t1.remove(CKey(9)) << " == -1" << endl;
  52.     cout << "11 1 P P 4 P P 18 19 15 10 " << endl;
  53.     t1.Print();
  54.    
  55.     cout << t1.remove(CKey(9)) << " == -1" << endl;
  56.     cout << "11 1 P P 4 P P 18 19 15 10 " << endl;
  57.     t1.Print();
  58.    
  59.     cout << t1.insert(CKey(14), CValue(11)) << " == 0" << endl;
  60.     cout << "11 1 P 14 4 P P 18 19 15 10 " << endl;
  61.     t1.Print();
  62.    
  63.     cout << t1.insert(CKey(16), CValue(6)) << " == 0" << endl;
  64.     cout << "11 1 P 14 4 16 P 18 19 15 10 " << endl;
  65.     t1.Print();
  66.    
  67.     cout << t1.insert(CKey(17), CValue(11)) << " == 0" << endl;
  68.     cout << "11 1 P 14 4 16 17 18 19 15 10 " << endl;
  69.     t1.Print();
  70.    
  71.     cout << t1.insert(CKey(4), CValue(4)) << " == 0" << endl;
  72.     cout << "11 1 P 14 4 16 17 18 19 15 10 " << endl;
  73.     t1.Print();
  74.    
  75.     cout << t1.remove(CKey(11)) << " == 0" << endl;
  76.     cout << "P 1 P 14 4 16 17 18 19 15 10 " << endl;
  77.     t1.Print();
  78.    
  79.     cout << t1.remove(CKey(15)) << " == 1" << endl;
  80.     cout << "P 1 P 14 4 16 17 18 19 P 10 " << endl;
  81.     t1.Print();
  82.    
  83.     cout << t1.insert(CKey(3), CValue(13)) << " == 2" << endl;
  84.     cout << "P 1 3 14 4 16 17 18 19 P 10 " << endl;
  85.     t1.Print();
  86.    
  87.     cout << t1.remove(CKey(4)) << " == 0" << endl;
  88.     cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
  89.     t1.Print();
  90.    
  91.     cout << t1.remove(CKey(15)) << " == -1" << endl;
  92.     cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
  93.     t1.Print();
  94.    
  95.     cout << t1.remove(CKey(9)) << " == -1" << endl;
  96.     cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
  97.     t1.Print();
  98.    
  99.     cout << t1.insert(CKey(1), CValue(13)) << " == 0" << endl;
  100.     cout << "P 1 3 14 P 16 17 18 19 P 10 " << endl;
  101.     t1.Print();
  102.    
  103.     cout << t1.insert(CKey(0), CValue(2)) << " == 0" << endl;
  104.     cout << "0 1 3 14 P 16 17 18 19 P 10 " << endl;
  105.     t1.Print();
  106.    
  107.     cout << t1.remove(CKey(15)) << " == -1" << endl;
  108.     cout << "0 1 3 14 P 16 17 18 19 P 10 " << endl;
  109.     t1.Print();
  110.    
  111.     cout << t1.remove(CKey(6)) << " == -1" << endl;
  112.     cout << "0 1 3 14 P 16 17 18 19 P 10 " << endl;
  113.     t1.Print();
  114.    
  115.     cout << t1.insert(CKey(13), CValue(7)) << " == 7" << endl;
  116.     cout << "0 1 3 14 13 16 17 18 19 P 10 " << endl;
  117.     t1.Print();
  118.    
  119.     cout << t1.remove(CKey(19)) << " == 0" << endl;
  120.     cout << "0 1 13 14 P 16 17 18 3 P 10 " << endl;
  121.     t1.Print();
  122.    
  123.     cout << t1.insert(CKey(3), CValue(15)) << " == 1" << endl;
  124.     cout << "0 1 13 14 P 16 17 18 3 P 10 " << endl;
  125.     t1.Print();
  126.    
  127.     cout << t1.insert(CKey(9), CValue(16)) << " == 0" << endl;
  128.     cout << "0 1 13 14 P 16 17 18 3 9 10 " << endl;
  129.     t1.Print();
  130.    
  131.     cout << t1.insert(CKey(18), CValue(10)) << " == 0" << endl;
  132.     cout << "0 1 13 14 P 16 17 18 3 9 10 " << endl;
  133.     t1.Print();
  134.    
  135.     cout << t1.remove(CKey(17)) << " == 0" << endl;
  136.     cout << "0 1 13 14 P 16 P 18 3 9 10  " << endl;
  137.     t1.Print();
  138.    
  139.     cout << t1.remove(CKey(4)) << " == -1" << endl;
  140.     cout << "0 1 13 14 P 16 P 18 3 9 10  " << endl;
  141.     t1.Print();
  142.    
  143.     cout << t1.insert(CKey(0), CValue(1)) << " == 0" << endl;
  144.     cout << "0 1 13 14 P 16 P 18 3 9 10 " << endl;
  145.     t1.Print();
  146.    
  147.     cout << t1.insert(CKey(14), CValue(5)) << " == 0" << endl;
  148.     cout << "0 1 13 14 P 16 P 18 3 9 10 " << endl;
  149.     t1.Print();
  150.    
  151.     cout << t1.insert(CKey(8), CValue(0)) << " == 4" << endl;
  152.     cout << "0 1 13 14 P 16 8 18 3 9 10" << endl;
  153.     t1.Print();
  154.    
  155.     cout << t1.remove(CKey(1)) << " == 0" << endl;
  156.     cout << "0 8 13 14 P 16 P 18 3 9 10 " << endl;
  157.     t1.Print();
  158.    
  159.     cout << t1.insert(CKey(5), CValue(7)) << " == 2" << endl;
  160.     cout << "0 8 13 14 5 16 P 18 3 9 10 " << endl;
  161.     t1.Print();
  162.    
  163.     cout << t1.insert(CKey(17), CValue(17)) << " == 0" << endl;
  164.     cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
  165.     t1.Print();
  166.    
  167.     cout << t1.remove(CKey(19)) << " == -1" << endl;
  168.     cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
  169.     t1.Print();
  170.    
  171.     cout << t1.remove(CKey(7)) << " == -1" << endl;
  172.     cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
  173.     t1.Print();
  174.    
  175.     cout << t1.insert(CKey(16), CValue(7)) << " == 0" << endl;
  176.     cout << "0 8 13 14 5 16 17 18 3 9 10 " << endl;
  177.     t1.Print();
  178.    
  179.     cout << t1.remove(CKey(9)) << " == 0" << endl;
  180.     cout << "0 8 13 14 5 16 17 18 3 P 10 " << endl;
  181.     t1.Print();
  182.    
  183.     cout << t1.remove(CKey(13)) << " == 0" << endl;
  184.     cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
  185.     t1.Print();
  186.    
  187.     cout << t1.remove(CKey(19)) << " == -1" << endl;
  188.     cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
  189.     t1.Print();
  190.    
  191.     cout << t1.remove(CKey(11)) << " == -1" << endl;
  192.     cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
  193.     t1.Print();
  194.    
  195.     cout << t1.remove(CKey(11)) << " == -1" << endl;
  196.     cout << "0 P 8 14 5 16 17 18 3 P 10 " << endl;
  197.     t1.Print();
  198.    
  199.     cout << t1.insert(CKey(0), CValue(17)) << " == 0" << endl;
  200.     cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
  201.     t1.Print();
  202.    
  203.    cout << t1.isElem(CKey(0)) << " == 1" << endl;
  204.    cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
  205.     t1.Print();
  206.    
  207.    cout << t1.isElem(CKey(233)) << " == 0" << endl;
  208.    cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
  209.     t1.Print();
  210.    
  211.    CValue val;
  212.    cout << t1.CTable::search(CKey(0), val) << " == 0" << endl;
  213.    cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
  214.     t1.Print();
  215.    cout << val.getValue() << endl;
  216.    
  217.    cout << t1.CTable::search(CKey(233), val) << " == -1" << endl;
  218.    cout << "0 P 8 14 5 16 17 18 3 P 10" << endl;
  219.     t1.Print();
  220.    
  221. }
Add Comment
Please, Sign In to add comment