1#include <string>
2
3#include <iostream>
4#include <sstream>
5
6#include <Core/Types.h>
7#include <IO/ReadBufferFromString.h>
8#include <IO/WriteBufferFromString.h>
9#include <IO/ReadHelpers.h>
10#include <IO/WriteHelpers.h>
11
12
13int main(int, char **)
14{
15 try
16 {
17 Int64 x1 = std::numeric_limits<Int64>::min();
18 Int64 x2 = 0;
19 std::string s;
20
21 std::cerr << static_cast<Int64>(x1) << std::endl;
22
23 {
24 DB::WriteBufferFromString wb(s);
25 DB::writeIntText(x1, wb);
26 }
27
28 std::cerr << s << std::endl;
29
30 {
31 DB::ReadBufferFromString rb(s);
32 DB::readIntText(x2, rb);
33 }
34
35 std::cerr << static_cast<Int64>(x2) << std::endl;
36 }
37 catch (const DB::Exception & e)
38 {
39 std::cerr << e.what() << ", " << e.displayText() << std::endl;
40 return 1;
41 }
42
43 return 0;
44}
45