From ef283e0cf87fca3da2c238e116fd6ef9d1430e2a Mon Sep 17 00:00:00 2001
From: Jonathan Dumaresq <jdumaresq@cimeq.qc.ca>
Date: Wed, 12 Dec 2018 10:18:37 -0500
Subject: [PATCH] add tests to cover the new input adapter

---
 .../nlohmann/detail/input/input_adapters.hpp  | 16 ++++----
 test/src/unit-testsuites.cpp                  | 40 +++++++++++++++++++
 2 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp
index f623a230..e0945b3f 100644
--- a/include/nlohmann/detail/input/input_adapters.hpp
+++ b/include/nlohmann/detail/input/input_adapters.hpp
@@ -52,18 +52,18 @@ Input adapter for stdio file access. This adapter read only 1 byte and do not us
 */
 class file_input_adapter : public input_adapter_protocol
 {
-public:
-    explicit file_input_adapter(const FILE *file)  noexcept
-            : file(file)
+  public:
+    explicit file_input_adapter(const FILE* file)  noexcept
+        : file(file)
     {}
 
     std::char_traits<char>::int_type get_character() noexcept override
     {
-        return fgetc(const_cast<FILE *>(file));
+        return fgetc(const_cast<FILE*>(file));
     }
-private:
+  private:
     /// the file pointer to read from
-    const FILE * file;
+    const FILE* file;
 };
 
 
@@ -309,8 +309,8 @@ class input_adapter
 {
   public:
     // native support
-    input_adapter(FILE * file)
-            : ia(std::make_shared<file_input_adapter>(file)) {}
+    input_adapter(FILE* file)
+        : ia(std::make_shared<file_input_adapter>(file)) {}
     /// input adapter for input stream
     input_adapter(std::istream& i)
         : ia(std::make_shared<input_stream_adapter>(i)) {}
diff --git a/test/src/unit-testsuites.cpp b/test/src/unit-testsuites.cpp
index 3c00fada..782c3f52 100644
--- a/test/src/unit-testsuites.cpp
+++ b/test/src/unit-testsuites.cpp
@@ -384,6 +384,46 @@ TEST_CASE("json.org examples")
         json j;
         CHECK_NOTHROW(f >> j);
     }
+    SECTION("FILE 1.json")
+    {
+        auto f = fopen("test/data/json.org/1.json", "r");
+        json j;
+        CHECK_NOTHROW(j.parse(f));
+        fclose(f);
+    }
+
+    SECTION("FILE 2.json")
+    {
+        auto f = fopen("test/data/json.org/2.json", "r");
+        json j;
+        CHECK_NOTHROW(j.parse(f));
+        fclose(f);
+    }
+
+    SECTION("FILE 3.json")
+    {
+        auto f = fopen("test/data/json.org/3.json", "r");
+        json j;
+        CHECK_NOTHROW(j.parse(f));
+        fclose(f);
+    }
+
+    SECTION("FILE 4.json")
+    {
+        auto f = fopen("test/data/json.org/4.json", "r");
+        json j;
+        CHECK_NOTHROW(j.parse(f));
+        fclose(f);
+    }
+
+    SECTION("FILE 5.json")
+    {
+        auto f = fopen("test/data/json.org/5.json", "r");
+        json j;
+        CHECK_NOTHROW(j.parse(f));
+        fclose(f);
+    }
+
 }
 
 TEST_CASE("RFC 7159 examples")