1 | #include <string> |
---|---|
2 | |
3 | #include <iostream> |
4 | |
5 | #include <Core/Types.h> |
6 | #include <IO/ReadHelpers.h> |
7 | #include <IO/ReadBufferFromMemory.h> |
8 | #include <IO/ConcatReadBuffer.h> |
9 | |
10 | |
11 | using namespace DB; |
12 | |
13 | int main(int, char **) |
14 | try |
15 | { |
16 | std::string s1 = "abc\\x\n"; |
17 | std::string s2 = "\tdef"; |
18 | |
19 | ReadBufferFromMemory rb1(s1.data(), 3); |
20 | ReadBufferFromMemory rb2(s2.data(), s2.size()); |
21 | |
22 | ConcatReadBuffer rb3(rb1, rb2); |
23 | |
24 | std::string read_s1; |
25 | std::string read_s2; |
26 | |
27 | readEscapedString(read_s1, rb3); |
28 | assertChar('\t', rb3); |
29 | readEscapedString(read_s2, rb3); |
30 | |
31 | std::cerr << read_s1 << ", "<< read_s2 << std::endl; |
32 | std::cerr << ((read_s1 == "abc"&& read_s2 == "def") ? "Ok.": "Fail.") << std::endl; |
33 | |
34 | return 0; |
35 | } |
36 | catch (const Exception & e) |
37 | { |
38 | std::cerr << e.what() << ", "<< e.displayText() << std::endl; |
39 | return 1; |
40 | } |
41 |