14 #include <gtest/gtest.h> 15 #include "../../include/ecl/converters/to_byte_array.hpp" 16 #include "../../include/ecl/converters/char.hpp" 17 #include "../../include/ecl/converters/char_strings.hpp" 18 #include "../../include/ecl/converters/string.hpp" 19 #include "../../include/ecl/converters/integers.hpp" 45 std::cout <<
"uintToAscii(8U): " << uintToAscii(8U) << std::endl;
46 std::cout <<
"intToAscii(8): " << intToAscii(8) << std::endl;
47 std::cout <<
"toAscii(8): " << toAscii(8) << std::endl;
48 std::cout <<
"toAscii(8U): " << toAscii(8U) << std::endl;
51 EXPECT_EQ(
'8',uintToAscii(8U));
52 EXPECT_EQ(
'8',intToAscii(8));
53 EXPECT_EQ(
'8',toAscii(8U));
54 EXPECT_EQ(
'8',toAscii(8));
60 std::cout <<
"intToString(123): " << intToString(123) << std::endl;
61 std::cout <<
"intToString(-123): " << intToString(-123) << std::endl;
63 EXPECT_EQ(
string(
"123"),intToString(123));
64 EXPECT_EQ(
string(
"-123"),intToString(-123));
70 std::cout <<
"toInt:" << std::endl;
71 std::cout <<
" string -> " << toInt(
string(
"123")) << std::endl;
73 std::cout <<
" char -> " << toInt(
'3') << std::endl;
75 EXPECT_EQ(123,toInt(
string(
"123")));
77 EXPECT_EQ(3,toInt(
char(
'3')));
84 unsigned char uc =
'A';
86 unsigned short us = 111;
88 unsigned int ui = 111;
90 unsigned long ul = 111;
91 long long ll = -111111;
92 unsigned long long ull = 11111111;
99 std::cout <<
"toCharString:" << std::endl;
100 std::cout <<
" char -> " << toCharString(c) << std::endl;
101 std::cout <<
" unsigned char -> " << toCharString(uc) << std::endl;
102 std::cout <<
" short -> " << toCharString(s) << std::endl;
103 std::cout <<
" unsigned short-> " << toCharString(us) << std::endl;
104 std::cout <<
" int -> " << toCharString(i) << std::endl;
105 std::cout <<
" unsigned int -> " << toCharString(ui) << std::endl;
106 std::cout <<
" long -> " << toCharString(l) << std::endl;
107 std::cout <<
" unsigned long -> " << toCharString(ul) << std::endl;
108 std::cout <<
" long long -> " << toCharString(ll) << std::endl;
109 std::cout <<
" unsigned llong-> " << toCharString(ull) << std::endl;
110 std::cout <<
" float -> " << toCharString(f) << std::endl;
111 std::cout <<
" double -> " << toCharString(d) << std::endl;
112 std::cout <<
" float(2) -> " << toCharString(f,2) << std::endl;
113 std::cout <<
" double(2) -> " << toCharString(d,2) << std::endl;
114 std::cout <<
" float (w/ buf)-> " << floatToCharString(f) << std::endl;
123 int main(
int argc,
char **argv) {
124 testing::InitGoogleTest(&argc,argv);
125 return RUN_ALL_TESTS();
int main(int argc, char **argv)
Primary template and general fallback for converter classes.
void f(int i) ecl_debug_throw_decl(StandardException)