summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-26 21:50:41 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-26 22:31:59 +0200
commit1374f94795141e7c67f486ee7dbb3ee85d028513 (patch)
tree2e6ba0ed89deaddb1e14092d44fb2b3948ff599e /test
parent27a5fbe944b72d3d764b3b6fe145e4503dd4e86f (diff)
downloadqtlocation-mapboxgl-1374f94795141e7c67f486ee7dbb3ee85d028513.tar.gz
Add Pass.NoCopy unit test
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/util/pass.test.cpp16
2 files changed, 17 insertions, 0 deletions
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 <mbgl/test/util.hpp>
+
+#include <mbgl/util/pass_types.hpp>
+
+TEST(Pass, NoCopy) {
+ static int copyCount = 0;
+ struct A {
+ A() = default;
+ A(A&&) = default;
+ A(const A&) { ++copyCount; }
+ static mbgl::Pass<A> create() { return A(); }
+ };
+ A a = A::create();
+ (void)a;
+ EXPECT_EQ(0, copyCount);
+} \ No newline at end of file