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-14 21:55:37 +0100
committerMartin Hořeňovský2017-01-14 21:55:37 +0100
commit3b7511e5644dd74e2fb30b4a86769c07ccde88c7 (patch)
treebe11165564e863f896fa7c8e54f6552255966a81 /projects/Benchmark/StringificationBench.cpp
parente3659cdddd43ba4df9e4846630be6a6a7bd85a07 (diff)
downloadcatch3-3b7511e5644dd74e2fb30b4a86769c07ccde88c7.tar.gz
First commit of benchmarks for Catch runtime perf.
So far its very much a WIP with some problems that are known already and not very representative tests.
Diffstat (limited to 'projects/Benchmark/StringificationBench.cpp')
-rw-r--r--projects/Benchmark/StringificationBench.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/projects/Benchmark/StringificationBench.cpp b/projects/Benchmark/StringificationBench.cpp
new file mode 100644
index 00000000..67f36685
--- /dev/null
+++ b/projects/Benchmark/StringificationBench.cpp
@@ -0,0 +1,39 @@
+#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 = 128 * 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);
+ }
+}