From ce4a2215961f314e9f91b7d717840a453d6c0de2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 3 Jun 2019 16:18:48 +0900 Subject: [PATCH] [loco] Use stdex::make_unique in test (#3667) This commit replaces all the internal make_unique implemetnations with stdex::make_unique. Signed-off-by: Jonghyun Park --- contrib/loco/CMakeLists.txt | 1 + contrib/loco/src/ADT/AnnotatedItem.test.cpp | 4 ++-- contrib/loco/src/IR/Verifier.test.cpp | 13 ++----------- contrib/loco/src/tensorflow.test.cpp | 12 ++---------- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/contrib/loco/CMakeLists.txt b/contrib/loco/CMakeLists.txt index 489d3ec..9657764 100644 --- a/contrib/loco/CMakeLists.txt +++ b/contrib/loco/CMakeLists.txt @@ -22,6 +22,7 @@ nncc_find_package(GTest REQUIRED) add_executable(loco_test ${TESTS}) target_link_libraries(loco_test gtest_main) +target_link_libraries(loco_test stdex) target_link_libraries(loco_test loco) add_test(loco_test loco_test) diff --git a/contrib/loco/src/ADT/AnnotatedItem.test.cpp b/contrib/loco/src/ADT/AnnotatedItem.test.cpp index b83c57a..42113ff 100644 --- a/contrib/loco/src/ADT/AnnotatedItem.test.cpp +++ b/contrib/loco/src/ADT/AnnotatedItem.test.cpp @@ -17,6 +17,7 @@ #include "loco/ADT/AnnotatedItem.h" #include +#include namespace { @@ -30,8 +31,7 @@ template struct DerivedAnnotation final : public Annotation { static std::unique_ptr> make(void) { - // TODO Use stdex::make_unique - return std::unique_ptr>{new DerivedAnnotation}; + return stdex::make_unique>(); } }; diff --git a/contrib/loco/src/IR/Verifier.test.cpp b/contrib/loco/src/IR/Verifier.test.cpp index 3e04dd4..247a593 100644 --- a/contrib/loco/src/IR/Verifier.test.cpp +++ b/contrib/loco/src/IR/Verifier.test.cpp @@ -18,19 +18,10 @@ #include +#include #include -// Use "stdex" later -namespace -{ - -template std::unique_ptr make_unique(Args &&... args) -{ - // NOTE std::make_unique is missing in C++11 standard - return std::unique_ptr(new T(std::forward(args)...)); -} - -} // namespace +using stdex::make_unique; TEST(VerifierTest, valid_minimal) { diff --git a/contrib/loco/src/tensorflow.test.cpp b/contrib/loco/src/tensorflow.test.cpp index 0c72dc8..1a6fc80 100644 --- a/contrib/loco/src/tensorflow.test.cpp +++ b/contrib/loco/src/tensorflow.test.cpp @@ -21,17 +21,9 @@ #include -// TODO Use "stdex" -namespace -{ - -template std::unique_ptr make_unique(Args &&... args) -{ - // NOTE std::make_unique is missing in C++11 standard - return std::unique_ptr(new T(std::forward(args)...)); -} +#include -} // namespace +using stdex::make_unique; #if 0 >>> MaxPool_Float_000 testcase -- 2.7.4