71 lines
2.0 KiB
C++
71 lines
2.0 KiB
C++
#include "Internal.h"
|
|
#include <cstdint>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
|
|
#ifndef PERF_TEST
|
|
#define PERF_TEST 0
|
|
#endif
|
|
|
|
int main(int argc, char **argv) {
|
|
for (int i = 1; i < argc; ++i) {
|
|
std::ifstream t(argv[i], std::ios::binary);
|
|
std::stringstream buffer;
|
|
buffer << t.rdbuf();
|
|
auto str = buffer.str();
|
|
Arbitrary arbitrary({(const uint8_t *)str.data(), str.size()});
|
|
TestDriver<ConflictSet, !PERF_TEST> driver1{arbitrary};
|
|
TestDriver<ConflictSet, !PERF_TEST> driver2{arbitrary};
|
|
bool done1 = false;
|
|
bool done2 = false;
|
|
for (;;) {
|
|
if (!done1) {
|
|
done1 = driver1.next();
|
|
if (!driver1.ok) {
|
|
abort();
|
|
}
|
|
}
|
|
if (!done2) {
|
|
done2 = driver2.next();
|
|
if (!driver2.ok) {
|
|
abort();
|
|
}
|
|
}
|
|
if (done1 && done2) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
{
|
|
ConflictSet::MetricsV1 *metrics;
|
|
int metricsCount;
|
|
driver1.cs.getMetricsV1(&metrics, &metricsCount);
|
|
printf("#################### METRICS for ConflictSet 1 for %s "
|
|
"####################\n",
|
|
argv[i]);
|
|
for (int i = 0; i < metricsCount; ++i) {
|
|
printf("# HELP %s %s\n", metrics[i].name, metrics[i].help);
|
|
printf("# TYPE %s %s\n", metrics[i].name,
|
|
metrics[i].type == metrics[i].Counter ? "counter" : "gauge");
|
|
printf("%s %g\n", metrics[i].name, metrics[i].getValue());
|
|
}
|
|
puts("");
|
|
}
|
|
{
|
|
ConflictSet::MetricsV1 *metrics;
|
|
int metricsCount;
|
|
driver2.cs.getMetricsV1(&metrics, &metricsCount);
|
|
printf("#################### METRICS for ConflictSet 2 for %s "
|
|
"####################\n",
|
|
argv[i]);
|
|
for (int i = 0; i < metricsCount; ++i) {
|
|
printf("# HELP %s %s\n", metrics[i].name, metrics[i].help);
|
|
printf("# TYPE %s %s\n", metrics[i].name,
|
|
metrics[i].type == metrics[i].Counter ? "counter" : "gauge");
|
|
printf("%s %g\n", metrics[i].name, metrics[i].getValue());
|
|
}
|
|
puts("");
|
|
}
|
|
}
|
|
}
|