[locomotiv] Use array instead of set for test Session (#5779)
author박천교/On-Device Lab(SR)/Engineer/삼성전자 <ch.bahk@samsung.com>
Wed, 24 Jul 2019 00:02:41 +0000 (09:02 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 24 Jul 2019 00:02:41 +0000 (09:02 +0900)
* [locomotiv] Use array instead of set for test Session

To avoid undefined behavior, this commit use array instead of set to
make Session from iterator range.

Signed-off-by: Cheongyo Bahk <ch.bahk@samsung.com>
* Use aggregate initializer to be simple

compiler/locomotiv/src/Session.test.cpp

index c29f26e..27fe074 100644 (file)
@@ -22,7 +22,7 @@
 #include <nncc/core/ADT/tensor/Buffer.h>
 #include <nncc/core/ADT/tensor/LexicalLayout.h>
 
-#include <set>
+#include <array>
 
 #include <gtest/gtest.h>
 
@@ -310,9 +310,7 @@ TEST(Session, ctor_by_range)
   relu->input(constgen);
   push->from(relu);
 
-  std::set<loco::Node *> custom_outputs;
-  custom_outputs.insert(constgen);
-  custom_outputs.insert(push);
+  std::array<loco::Node *, 2> custom_outputs = {constgen, push};
 
   // Make Session by range
   locomotiv::Session s(g.get(), custom_outputs.begin(), custom_outputs.end());