From 21b1680ea18165d5ceb0854a2d27aa4e2b5a3e4e Mon Sep 17 00:00:00 2001
From: Niels Lohmann <mail@nlohmann.me>
Date: Tue, 19 May 2020 13:30:22 +0200
Subject: [PATCH] :truck: rename binary_array() to binary()

---
 .../nlohmann/byte_container_with_subtype.hpp  | 12 +++++++++
 include/nlohmann/json.hpp                     | 14 +++++-----
 single_include/nlohmann/json.hpp              | 26 ++++++++++++++-----
 test/src/unit-bson.cpp                        |  4 +--
 test/src/unit-cbor.cpp                        | 14 +++++-----
 test/src/unit-comparison.cpp                  |  2 +-
 test/src/unit-constructor1.cpp                |  6 ++---
 test/src/unit-constructor2.cpp                |  4 +--
 test/src/unit-element_access1.cpp             |  8 +++---
 test/src/unit-inspection.cpp                  |  4 +--
 test/src/unit-modifiers.cpp                   | 16 ++++++------
 test/src/unit-msgpack.cpp                     | 12 ++++-----
 test/src/unit-pointer_access.cpp              |  4 +--
 test/src/unit-serialization.cpp               |  8 +++---
 test/src/unit-ubjson.cpp                      | 10 +++----
 test/src/unit-udt.cpp                         |  2 +-
 16 files changed, 85 insertions(+), 61 deletions(-)

diff --git a/include/nlohmann/byte_container_with_subtype.hpp b/include/nlohmann/byte_container_with_subtype.hpp
index 243ece37..b2eef1b7 100644
--- a/include/nlohmann/byte_container_with_subtype.hpp
+++ b/include/nlohmann/byte_container_with_subtype.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <cstdint> // uint8_t
+#include <tuple> // tie
 #include <utility> // move
 
 namespace nlohmann
@@ -51,6 +52,17 @@ class byte_container_with_subtype : public BinaryType
         , m_has_subtype(true)
     {}
 
+    bool operator==(const byte_container_with_subtype& rhs) const
+    {
+        return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) ==
+               std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype);
+    }
+
+    bool operator!=(const byte_container_with_subtype& rhs) const
+    {
+        return !(rhs == *this);
+    }
+
     /*!
     @brief sets the binary subtype
 
diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp
index 38f8f203..df006694 100644
--- a/include/nlohmann/json.hpp
+++ b/include/nlohmann/json.hpp
@@ -899,7 +899,7 @@ class basic_json
        - If a subtype is given, it is used and added as unsigned 8-bit integer.
        - If no subtype is given, the generic binary subtype 0x00 is used.
 
-    @sa @ref binary_array -- create a binary array
+    @sa @ref binary -- create a binary array
 
     @since version 3.8.0
     */
@@ -1672,7 +1672,7 @@ class basic_json
     @since version 3.8.0
     */
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(const typename binary_t::container_type& init)
+    static basic_json binary(const typename binary_t::container_type& init)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
@@ -1709,7 +1709,7 @@ class basic_json
     @since version 3.8.0
     */
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(const typename binary_t::container_type& init, std::uint8_t subtype)
+    static basic_json binary(const typename binary_t::container_type& init, std::uint8_t subtype)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
@@ -1717,9 +1717,9 @@ class basic_json
         return res;
     }
 
-    /// @copydoc binary_array(const typename binary_t::container_type&)
+    /// @copydoc binary(const typename binary_t::container_type&)
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(typename binary_t::container_type&& init)
+    static basic_json binary(typename binary_t::container_type&& init)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
@@ -1727,9 +1727,9 @@ class basic_json
         return res;
     }
 
-    /// @copydoc binary_array(const typename binary_t::container_type&, std::uint8_t)
+    /// @copydoc binary(const typename binary_t::container_type&, std::uint8_t)
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(typename binary_t::container_type&& init, std::uint8_t subtype)
+    static basic_json binary(typename binary_t::container_type&& init, std::uint8_t subtype)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp
index f7743772..e8c7ecb9 100644
--- a/single_include/nlohmann/json.hpp
+++ b/single_include/nlohmann/json.hpp
@@ -4227,6 +4227,7 @@ struct adl_serializer
 
 
 #include <cstdint> // uint8_t
+#include <tuple> // tie
 #include <utility> // move
 
 namespace nlohmann
@@ -4277,6 +4278,17 @@ class byte_container_with_subtype : public BinaryType
         , m_has_subtype(true)
     {}
 
