Skip to content

Commit

Permalink
test cpp file for example
Browse files Browse the repository at this point in the history
  • Loading branch information
Brat-vseznamus committed Jun 12, 2024
1 parent 77fd6bd commit 2a8772a
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions internal/tlcodegen/test/gen/test_cpp.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <iostream>
#include "cpp/a.top2.hpp"
#include "cpp/a.top3.hpp"

std::string to_hex(const uint8_t *data, size_t count) {
static const char hexdigits[] = "0123456789abcdef";
Expand All @@ -16,25 +15,17 @@ std::string to_hex(const uint8_t *data, size_t count) {

int main() {
basictl::tl_ostream_string str;
basictl::tl_ostream_string str2;


tl2::a::Top2 top2;

top2.write(str);
auto & buf = str.get_buffer();
std::cout << top2.tl_name() << ": " << to_hex(reinterpret_cast<const uint8_t *>(buf.data()), buf.size()) << std::endl;

tl2::a::Top3 top3;
top3.n = 2;
// top3.a.a = "Hi!";
top3.c.b.a.a.push_back(5);
top3.c.b.a.a.push_back(7);

basictl::tl_ostream_string str2;

top3.write(str2);

auto & buf2 = str2.get_buffer();
std::cout << top3.tl_name() << ": " << to_hex(reinterpret_cast<const uint8_t *>(buf2.data()), buf2.size()) << std::endl;
// top3.write(str2);

// std::cout << top3.tl_name() << ": " << to_hex(reinterpret_cast<const uint8_t *>(buf2.data()), buf2.size()) << std::endl;
return 0;
}

0 comments on commit 2a8772a

Please sign in to comment.