소스 검색

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

Ian Goldberg 7 달 전
부모
커밋
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);
             }