+    bool operator==(const byte_container_with_subtype& rhs) const
+    {
+        return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) ==
+               std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype);
+    }
+
+    bool operator!=(const byte_container_with_subtype& rhs) const
+    {
+        return !(rhs == *this);
+    }
+
     /*!
     @brief sets the binary subtype
 
@@ -16680,7 +16692,7 @@ class basic_json
        - If a subtype is given, it is used and added as unsigned 8-bit integer.
        - If no subtype is given, the generic binary subtype 0x00 is used.
 
-    @sa @ref binary_array -- create a binary array
+    @sa @ref binary -- create a binary array
 
     @since version 3.8.0
     */
@@ -17453,7 +17465,7 @@ class basic_json
     @since version 3.8.0
     */
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(const typename binary_t::container_type& init)
+    static basic_json binary(const typename binary_t::container_type& init)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
@@ -17490,7 +17502,7 @@ class basic_json
     @since version 3.8.0
     */
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(const typename binary_t::container_type& init, std::uint8_t subtype)
+    static basic_json binary(const typename binary_t::container_type& init, std::uint8_t subtype)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
@@ -17498,9 +17510,9 @@ class basic_json
         return res;
     }
 
-    /// @copydoc binary_array(const typename binary_t::container_type&)
+    /// @copydoc binary(const typename binary_t::container_type&)
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(typename binary_t::container_type&& init)
+    static basic_json binary(typename binary_t::container_type&& init)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
@@ -17508,9 +17520,9 @@ class basic_json
         return res;
     }
 
-    /// @copydoc binary_array(const typename binary_t::container_type&, std::uint8_t)
+    /// @copydoc binary(const typename binary_t::container_type&, std::uint8_t)
     JSON_HEDLEY_WARN_UNUSED_RESULT
-    static basic_json binary_array(typename binary_t::container_type&& init, std::uint8_t subtype)
+    static basic_json binary(typename binary_t::container_type&& init, std::uint8_t subtype)
     {
         auto res = basic_json();
         res.m_type = value_t::binary;
diff --git a/test/src/unit-bson.cpp b/test/src/unit-bson.cpp
index 318286d1..2a17f180 100644
--- a/test/src/unit-bson.cpp
+++ b/test/src/unit-bson.cpp
@@ -499,7 +499,7 @@ TEST_CASE("BSON")
             const auto s = std::vector<std::uint8_t>(N, 'x');
             json j =
             {
-                { "entry", json::binary_array(s) }
+                { "entry", json::binary(s) }
             };
 
             std::vector<std::uint8_t> expected =
@@ -529,7 +529,7 @@ TEST_CASE("BSON")
             const std::vector<std::uint8_t> md5hash = {0xd7, 0x7e, 0x27, 0x54, 0xbe, 0x12, 0x37, 0xfe, 0xd6, 0x0c, 0x33, 0x98, 0x30, 0x3b, 0x8d, 0xc4};
             json j =
             {
-                { "entry", json::binary_array(md5hash, 5) }
+                { "entry", json::binary(md5hash, 5) }
             };
 
             std::vector<std::uint8_t> expected =
diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp
index d34ae789..d7b87255 100644
--- a/test/src/unit-cbor.cpp
+++ b/test/src/unit-cbor.cpp
@@ -1450,7 +1450,7 @@ TEST_CASE("CBOR")
 
                     // create JSON value with byte array containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector
                     std::vector<uint8_t> expected;
@@ -1484,7 +1484,7 @@ TEST_CASE("CBOR")
 
                     // create JSON value with string containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector
                     std::vector<uint8_t> expected;
@@ -1519,7 +1519,7 @@ TEST_CASE("CBOR")
 
                     // create JSON value with string containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector (hack: create string first)
                     std::vector<uint8_t> expected(N, 'x');
@@ -1552,7 +1552,7 @@ TEST_CASE("CBOR")
 
                     // create JSON value with string containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector (hack: create string first)
                     std::vector<uint8_t> expected(N, 'x');
@@ -1581,7 +1581,7 @@ TEST_CASE("CBOR")
                 std::vector<std::uint8_t> input = {0x5F, 0x44, 0xaa, 0xbb, 0xcc, 0xdd, 0x43, 0xee, 0xff, 0x99, 0xFF};
                 auto j = json::from_cbor(input);
                 CHECK(j.is_binary());
-                auto k = json::binary_array({0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x99});
+                auto k = json::binary({0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x99});
                 CAPTURE(j.dump(0, ' ', false, json::error_handler_t::strict))
                 CHECK(j == k);
             }
@@ -1633,7 +1633,7 @@ TEST_CASE("CBOR")
                                           0x00, 0x00, 0x00, 0x01, 0x61
                                          };
             json j = json::from_cbor(given);
