test_utils.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include <memory>
  7. #include "test_util/testharness.h"
  8. #include "utilities/cassandra/format.h"
  9. #include "utilities/cassandra/serialize.h"
  10. namespace ROCKSDB_NAMESPACE {
  11. namespace cassandra {
  12. extern const char kData[];
  13. extern const char kExpiringData[];
  14. extern const int32_t kTtl;
  15. extern const int8_t kColumn;
  16. extern const int8_t kTombstone;
  17. extern const int8_t kExpiringColumn;
  18. std::shared_ptr<ColumnBase> CreateTestColumn(int8_t mask, int8_t index,
  19. int64_t timestamp);
  20. std::tuple<int8_t, int8_t, int64_t> CreateTestColumnSpec(int8_t mask,
  21. int8_t index,
  22. int64_t timestamp);
  23. RowValue CreateTestRowValue(
  24. std::vector<std::tuple<int8_t, int8_t, int64_t>> column_specs);
  25. RowValue CreateRowTombstone(int64_t timestamp);
  26. void VerifyRowValueColumns(
  27. const std::vector<std::shared_ptr<ColumnBase>> &columns,
  28. std::size_t index_of_vector, int8_t expected_mask, int8_t expected_index,
  29. int64_t expected_timestamp);
  30. int64_t ToMicroSeconds(int64_t seconds);
  31. int32_t ToSeconds(int64_t microseconds);
  32. } // namespace cassandra
  33. } // namespace ROCKSDB_NAMESPACE