Advertisement
ludaludaed

hse_checker

Dec 22nd, 2022
887
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.59 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. template <template <typename ValueType> class RedBlackTree>
  4. class RBTreeTester {
  5.     template <class WrappedType>
  6.     class DeleteWrapper {
  7.         WrappedType value_;
  8.         bool *marker{};
  9.  
  10.     public:
  11.         template <class ...Args>
  12.         DeleteWrapper(Args &&...args) : value_(std::forward<Args>(args)...), marker(nullptr) {
  13.         }
  14.  
  15.         void bindMarker(bool *marker_arg) {
  16.             marker = marker_arg;
  17.         }
  18.  
  19.         ~DeleteWrapper() {
  20.             if (marker != nullptr) {
  21.                 *marker = true;
  22.             }
  23.         }
  24.     };
  25.  
  26.     enum class ErrorCodes { OK = 0, TL, WA, RE };
  27.  
  28.     static std::string to_string(ErrorCodes code) {
  29.         if (code == ErrorCodes::TL) {
  30.             return "TL";
  31.         }
  32.         if (code == ErrorCodes::WA) {
  33.             return "WA";
  34.         }
  35.         if (code == ErrorCodes::RE) {
  36.             return "RE";
  37.         }
  38.         return "OK";
  39.     }
  40.  
  41. public:
  42.     static std::string checkTree() {
  43.         ErrorCodes code;
  44.         code = destructorCheck();
  45.         if (code != ErrorCodes::OK) {
  46.             return "Destructor Error!" + to_string(code);
  47.         }
  48.  
  49.         code = constructorCheck();
  50.         if (code != ErrorCodes::OK) {
  51.             return "Constructor Error!" + to_string(code);
  52.         }
  53.  
  54.         code = emptyCheck();
  55.         if (code != ErrorCodes::OK) {
  56.             return "Empty Error!" + to_string(code);
  57.         }
  58.  
  59.         code = sizeCheck();
  60.         if (code != ErrorCodes::OK) {
  61.             return "Size Error!" + to_string(code);
  62.         }
  63.  
  64.         code = heightCheck();
  65.         if (code != ErrorCodes::OK) {
  66.             return "Height Error!" + to_string(code);
  67.         }
  68.  
  69.         code = loweBoundCheck();
  70.         if (code != ErrorCodes::OK) {
  71.             return "LowerBound Error!" + to_string(code);
  72.         }
  73.  
  74.         code = findCheck();
  75.         if (code != ErrorCodes::OK) {
  76.             return "Find Error!" + to_string(code);
  77.         }
  78.  
  79.         code = insertCheck();
  80.         if (code != ErrorCodes::OK) {
  81.             return "Insert Error!" + to_string(code);
  82.         }
  83.     }
  84.  
  85. private:
  86.     static ErrorCodes destructorCheck() {
  87.     }
  88.  
  89.     static ErrorCodes constructorCheck() {
  90.     }
  91.  
  92.     static ErrorCodes emptyCheck() {
  93.     }
  94.  
  95.     static ErrorCodes sizeCheck() {
  96.     }
  97.  
  98.     static ErrorCodes heightCheck() {
  99.     }
  100.  
  101.     static ErrorCodes loweBoundCheck() {
  102.     }
  103.  
  104.     static ErrorCodes findCheck() {
  105.     }
  106.  
  107.     static ErrorCodes insertCheck() {
  108.     }
  109. };
  110.  
  111. int main() {
  112.     std::cout << "Hello, World!" << std::endl;
  113.     return 0;
  114. }
  115.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement