Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/Benchmark/StringificationBench.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-01-25 22:56:36 +0100
committerMartin Hořeňovský2017-01-25 22:56:36 +0100
commit4ce11d63a6b0ec93c345599a6255c31c657b25c1 (patch)
tree475313fa19151d3aa375bdf57748beebd3f8a0f5 /projects/Benchmark/StringificationBench.cpp
parentb1171bd1f21471a31107bfc9eee2cfe44639566c (diff)
parent99c2ea594c87b87c3a6e99343978d77d4042b70a (diff)
downloadcatch3-4ce11d63a6b0ec93c345599a6255c31c657b25c1.tar.gz
Merge branch 'dev-performance'
Diffstat (limited to 'projects/Benchmark/StringificationBench.cpp')
-rw-r--r--projects/Benchmark/StringificationBench.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/projects/Benchmark/StringificationBench.cpp b/projects/Benchmark/StringificationBench.cpp
new file mode 100644
index 00000000..1c14939b
--- /dev/null
+++ b/projects/Benchmark/StringificationBench.cpp
@@ -0,0 +1,46 @@
+/*
+ * Created by Martin on 16/01/2017.
+ *
+ * Distributed under the Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include "catch.hpp"
+
+#include <vector>
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE("Successful tests -- REQUIRE", "[Success]") {
+ const size_t sz = 1 * 1024 * 1024;
+
+
+ std::vector<size_t> vec; vec.reserve(sz);
+ for (size_t i = 0; i < sz; ++i){
+ vec.push_back(i);
+ REQUIRE(vec.back() == i);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE("Successful tests -- CHECK", "[Success]") {
+ const size_t sz = 1 * 1024 * 1024;
+
+
+ std::vector<size_t> vec; vec.reserve(sz);
+ for (size_t i = 0; i < sz; ++i){
+ vec.push_back(i);
+ CHECK(vec.back() == i);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE("Unsuccessful tests -- CHECK", "[Failure]") {
+ const size_t sz = 1024 * 1024;
+
+
+ std::vector<size_t> vec; vec.reserve(sz);
+ for (size_t i = 0; i < sz; ++i){
+ vec.push_back(i);
+ CHECK(vec.size() == i);
+ }
+}