Files
weaseldb/benchmarks/test_data.hpp
2025-08-17 16:11:28 -04:00

58 lines
1.8 KiB
C++

#pragma once
#include <string>
/**
* @brief Test data and utilities for WeaselDB benchmarking and testing.
*
* This namespace provides pre-defined JSON test data of varying complexity
* and utility functions for generating test payloads. The test data is designed
* to exercise different aspects of the JSON parsing and commit request
* processing pipeline.
*/
namespace weaseldb::test_data {
/**
* @brief Simple JSON commit request with minimal operations.
*
* Contains a basic commit request with a single write operation.
* Useful for basic functionality testing and performance baseline measurements.
*/
extern const std::string SIMPLE_JSON;
/**
* @brief Medium complexity JSON commit request.
*
* Contains multiple operations and preconditions to test parsing
* of more realistic commit request structures.
*/
extern const std::string MEDIUM_JSON;
/**
* @brief Complex JSON commit request with many nested structures.
*
* Contains extensive preconditions, operations, and edge cases to
* thoroughly test parser robustness and performance under load.
*/
extern const std::string COMPLEX_JSON;
/**
* @brief Generate a large JSON commit request for stress testing.
*
* Creates a JSON commit request with the specified number of operations
* to test parser performance and memory usage under high load conditions.
* The generated JSON includes a mix of write, delete, and range operations
* with realistic key-value patterns.
*
* @param num_operations Number of operations to include in the generated JSON
* @return JSON string representing a large commit request
*
* @example
* ```cpp
* // Generate JSON with 10,000 operations for stress testing
* std::string large_json = generate_large_json(10000);
* ```
*/
std::string generate_large_json(int num_operations);
} // namespace weaseldb::test_data