From 630a5bdf06d59b8340fb4bfc0e692cbcf094026a Mon Sep 17 00:00:00 2001 From: mzuenni Date: Thu, 10 Jul 2025 17:40:18 +0200 Subject: run with sanitizer --- test/graph/bitonicTSPsimple.cpp.todo | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/graph/bitonicTSPsimple.cpp.todo (limited to 'test/graph/bitonicTSPsimple.cpp.todo') diff --git a/test/graph/bitonicTSPsimple.cpp.todo b/test/graph/bitonicTSPsimple.cpp.todo new file mode 100644 index 0000000..7e0a80b --- /dev/null +++ b/test/graph/bitonicTSPsimple.cpp.todo @@ -0,0 +1,49 @@ +#include "../util.h" +namespace got { +#include +} +namespace expected { +#include +} + +void stress_test() { + ll queries = 0; + for (int tries = 0; tries < 200'000; tries++) { + int n = Random::integer(2, 30); + + vector> dist(n); + for (auto& v : dist) v = Random::reals(n, 0, 1e18); + + got::dist = dist; + expected::dist = dist; + + auto got = got::bitonicTSP(); + auto expected = expected::bitonicTSP(); + + if (got != expected) cerr << "error" << FAIL; + queries += n; + } + cerr << "tested random queries: " << queries << endl; +} + +//this is an easy graph... +constexpr int N = 2'000; +void performance_test() { + timer t; + got::dist = vector>(N); + for (auto& v : got::dist) v = Random::reals(N, 0, 1e18); + + + t.start(); + auto got = got::bitonicTSP(); + t.stop(); + hash_t hash = 0; + for (auto x : got) hash += x; + if (t.time > 500) cerr << "too slow: " << t.time << FAIL; + cerr << "tested performance: " << t.time << "ms (hash: " << hash << ")" << endl; +} + +int main() { + stress_test(); + if (!sanitize) performance_test(); +} -- cgit v1.2.3