|
|
@ -21,6 +21,7 @@ |
|
|
|
#include <map> |
|
|
|
#include <map> |
|
|
|
#include <string> |
|
|
|
#include <string> |
|
|
|
#include <utility> |
|
|
|
#include <utility> |
|
|
|
|
|
|
|
#include <vector> |
|
|
|
|
|
|
|
|
|
|
|
#include "absl/functional/any_invocable.h" |
|
|
|
#include "absl/functional/any_invocable.h" |
|
|
|
#include "absl/log/check.h" |
|
|
|
#include "absl/log/check.h" |
|
|
@ -66,8 +67,8 @@ absl::AnyInvocable<bool(struct ExperimentMetadata)>* g_check_constraints_cb = |
|
|
|
class TestExperiments { |
|
|
|
class TestExperiments { |
|
|
|
public: |
|
|
|
public: |
|
|
|
TestExperiments(const ExperimentMetadata* experiment_metadata, |
|
|
|
TestExperiments(const ExperimentMetadata* experiment_metadata, |
|
|
|
size_t num_experiments) { |
|
|
|
size_t num_experiments) |
|
|
|
enabled_ = new bool[num_experiments]; |
|
|
|
: enabled_(num_experiments) { |
|
|
|
for (size_t i = 0; i < num_experiments; i++) { |
|
|
|
for (size_t i = 0; i < num_experiments; i++) { |
|
|
|
if (g_check_constraints_cb != nullptr) { |
|
|
|
if (g_check_constraints_cb != nullptr) { |
|
|
|
enabled_[i] = (*g_check_constraints_cb)(experiment_metadata[i]); |
|
|
|
enabled_[i] = (*g_check_constraints_cb)(experiment_metadata[i]); |
|
|
@ -91,12 +92,10 @@ class TestExperiments { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Overloading [] operator to access elements in array style
|
|
|
|
// Overloading [] operator to access elements in array style
|
|
|
|
bool operator[](int index) { return enabled_[index]; } |
|
|
|
bool operator[](int index) const { return enabled_[index]; } |
|
|
|
|
|
|
|
|
|
|
|
~TestExperiments() { delete enabled_; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
bool* enabled_; |
|
|
|
std::vector<bool> enabled_; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
TestExperiments* g_test_experiments = nullptr; |
|
|
|
TestExperiments* g_test_experiments = nullptr; |
|
|
|