Sha256: 0e5728036275454c88ec1439cf9e1d3b8334850342b7415043035a601ffdbb51

Contents?: true

Size: 1.07 KB

Versions: 16

Compression:

Stored size: 1.07 KB

Contents

// Copyright (c) 2019-2020 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/json/

#include "test.hpp"

#include <tao/json/events/invalid_string_to_binary.hpp>
#include <tao/json/events/invalid_string_to_exception.hpp>
#include <tao/json/events/invalid_string_to_hex.hpp>
#include <tao/json/jaxn/to_string.hpp>
#include <tao/json/to_string.hpp>
#include <tao/json/value.hpp>

namespace tao::json
{
   void test( const value& v, const std::string& b, const std::string& h )
   {
      TEST_ASSERT( jaxn::to_string< events::invalid_string_to_binary >( v ) == b );
      TEST_ASSERT( jaxn::to_string< events::invalid_string_to_hex >( v ) == h );
      TEST_THROWS( to_string< events::invalid_string_to_exception >( v ) );
   }

   void unit_test()
   {
      test( "\x80", "$80", "\"80\"" );
      test( "\xC0", "$C0", "\"C0\"" );
      test( "\xC0\x80", "$C080", "\"C080\"" );

      test( "A\xC0"
            "B\x80"
            "C",
            "$41C0428043",
            "\"41C0428043\"" );
   }

}  // namespace tao::json

#include "main.hpp"

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.4-universal-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.4 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.3-x86_64-linux ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.3-x86_64-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.3-universal-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.3 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.2-x86_64-linux ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.2-x86_64-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.2-universal-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.2 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.1-x86_64-linux ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.1-x86_64-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.1-universal-darwin-19 ext/third_party/json/src/test/json/validate_utf8.cpp
couchbase-3.0.0.alpha.1 ext/third_party/json/src/test/json/validate_utf8.cpp