test_utils.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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,
  19. int8_t index,
  20. int64_t timestamp);
  21. std::tuple<int8_t, int8_t, int64_t> CreateTestColumnSpec(int8_t mask,
  22. int8_t index,
  23. int64_t timestamp);
  24. RowValue CreateTestRowValue(
  25. std::vector<std::tuple<int8_t, int8_t, int64_t>> column_specs);
  26. RowValue CreateRowTombstone(int64_t timestamp);
  27. void VerifyRowValueColumns(
  28. std::vector<std::shared_ptr<ColumnBase>> &columns,
  29. std::size_t index_of_vector,
  30. int8_t expected_mask,
  31. int8_t expected_index,
  32. int64_t expected_timestamp
  33. );
  34. int64_t ToMicroSeconds(int64_t seconds);
  35. int32_t ToSeconds(int64_t microseconds);
  36. }
  37. } // namespace ROCKSDB_NAMESPACE