-            CHECK(j == json::binary_array(std::vector<uint8_t> {'a'}));
+            CHECK(j == json::binary(std::vector<uint8_t> {'a'}));
         }
 
         SECTION("0x7b (string)")
@@ -2502,7 +2502,7 @@ TEST_CASE("examples from RFC 7049 Appendix A")
         std::ifstream f_bin(TEST_DATA_DIRECTORY "/binary_data/cbor_binary.out", std::ios::binary);
         std::vector<uint8_t> expected((std::istreambuf_iterator<char>(f_bin)),
                                       std::istreambuf_iterator<char>());
-        CHECK(j == json::binary_array(expected));
+        CHECK(j == json::binary(expected));
     }
 
     SECTION("arrays")
diff --git a/test/src/unit-comparison.cpp b/test/src/unit-comparison.cpp
index 91fbe1b4..db46507c 100644
--- a/test/src/unit-comparison.cpp
+++ b/test/src/unit-comparison.cpp
@@ -101,7 +101,7 @@ TEST_CASE("lexicographical comparison operators")
             true, false,
             {1, 2, 3}, {"one", "two", "three"},
             {{"first", 1}, {"second", 2}}, {{"a", "A"}, {"b", {"B"}}},
-            json::binary_array({1, 2, 3}), json::binary_array({1, 2, 4})
+            json::binary({1, 2, 3}), json::binary({1, 2, 4})
         };
 
         SECTION("comparison: equal")
diff --git a/test/src/unit-constructor1.cpp b/test/src/unit-constructor1.cpp
index 81fca64a..0240feef 100644
--- a/test/src/unit-constructor1.cpp
+++ b/test/src/unit-constructor1.cpp
@@ -121,7 +121,7 @@ TEST_CASE("constructors")
             auto t = json::value_t::binary;
             json j(t);
             CHECK(j.type() == t);
-            CHECK(j == json::binary_array({}));
+            CHECK(j == json::binary({}));
         }
     }
 
