浏览代码

If run_sanity is 1, actually check that the extracted values from the heap come out in non-decreasing order

Ian Goldberg 1 年之前
父节点
当前提交
cf36f72dc4
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      heap.cpp

+ 8 - 0
heap.cpp

@@ -764,6 +764,9 @@ void Heap(MPCIO & mpcio,  const PRACOptions & opts, char ** args) {
         tree.print_heap(tio, yield);
         #endif
         
+        bool have_lastextract = false;
+        uint64_t lastextract = 0;
+
         for (size_t j = 0; j < n_extracts; ++j) {
  
  
@@ -773,6 +776,11 @@ void Heap(MPCIO & mpcio,  const PRACOptions & opts, char ** args) {
              RegAS minval = tree.extract_min(mpcio, tio, yield, is_optimized);
              uint64_t minval_reconstruction = mpc_reconstruct(tio, yield, minval);
              std::cout << "minval_reconstruction = " << minval_reconstruction << std::endl;
+             if (have_lastextract) {
+                assert(minval_reconstruction >= lastextract);
+             }
+             lastextract = minval_reconstruction;
+             have_lastextract = true;
             } else {
               tree.extract_min(mpcio, tio, yield, is_optimized);
             }