From e131b736f14707183b1c8ec74dc23f0030bfc004 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Mon, 8 Oct 2018 16:50:00 +0200
Subject: [PATCH] Add std::list conversion

---
 tests/test_Array.cpp | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/tests/test_Array.cpp b/tests/test_Array.cpp
index c2ec98c99..e6a31ae89 100644
--- a/tests/test_Array.cpp
+++ b/tests/test_Array.cpp
@@ -6,6 +6,7 @@
 
 #include <vector>
 #include <set>
+#include <list>
 
 // Instantiate to ensure full coverage is performed
 template class Array<int>;
@@ -162,6 +163,7 @@ TEST_CASE("Array", "[utils]") {
                  (v_array[2] == 5) and (v_array[3] == 3)));
       }
     }
+
     {
       std::vector<int> w;
       {
@@ -175,7 +177,7 @@ TEST_CASE("Array", "[utils]") {
     }
 
     {
-      std::set<int> s{4,2,5,3,1};
+      std::set<int> s{4,2,5,3,1,3,2};
       Array<int> s_array = convert_to_array(s);
 
       REQUIRE(s_array.size() == s.size());
@@ -183,6 +185,27 @@ TEST_CASE("Array", "[utils]") {
                (s_array[2] == 3) and (s_array[3] == 4) and
                (s_array[4] == 5)));
     }
+
+    {
+      std::multiset<int> ms{4,2,5,3,1,3,2};
+      Array<int> ms_array = convert_to_array(ms);
+
+      REQUIRE(ms_array.size() == ms.size());
+      REQUIRE(((ms_array[0] == 1) and (ms_array[1] == 2) and
+               (ms_array[2] == 2) and (ms_array[3] == 3) and
+               (ms_array[4] == 3) and (ms_array[5] == 4) and
+               (ms_array[6] == 5)));
+    }
+
+    {
+      std::list<int> l{1,3,5,6,2};
+      Array<int> l_array = convert_to_array(l);
+
+      REQUIRE(l_array.size() == l.size());
+      REQUIRE(((l_array[0] == 1) and (l_array[1] == 3) and
+               (l_array[2] == 5) and (l_array[3] == 6) and
+               (l_array[4] == 2)));
+    }
   }
 
 #ifndef NDEBUG
-- 
GitLab