summaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/tests/assert/asserter.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-12-06 21:04:05 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2018-12-06 21:04:05 +0000
commitc6011003d7866f62488a638a99c501b90efe7170 (patch)
treebbe94a51b61f9d8370696ebfc407a2d8051fff78 /staging_vespalib/src/tests/assert/asserter.cpp
parentdfe58ec7ebb45281e994c54bced22c7add9c47de (diff)
Allow asserts that rember if they have been triggered before.
Diffstat (limited to 'staging_vespalib/src/tests/assert/asserter.cpp')
-rw-r--r--staging_vespalib/src/tests/assert/asserter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/staging_vespalib/src/tests/assert/asserter.cpp b/staging_vespalib/src/tests/assert/asserter.cpp
new file mode 100644
index 00000000000..f1be7531575
--- /dev/null
+++ b/staging_vespalib/src/tests/assert/asserter.cpp
@@ -0,0 +1,16 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/vespalib/util/assert.h>
+#include <cassert>
+#include <cstdlib>
+
+int main(int argc, char *argv[]) {
+ assert(argc == 3);
+ const char * assertKey = argv[1];
+ size_t assertCount = strtoul(argv[2], nullptr, 0);
+ for (size_t i(0); i < assertCount; i++) {
+ ASSERT_ONCE_OR_LOG(true, assertKey, 100);
+ ASSERT_ONCE_OR_LOG(false, assertKey, 100);
+ }
+ assert(assertCount == vespalib::assert::getNumAsserts(assertKey));
+ return 0;
+}