From c09a4cbbd7e175062db101898d2b4bd2b26128f0 Mon Sep 17 00:00:00 2001
From: HenryLee <lee0906@hotmail.com>
Date: Wed, 31 May 2017 00:31:16 +1000
Subject: [PATCH] Add test cases for iterator to const iterator conversion

---
 test/src/unit-iterators1.cpp | 52 ++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/test/src/unit-iterators1.cpp b/test/src/unit-iterators1.cpp
index 6605076a..348c7249 100644
--- a/test/src/unit-iterators1.cpp
+++ b/test/src/unit-iterators1.cpp
@@ -1511,4 +1511,56 @@ TEST_CASE("iterators 1")
             }
         }
     }
+
+    SECTION("conversion from iterator to const iterator")
+	{
+        SECTION("boolean")
+		{
+            json j = true;
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+        SECTION("string")
+		{
+            json j = "hello world";
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+        SECTION("array")
+		{
+            json j = {1, 2, 3};
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+        SECTION("object")
+		{
+            json j = {{"A", 1}, {"B", 2}, {"C", 3}};
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+        SECTION("number (integer)")
+		{
+            json j = 23;
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+        SECTION("number (unsigned)")
+		{
+            json j = 23u;
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+        SECTION("number (float)")
+		{
+            json j = 23.42;
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+        SECTION("null")
+		{
+            json j = nullptr;
+			json::const_iterator it = j.begin();
+			CHECK(it == j.cbegin());
+		}
+	}
 }