Skip to content

Commit

Permalink
add last release after read + color all tests passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Brat-vseznamus committed Nov 20, 2024
1 parent 724bf32 commit 56c609a
Show file tree
Hide file tree
Showing 24 changed files with 1,497 additions and 159 deletions.
1 change: 1 addition & 0 deletions internal/tlcodegen/test/codegen_test/cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ run-all-tests:
mkdir -p build
make run-objects-test
make run-functions-test
echo "\n\033[0;32mAll tests passed!\033[0m\n"

clean-build:
rm -rf build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ int main() {
std::string used_output;
if (read_result) {
test_result = test_function->read_write_result(input2, output);

output.last_release();
used_output = {reinterpret_cast<char*>(output_str.used_buffer().data()), output_str.used_buffer().size()};
if (test_result) {
test_result = used_output == expected_result_output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ int main() {
bool read_result = test_object->read(input);
bool write_result = test_object->write(output);

output.last_release();
std::string used_output{reinterpret_cast<char*>(output_str.used_buffer().data()), output_str.used_buffer().size()};
bool test_result = write_result && read_result;
if (test_result) {
Expand Down
1 change: 0 additions & 1 deletion internal/tlcodegen/test/gen/cases_cpp/basics/string_io.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
#include "basictl.h"
#include "string_io.h"
Expand Down
1 change: 0 additions & 1 deletion internal/tlcodegen/test/gen/cases_cpp/basics/string_io.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
#pragma once
#include "basictl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,21 +502,25 @@ bool tl2::True::write_json(std::ostream& s)const {

bool tl2::True::read(::basictl::tl_istream & s) {
if (!::tl2::details::TrueRead(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::True::write(::basictl::tl_ostream & s)const {
if (!::tl2::details::TrueWrite(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::True::read_boxed(::basictl::tl_istream & s) {
if (!::tl2::details::TrueReadBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::True::write_boxed(::basictl::tl_ostream & s)const {
if (!::tl2::details::TrueWriteBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

Expand Down
28 changes: 28 additions & 0 deletions internal/tlcodegen/test/gen/cases_cpp/tl/benchmarks/details.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ bool tl2::benchmarks::Vruhash::write_json(std::ostream& s)const {

bool tl2::benchmarks::Vruhash::read(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVruHashRead(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::Vruhash::write(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVruHashWrite(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::Vruhash::read_boxed(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVruHashReadBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::Vruhash::write_boxed(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVruHashWriteBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

Expand Down Expand Up @@ -89,21 +93,25 @@ bool tl2::benchmarks::Vruposition::write_json(std::ostream& s)const {

bool tl2::benchmarks::Vruposition::read(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVruPositionRead(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::Vruposition::write(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVruPositionWrite(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::Vruposition::read_boxed(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVruPositionReadBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::Vruposition::write_boxed(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVruPositionWriteBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

Expand Down Expand Up @@ -294,21 +302,25 @@ bool tl2::benchmarks::VrutoyPositions::write_json(std::ostream& s, uint32_t nat_

bool tl2::benchmarks::VrutoyPositions::read(::basictl::tl_istream & s, uint32_t nat_n) {
if (!::tl2::details::BenchmarksVrutoyPositionsRead(s, *this, nat_n)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyPositions::write(::basictl::tl_ostream & s, uint32_t nat_n)const {
if (!::tl2::details::BenchmarksVrutoyPositionsWrite(s, *this, nat_n)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyPositions::read_boxed(::basictl::tl_istream & s, uint32_t nat_n) {
if (!::tl2::details::BenchmarksVrutoyPositionsReadBoxed(s, *this, nat_n)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyPositions::write_boxed(::basictl::tl_ostream & s, uint32_t nat_n)const {
if (!::tl2::details::BenchmarksVrutoyPositionsWriteBoxed(s, *this, nat_n)) { return false; }
s.last_release();
return true;
}

Expand Down Expand Up @@ -353,21 +365,25 @@ bool tl2::benchmarks::VrutoyTopLevelContainer::write_json(std::ostream& s)const

bool tl2::benchmarks::VrutoyTopLevelContainer::read(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerRead(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyTopLevelContainer::write(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerWrite(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyTopLevelContainer::read_boxed(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerReadBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyTopLevelContainer::write_boxed(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerWriteBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

Expand Down Expand Up @@ -410,21 +426,25 @@ bool tl2::benchmarks::VrutoyTopLevelContainerWithDependency::write_json(std::ost

bool tl2::benchmarks::VrutoyTopLevelContainerWithDependency::read(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerWithDependencyRead(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyTopLevelContainerWithDependency::write(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerWithDependencyWrite(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyTopLevelContainerWithDependency::read_boxed(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerWithDependencyReadBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoyTopLevelContainerWithDependency::write_boxed(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoyTopLevelContainerWithDependencyWriteBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

Expand Down Expand Up @@ -547,21 +567,25 @@ bool tl2::benchmarks::VrutoytopLevelUnionBig::write_json(std::ostream& s)const {

bool tl2::benchmarks::VrutoytopLevelUnionBig::read(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionBigRead(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoytopLevelUnionBig::write(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionBigWrite(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoytopLevelUnionBig::read_boxed(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionBigReadBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoytopLevelUnionBig::write_boxed(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionBigWriteBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

Expand Down Expand Up @@ -606,21 +630,25 @@ bool tl2::benchmarks::VrutoytopLevelUnionEmpty::write_json(std::ostream& s)const

bool tl2::benchmarks::VrutoytopLevelUnionEmpty::read(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionEmptyRead(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoytopLevelUnionEmpty::write(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionEmptyWrite(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoytopLevelUnionEmpty::read_boxed(::basictl::tl_istream & s) {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionEmptyReadBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

bool tl2::benchmarks::VrutoytopLevelUnionEmpty::write_boxed(::basictl::tl_ostream & s)const {
if (!::tl2::details::BenchmarksVrutoytopLevelUnionEmptyWriteBoxed(s, *this)) { return false; }
s.last_release();
return true;
}

Expand Down
Loading

0 comments on commit 56c609a

Please sign in to comment.