Skip to content

Commit

Permalink
test: drop decodeUserTuple helper
Browse files Browse the repository at this point in the history
The helper is not used since it is trivial to decode data with new
decoder, so let's drop it.

Along the way, alias Buf_t is moved from TupleReader.hpp since it has
nothing in common with tuple definition. Also, the header is renamed to
UserTuple.hpp since it contains only tuple definition now. And, while we
are here, headers in Client tests and UserTuple.hpp are sorted, linter
warning are fixed.
  • Loading branch information
drewdzzz committed Jan 30, 2024
1 parent 42654f6 commit c3d1d8a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
6 changes: 4 additions & 2 deletions test/ClientPerfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
* SUCH DAMAGE.
*/
#include "Utils/Helpers.hpp"
#include "Utils/TupleReader.hpp"
#include "Utils/System.hpp"
#include "Utils/PerfTimer.hpp"
#include "Utils/System.hpp"
#include "Utils/UserTuple.hpp"

#include "../src/Client/Connector.hpp"
#include "../src/Client/LibevNetProvider.hpp"
Expand All @@ -54,6 +54,8 @@ constexpr size_t NUM_TEST = 500;
constexpr size_t TOTAL_REQ = NUM_REQ * NUM_TEST;
constexpr size_t NUM_CONN = 1;

using Buf_t = tnt::Buffer<16 * 1024>;

struct RequestResult {
double rps;
size_t server_rps;
Expand Down
4 changes: 3 additions & 1 deletion test/ClientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
* SUCH DAMAGE.
*/
#include "Utils/Helpers.hpp"
#include "Utils/TupleReader.hpp"
#include "Utils/System.hpp"
#include "Utils/UserTuple.hpp"

#include "../src/Client/LibevNetProvider.hpp"
#include "../src/Client/Connector.hpp"
Expand All @@ -41,6 +41,8 @@ int dummy_server_port = 3302;
const char *unixsocket = "./tnt.sock";
int WAIT_TIMEOUT = 1000; //milliseconds

using Buf_t = tnt::Buffer<16 * 1024>;

#ifdef TNTCXX_ENABLE_SSL
constexpr bool enable_ssl = true;
constexpr StreamTransport transport = STREAM_SSL;
Expand Down
20 changes: 3 additions & 17 deletions test/Utils/TupleReader.hpp → test/Utils/UserTuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
* SUCH DAMAGE.
*/
#include "../src/Buffer/Buffer.hpp"
#include "../src/mpp/mpp.hpp"
#include "../src/mpp/Dec.hpp"
#include "../src/Client/ResponseDecoder.hpp"
#include "../src/mpp/mpp.hpp"

/** Corresponds to data stored in _space[512]. */
struct UserTuple {
Expand All @@ -46,24 +45,11 @@ struct UserTuple {
&UserTuple::field4);
};

std::ostream&
operator<<(std::ostream& strm, const UserTuple &t)
std::ostream &
operator<<(std::ostream &strm, const UserTuple &t)
{
return strm << "Tuple: field1=" << t.field1 << " field2=" << t.field2 <<
" field3=" << t.field3 <<
" field4.first=" << t.field4.first <<
" field4.second=" << t.field4.second;
}

using Buf_t = tnt::Buffer<16 * 1024>;

template <class BUFFER>
std::vector<UserTuple>
decodeUserTuple(Data<BUFFER> &data)
{
std::vector<UserTuple> result;
bool ok = data.decode(result);
if (!ok)
return std::vector<UserTuple>();
return result;
}

0 comments on commit c3d1d8a

Please sign in to comment.