0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 07:20:55 +01:00

fixup! What is the Matrix? Control.

This commit is contained in:
Jason Volk 2017-03-15 12:08:26 -07:00
parent c9ddf4f6ab
commit 150583c711

View file

@ -820,95 +820,3 @@ ircd::json::type(const string_view &buf)
return ret;
}
///////////////////////////////////////////////////////////////////////////////
//
// ircd/json.h
//
/*
const char *const packet_test
{R"({
"betty": 1,
"boop": "beep"
})"};
*/
const char *const packet_test[]
{
R"({"type":"m.login.password"})",
R"({"type":"m.login.password","user":"jzk","password":"foobar"})",
R"({"type":"m.login.password","user":"jzk","password":1.337,"number":1337})",
R"({"user":{"name":"jzk"},"pass":true})",
R"({"type":"m.login.password","user":{"name":{"text":"jzk"}}})",
R"({"type":"m.login.password","bap":"boop","user":{"name":"jzk"},"password":"hi"})",
R"({"type":"m.login.password","user":{"name":"jzk","profile":{"foo":"bar"}},"password":1.337,"logins":1337})",
R"({"user":{"name":"jzk"}})",
R"({ "versions": [ "r0.0.1" , "r0.1.0" , "r0.2.0" ] })",
R"(
{
"origin_server_ts": 1444812213737,
"user_id": "@alice:example.com",
"event_id": "$1444812213350496Caaaa:example.com",
"content": {
"body": "hello world",
"msgtype":"m.text"
},
"room_id":"!Xq3620DUiqCaoxq:example.com",
"type":"m.room.message",
"age": 1042
}
)",
};
void
ircd::json::test()
{
static char packet[4096] {0};
strcpy(packet, packet_test[9]);
const auto max(strlen(packet));
printf("packet(%zu) @%p [%s]\n\n", max, packet, packet);
std::cout << std::endl;
std::cout << std::endl;
const char *ptr(packet);
const char *const stop(packet + max);
const json::doc doc
{
string_view { ptr, stop }
};
const json::obj obj{doc};
std::cout << obj["type"] << std::endl;
//json::delta foo(doc.find("type")->first, 1234);
//std::cout << "[" << foo.first << "]" << std::endl;
//std::cout << "[" << foo.second << "]" << std::endl;
//std::cout << "[" << obj["type"] << "]" << std::endl;
//obj["type"] = "cya";
//std::cout << "[" << obj["type"] << "]" << std::endl;
//printf("test (%zu)\n", ret.size());
// for(const auto &sv : ret)
// printf("[%s]\n", sv.data());
//printf("[%s]\n", ret.data());
}
namespace ircd {
namespace json {
} // namespace json
} // namespace ircd