Files
c-toxcore/testing/support/public/environment.hh
T
iphydf 9c22e79cc8 test(support): add SimulatedEnvironment for deterministic testing
Introduces a new testing support library 'testing/support' that provides
a clean, modular, and fully deterministic environment for testing
toxcore components.
2026-01-07 13:06:18 +00:00

48 lines
1.0 KiB
C++

#ifndef C_TOXCORE_TESTING_SUPPORT_ENVIRONMENT_H
#define C_TOXCORE_TESTING_SUPPORT_ENVIRONMENT_H
#include <memory>
namespace tox::test {
class NetworkSystem;
class ClockSystem;
class RandomSystem;
class MemorySystem;
/**
* @brief Service locator for system resources in tests.
*
* This interface allows tests to access system resources (Network, Time, RNG,
* memory) in a way that can be swapped between real implementations (for
* integration tests) and simulated ones (for unit/fuzz tests).
*/
class Environment {
public:
virtual ~Environment();
/**
* @brief Access the network subsystem.
*/
virtual NetworkSystem &network() = 0;
/**
* @brief Access the monotonic clock and timer subsystem.
*/
virtual ClockSystem &clock() = 0;
/**
* @brief Access the random number generator.
*/
virtual RandomSystem &random() = 0;
/**
* @brief Access the memory allocator.
*/
virtual MemorySystem &memory() = 0;
};
} // namespace tox::test
#endif // C_TOXCORE_TESTING_SUPPORT_ENVIRONMENT_H