From 22a1a846c6142c52d19f151319d75ebe94efb5b9 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Wed, 26 Feb 2020 21:50:41 +0200 Subject: Add Pass.NoCopy unit test --- test/CMakeLists.txt | 1 + test/util/pass.test.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/util/pass.test.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a9ae0ac874..75f91762a7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -97,6 +97,7 @@ add_library( ${PROJECT_SOURCE_DIR}/test/util/merge_lines.test.cpp ${PROJECT_SOURCE_DIR}/test/util/number_conversions.test.cpp ${PROJECT_SOURCE_DIR}/test/util/offscreen_texture.test.cpp + ${PROJECT_SOURCE_DIR}/test/util/pass.test.cpp ${PROJECT_SOURCE_DIR}/test/util/position.test.cpp ${PROJECT_SOURCE_DIR}/test/util/projection.test.cpp ${PROJECT_SOURCE_DIR}/test/util/run_loop.test.cpp diff --git a/test/util/pass.test.cpp b/test/util/pass.test.cpp new file mode 100644 index 0000000000..10651f854b --- /dev/null +++ b/test/util/pass.test.cpp @@ -0,0 +1,16 @@ +#include + +#include + +TEST(Pass, NoCopy) { + static int copyCount = 0; + struct A { + A() = default; + A(A&&) = default; + A(const A&) { ++copyCount; } + static mbgl::Pass create() { return A(); } + }; + A a = A::create(); + (void)a; + EXPECT_EQ(0, copyCount); +} \ No newline at end of file -- cgit v1.2.1