@@ -1482,12 +1482,12 @@ TEST_CASE("constructors")
                 SECTION("binary")
                 {
                     {
-                        json j = json::binary_array({1, 2, 3});
+                        json j = json::binary({1, 2, 3});
                         json j_new(j.begin(), j.end());
                         CHECK((j == j_new));
                     }
                     {
-                        json j = json::binary_array({1, 2, 3});
+                        json j = json::binary({1, 2, 3});
                         json j_new(j.cbegin(), j.cend());
                         CHECK((j == j_new));
                     }
diff --git a/test/src/unit-constructor2.cpp b/test/src/unit-constructor2.cpp
index 8bbb5197..df20695c 100644
--- a/test/src/unit-constructor2.cpp
+++ b/test/src/unit-constructor2.cpp
@@ -94,7 +94,7 @@ TEST_CASE("other constructors and destructor")
 
         SECTION("binary")
         {
-            json j = json::binary_array({1, 2, 3});
+            json j = json::binary({1, 2, 3});
             json k(j);
             CHECK(j == k);
         }
@@ -177,7 +177,7 @@ TEST_CASE("other constructors and destructor")
 
         SECTION("binary")
         {
-            json j = json::binary_array({1, 2, 3});
+            json j = json::binary({1, 2, 3});
             json k;
             k = j;
             CHECK(j == k);
diff --git a/test/src/unit-element_access1.cpp b/test/src/unit-element_access1.cpp
index 46638e27..a0a18fec 100644
--- a/test/src/unit-element_access1.cpp
+++ b/test/src/unit-element_access1.cpp
@@ -698,13 +698,13 @@ TEST_CASE("element access 1")
             SECTION("binary")
             {
                 {
-                    json j = json::binary_array({1, 2, 3});
+                    json j = json::binary({1, 2, 3});
                     json::iterator it = j.erase(j.begin());
                     CHECK(j.type() == json::value_t::null);
                     CHECK(it == j.end());
                 }
                 {
-                    json j = json::binary_array({1, 2, 3});
+                    json j = json::binary({1, 2, 3});
                     json::const_iterator it = j.erase(j.cbegin());
                     CHECK(j.type() == json::value_t::null);
                     CHECK(it == j.end());
@@ -896,13 +896,13 @@ TEST_CASE("element access 1")
             SECTION("binary")
             {
                 {
-                    json j = json::binary_array({1, 2, 3});
+                    json j = json::binary({1, 2, 3});
                     json::iterator it = j.erase(j.begin(), j.end());
                     CHECK(j.type() == json::value_t::null);
                     CHECK(it == j.end());
                 }
                 {
-                    json j = json::binary_array({1, 2, 3});
+                    json j = json::binary({1, 2, 3});
                     json::const_iterator it = j.erase(j.cbegin(), j.cend());
                     CHECK(j.type() == json::value_t::null);
                     CHECK(it == j.end());
diff --git a/test/src/unit-inspection.cpp b/test/src/unit-inspection.cpp
index d14b89af..a5f4519b 100644
--- a/test/src/unit-inspection.cpp
+++ b/test/src/unit-inspection.cpp
@@ -262,7 +262,7 @@ TEST_CASE("object inspection")
             // inside the dump() function
             CHECK(j.dump(1024).size() == 15472);
 
-            const auto binary = json::binary_array({1, 2, 3}, 128);
+            const auto binary = json::binary({1, 2, 3}, 128);
             CHECK(binary.dump(1024).size() == 2086);
         }
 
@@ -472,7 +472,7 @@ TEST_CASE("object inspection")
 
         SECTION("binary")
         {
-            json j = json::binary_array({});
+            json j = json::binary({});
             json::value_t t = j;
             CHECK(t == j.type());
         }
diff --git a/test/src/unit-modifiers.cpp b/test/src/unit-modifiers.cpp
index 955051a6..9214c608 100644
--- a/test/src/unit-modifiers.cpp
+++ b/test/src/unit-modifiers.cpp
@@ -110,7 +110,7 @@ TEST_CASE("modifiers")
         {
             SECTION("empty binary")
             {
-                json j = json::binary_array({});
+                json j = json::binary({});
                 json k = j;
 
                 j.clear();
@@ -121,7 +121,7 @@ TEST_CASE("modifiers")
 
             SECTION("filled binary")
             {
-                json j = json::binary_array({1, 2, 3, 4, 5});
+                json j = json::binary({1, 2, 3, 4, 5});
                 json k = j;
 
                 j.clear();
@@ -967,30 +967,30 @@ TEST_CASE("modifiers")
         {
             SECTION("binary_t type")
             {
-                json j = json::binary_array({1, 2, 3, 4});
+                json j = json::binary({1, 2, 3, 4});
                 json::binary_t s = {{5, 6, 7, 8}};
 
                 j.swap(s);
 
-                CHECK(j == json::binary_array({5, 6, 7, 8}));
+                CHECK(j == json::binary({5, 6, 7, 8}));
 
                 j.swap(s);
 
-                CHECK(j == json::binary_array({1, 2, 3, 4}));
+                CHECK(j == json::binary({1, 2, 3, 4}));
             }
 
             SECTION("binary_t::container_type type")
             {
-                json j = json::binary_array({1, 2, 3, 4});
+                json j = json::binary({1, 2, 3, 4});
                 std::vector<std::uint8_t> s = {{5, 6, 7, 8}};
 
                 j.swap(s);
 
-                CHECK(j == json::binary_array({5, 6, 7, 8}));
+                CHECK(j == json::binary({5, 6, 7, 8}));
 
                 j.swap(s);
 
-                CHECK(j == json::binary_array({1, 2, 3, 4}));
+                CHECK(j == json::binary({1, 2, 3, 4}));
             }
 
             SECTION("non-binary_t type")
diff --git a/test/src/unit-msgpack.cpp b/test/src/unit-msgpack.cpp
index acdafaa8..2fb89533 100644
--- a/test/src/unit-msgpack.cpp
+++ b/test/src/unit-msgpack.cpp
@@ -1132,7 +1132,7 @@ TEST_CASE("MessagePack")
 
                     // create JSON value with byte array containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
                     std::uint8_t subtype = 42;
                     j.get_binary().set_subtype(subtype);
 
@@ -1207,7 +1207,7 @@ TEST_CASE("MessagePack")
 
                     // create JSON value with string containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
                     std::uint8_t subtype = 42;
                     j.get_binary().set_subtype(subtype);
 
@@ -1243,7 +1243,7 @@ TEST_CASE("MessagePack")
 
                     // create JSON value with string containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
                     std::uint8_t subtype = 42;
                     j.get_binary().set_subtype(subtype);
 
@@ -1281,7 +1281,7 @@ TEST_CASE("MessagePack")
 
                     // create JSON value with byte array containing of N * 'x'
                     const auto s = std::vector<uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector
                     std::vector<std::uint8_t> expected;
@@ -1319,7 +1319,7 @@ TEST_CASE("MessagePack")
 
                     // create JSON value with string containing of N * 'x'
                     const auto s = std::vector<std::uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector (hack: create string first)
                     std::vector<std::uint8_t> expected(N, 'x');
@@ -1352,7 +1352,7 @@ TEST_CASE("MessagePack")
 
                     // create JSON value with string containing of N * 'x'
                     const auto s = std::vector<std::uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector (hack: create string first)
                     std::vector<uint8_t> expected(N, 'x');
diff --git a/test/src/unit-pointer_access.cpp b/test/src/unit-pointer_access.cpp
index 72ee1ab7..36a05249 100644
--- a/test/src/unit-pointer_access.cpp
+++ b/test/src/unit-pointer_access.cpp
@@ -443,7 +443,7 @@ TEST_CASE("pointer access")
     SECTION("pointer access to const binary_t")
     {
         using test_type = const json::binary_t;
-        const json value = json::binary_array({1, 2, 3});
+        const json value = json::binary({1, 2, 3});
 
         // check if pointers are returned correctly
         test_type* p1 = value.get_ptr<test_type*>();
@@ -472,7 +472,7 @@ TEST_CASE("pointer access")
     SECTION("pointer access to const binary_t")
     {
         using test_type = const json::binary_t;
-        const json value = json::binary_array({});
+        const json value = json::binary({});
 
         // check if pointers are returned correctly
         test_type* p1 = value.get_ptr<test_type*>();
diff --git a/test/src/unit-serialization.cpp b/test/src/unit-serialization.cpp
index d0ddc58f..067d44c6 100644
--- a/test/src/unit-serialization.cpp
+++ b/test/src/unit-serialization.cpp
@@ -209,10 +209,10 @@ TEST_CASE_TEMPLATE("serialization for extreme integer values", T, int32_t, uint3
 
 TEST_CASE("dump with binary values")
 {
-    auto binary = json::binary_array({1, 2, 3, 4});
-    auto binary_empty = json::binary_array({});
-    auto binary_with_subtype = json::binary_array({1, 2, 3, 4}, 128);
-    auto binary_empty_with_subtype = json::binary_array({}, 128);
+    auto binary = json::binary({1, 2, 3, 4});
+    auto binary_empty = json::binary({});
+    auto binary_with_subtype = json::binary({1, 2, 3, 4}, 128);
+    auto binary_empty_with_subtype = json::binary({}, 128);
 
     json object = {{"key", binary}};
     json object_empty = {{"key", binary_empty}};
diff --git a/test/src/unit-ubjson.cpp b/test/src/unit-ubjson.cpp
index e3395bf2..d6dde7ad 100644
--- a/test/src/unit-ubjson.cpp
+++ b/test/src/unit-ubjson.cpp
@@ -921,7 +921,7 @@ TEST_CASE("UBJSON")
 
                     // create JSON value with byte array containing of N * 'x'
                     const auto s = std::vector<std::uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector
                     std::vector<std::uint8_t> expected;
@@ -972,7 +972,7 @@ TEST_CASE("UBJSON")
 
                     // create JSON value with byte array containing of N * 'x'
                     const auto s = std::vector<std::uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector
                     std::vector<uint8_t> expected;
@@ -1012,7 +1012,7 @@ TEST_CASE("UBJSON")
 
                     // create JSON value with byte array containing of N * 'x'
                     const auto s = std::vector<std::uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector
                     std::vector<std::uint8_t> expected(N + 7, 'x');
@@ -1049,7 +1049,7 @@ TEST_CASE("UBJSON")
 
                     // create JSON value with byte array containing of N * 'x'
                     const auto s = std::vector<std::uint8_t>(N, 'x');
-                    json j = json::binary_array(s);
+                    json j = json::binary(s);
 
                     // create expected byte vector
                     std::vector<std::uint8_t> expected(N + 9, 'x');
@@ -1081,7 +1081,7 @@ TEST_CASE("UBJSON")
             {
                 const std::size_t N = 10;
                 const auto s = std::vector<std::uint8_t>(N, 'x');
-                json j = json::binary_array(s);
+                json j = json::binary(s);
 
                 SECTION("No Count No Type")
                 {
diff --git a/test/src/unit-udt.cpp b/test/src/unit-udt.cpp
index 42b1375e..bb1c1f1b 100644
--- a/test/src/unit-udt.cpp
+++ b/test/src/unit-udt.cpp
@@ -765,7 +765,7 @@ TEST_CASE("different basic_json types conversions")
 
     SECTION("binary")
     {
-        json j = json::binary_array({1, 2, 3});
+        json j = json::binary({1, 2, 3});
         custom_json cj = j;
         CHECK(cj.get_binary() == j.get_binary());
     }