diff options
| author | levlam <levlam@telegram.org> | 2023-08-08 16:26:28 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2023-08-08 16:26:28 +0300 |
| commit | 7887bbdb356c2db8e5658dc5f7ac058f1c59919f (patch) | |
| tree | 9d61fa95a638404c5c40ba2d6a9804be714abc5e /tdutils/test | |
| parent | 2bc8ec27df24c67ff87a31bd79820d37baa4b243 (diff) | |
Optimize json_string_skip.
Diffstat (limited to 'tdutils/test')
| -rw-r--r-- | tdutils/test/json.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tdutils/test/json.cpp b/tdutils/test/json.cpp index c61c7a450..cb74a9d16 100644 --- a/tdutils/test/json.cpp +++ b/tdutils/test/json.cpp @@ -373,6 +373,12 @@ TEST(JSON, bench_json_string_decode) { } static void test_string_decode(td::string str, const td::string &result) { + auto str_copy = str; + td::Parser skip_parser(str_copy); + auto status = td::json_string_skip(skip_parser); + ASSERT_TRUE(status.is_ok()); + ASSERT_TRUE(skip_parser.empty()); + td::Parser parser(str); auto r_value = td::json_string_decode(parser); ASSERT_TRUE(r_value.is_ok()); @@ -381,6 +387,11 @@ static void test_string_decode(td::string str, const td::string &result) { } static void test_string_decode_error(td::string str) { + auto str_copy = str; + td::Parser skip_parser(str_copy); + auto status = td::json_string_skip(skip_parser); + ASSERT_TRUE(status.is_error()); + td::Parser parser(str); auto r_value = td::json_string_decode(parser); ASSERT_TRUE(r_value.is_error()); |
