[loco] Use stdex::make_unique in test (#3667)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 3 Jun 2019 07:18:48 +0000 (16:18 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 3 Jun 2019 07:18:48 +0000 (16:18 +0900)
This commit replaces all the internal make_unique implemetnations with
stdex::make_unique.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/loco/CMakeLists.txt
contrib/loco/src/ADT/AnnotatedItem.test.cpp
contrib/loco/src/IR/Verifier.test.cpp
contrib/loco/src/tensorflow.test.cpp

index 489d3ec..9657764 100644 (file)
@@ -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)
index b83c57a..42113ff 100644 (file)
@@ -17,6 +17,7 @@
 #include "loco/ADT/AnnotatedItem.h"
 
 #include <gtest/gtest.h>
+#include <stdex/Memory.h>
 
 namespace
 {
@@ -30,8 +31,7 @@ template <int N> struct DerivedAnnotation final : public Annotation
 {
   static std::unique_ptr<DerivedAnnotation<N>> make(void)
   {
-    // TODO Use stdex::make_unique
-    return std::unique_ptr<DerivedAnnotation<N>>{new DerivedAnnotation<N>};
+    return stdex::make_unique<DerivedAnnotation<N>>();
   }
 };
 
index 3e04dd4..247a593 100644 (file)
 
 #include <gtest/gtest.h>
 
+#include <stdex/Memory.h>
 #include <vector>
 
-// Use "stdex" later
-namespace
-{
-
-template <typename T, typename... Args> std::unique_ptr<T> make_unique(Args &&... args)
-{
-  // NOTE std::make_unique is missing in C++11 standard
-  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-} // namespace
+using stdex::make_unique;
 
 TEST(VerifierTest, valid_minimal)
 {
index 0c72dc8..1a6fc80 100644 (file)
 
 #include <gtest/gtest.h>
 
-// TODO Use "stdex"
-namespace
-{
-
-template <typename T, typename... Args> std::unique_ptr<T> make_unique(Args &&... args)
-{
-  // NOTE std::make_unique is missing in C++11 standard
-  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
+#include <stdex/Memory.h>
 
-} // namespace
+using stdex::make_unique;
 
 #if 0
 >>> MaxPool_Float_000 testcase