Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
grisumbras committed Jun 16, 2023
1 parent 9d848ed commit 3f4f931
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/snippets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <numeric>
#include <string>
#include <vector>
#include <iostream>

#include "test_suite.hpp"
#include "doc_types.hpp"
Expand Down Expand Up @@ -218,12 +219,24 @@ tag_invoke(
{
boost::json::object& jo = jv.emplace_object();

std::cerr << "0 maps_as_objects\n";
for( const auto& item: m )
{
{std::cerr << "1 maps_as_objects\n";
auto k = boost::json::value_from( item.first, ctx, jo.storage() );
{std::cerr << "2 " << k << " maps_as_objects\n";
auto v = boost::json::value_from( item.second, ctx, jo.storage() );
jo[std::move( k.as_string() )] = std::move( v );
{std::cerr << "3 " << v << " maps_as_objects\n";
auto& xxx = jo[std::move( k.as_string() )];
{std::cerr << "4 " << xxx << " maps_as_objects\n";
xxx = std::move( v );
std::cerr << "5 " << jo << " maps_as_objects\n";}
std::cerr << "6 maps_as_objects\n";}
std::cerr << "7 maps_as_objects\n";}
std::cerr << "8 maps_as_objects\n";}
std::cerr << "8 maps_as_objects\n";
}
std::cerr << "9 maps_as_objects\n";
}

template<
Expand Down Expand Up @@ -1101,15 +1114,18 @@ usingContextualConversions()
time_point start;
//[doc_context_conversion_9

{std::cerr << "0\n";
std::map< time_point, ip_address > log = {
{ start += std::chrono::seconds(10), {192, 168, 10, 11} },
{ start += std::chrono::hours(2), {192, 168, 10, 13} },
{ start += std::chrono::minutes(14), {192, 168, 10, 10} },
};

{std::cerr << "1\n";
value jv = value_from(
log,
std::make_tuple( maps_as_objects(), as_string(), as_iso_8601() ) );
{std::cerr << "2\n";
assert( jv == parse(
" { "
" \"1970-01-01T00:00:10\": \"192.168.10.11\", "
Expand All @@ -1119,7 +1135,12 @@ usingContextualConversions()
) );
//]
(void)jv;
std::cerr << "3\n";}
std::cerr << "4\n";}
std::cerr << "5\n";}
std::cerr << "6\n";
}
std::cerr << "7\n";
}

} // namespace
Expand All @@ -1140,8 +1161,10 @@ class snippets_test
usingSpecializedTrait();
usingSetAtPointer();
usingContextualConversions();
std::cerr << "8\n";

BOOST_TEST_PASS();
std::cerr << "9\n";
}
};

Expand Down

0 comments on commit 3f4f931

Please sign in to comment.