summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/GNUmakefile2
-rw-r--r--test/graph/binary_lifting.cpp2
-rw-r--r--test/math/millerRabin.base32.cpp2
-rw-r--r--test/math/millerRabin.cpp2
-rw-r--r--test/math/rho.cpp2
-rw-r--r--test/util.h6
6 files changed, 10 insertions, 6 deletions
diff --git a/test/GNUmakefile b/test/GNUmakefile
index cc1b4f5..7aae024 100644
--- a/test/GNUmakefile
+++ b/test/GNUmakefile
@@ -3,7 +3,7 @@ TESTS = $(basename $(shell find . -path ./awk -prune -o -type f -name '*.cpp' -p
AWK = $(basename $(shell find . -type f -name '*.awk'))
CXX = g++ -std=gnu++20 -I awk/ -I ../content/ -O2 -Wall -Wextra -Wshadow -Werror
SAN = -fsanitize=address,undefined -DSANITIZE
-TIMEOUT = 300
+TIMEOUT = 5m
test: $(TESTS:=.ok) $(TESTS:=.san.ok)
diff --git a/test/graph/binary_lifting.cpp b/test/graph/binary_lifting.cpp
index 20318da..abcd784 100644
--- a/test/graph/binary_lifting.cpp
+++ b/test/graph/binary_lifting.cpp
@@ -56,5 +56,5 @@ void performance_test() {
int main() {
stress_test();
- performance_test();
+ if (!sanitize) performance_test();
}
diff --git a/test/math/millerRabin.base32.cpp b/test/math/millerRabin.base32.cpp
index e9a4b57..70be2f8 100644
--- a/test/math/millerRabin.base32.cpp
+++ b/test/math/millerRabin.base32.cpp
@@ -98,7 +98,7 @@ void extra_tests() {
bool expected = ssize(factors) == 1 && factors.begin()->second == 1;
if (got != expected) cerr << "error: " << x << FAIL;
}
- if (t.time > 10) cerr << "too slow" << FAIL;
+ if (!sanitize && t.time > 10) cerr << "too slow" << FAIL;
cerr << "stress tested: " << t.time << "ms" << endl;
}
diff --git a/test/math/millerRabin.cpp b/test/math/millerRabin.cpp
index e7feba1..bdcdee6 100644
--- a/test/math/millerRabin.cpp
+++ b/test/math/millerRabin.cpp
@@ -90,7 +90,7 @@ void extra_tests() {
bool expected = ssize(factors) == 1 && factors.begin()->second == 1;
if (got != expected) cerr << "error: " << x << FAIL;
}
- if (t.time > 10) cerr << "too slow" << FAIL;
+ if (!sanitize && t.time > 10) cerr << "too slow" << FAIL;
cerr << "stress tested: " << t.time << "ms" << endl;
}
diff --git a/test/math/rho.cpp b/test/math/rho.cpp
index 9943a8c..2c8a319 100644
--- a/test/math/rho.cpp
+++ b/test/math/rho.cpp
@@ -92,7 +92,7 @@ void stress_test() {
cerr << FAIL;
}
}
- if (t.time > 100) cerr << "too slow" << FAIL;
+ if (!sanitize && t.time > 100) cerr << "too slow" << FAIL;
cerr << "stress tested: " << t.time << "ms" << endl;
}
diff --git a/test/util.h b/test/util.h
index 880ff04..98fd7f6 100644
--- a/test/util.h
+++ b/test/util.h
@@ -1,3 +1,7 @@
+#ifdef SANITIZE
+# define _GLIBCXX_ASSERTIONS 1
+# define _GLIBCXX_SANITIZE_VECTOR 1
+#endif
#include <bits/stdc++.h>
using namespace std;
@@ -202,7 +206,7 @@ namespace detail {
return 30/t;
}
- double speed = benchmark();
+ double speed = sanitize ? numeric_limits<double>::infinity() : benchmark();
}
struct timer {