....
This commit is contained in:
@@ -3,13 +3,65 @@
|
||||
#include <doctest/doctest.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "../common/adc_utils.h"
|
||||
#include "../net/adc_netmessage.h"
|
||||
// #include "../common/adc_utils.h"
|
||||
// #include "../net/adc_netmessage.h"
|
||||
|
||||
#include "../net/adc_netmsg.h"
|
||||
|
||||
using namespace adc;
|
||||
|
||||
static constexpr char DD[] = "=";
|
||||
static constexpr char TD[] = "-";
|
||||
|
||||
|
||||
TEST_CASE("[ADC NET MESSAGE]")
|
||||
{
|
||||
AdcKeyTokenNetMessage<DD> msg;
|
||||
|
||||
std::string_view bytes{"SET=POS 1 2 3 4 5"};
|
||||
|
||||
std::cout << "INPUT BYTES: [" << bytes << "]\n";
|
||||
|
||||
msg.setFromBytes(bytes.begin(), bytes.end());
|
||||
|
||||
auto keyv = msg.keyView();
|
||||
auto keyb = msg.keyBytes();
|
||||
|
||||
std::cout << "KEY VIEW: [" << keyv << "]\n";
|
||||
std::cout << "KEY BYTE: [" << keyb << "]\n";
|
||||
|
||||
auto tks = msg.tokens(1, 3);
|
||||
for (auto& el : tks) {
|
||||
std::cout << "TOKEN: [" << el << "]\n";
|
||||
}
|
||||
|
||||
auto t2 = msg.bytesView();
|
||||
for (auto& el : t2) {
|
||||
std::cout << "BYTES VIEW: [" << el << "]\n";
|
||||
}
|
||||
|
||||
|
||||
std::cout << "\n\n---------\n\n";
|
||||
|
||||
|
||||
msg.setTokens("FILTER", "A1", "B3");
|
||||
std::cout << "BYTES: " << msg.bytes() << "\n";
|
||||
|
||||
std::cout << "\n\n---------\n\n";
|
||||
|
||||
|
||||
AdcTokenNetMessage<> tmsg;
|
||||
std::list<char> bb{'1', ' ', '2', ' ', '3', ' ', '4', ' ', '5'};
|
||||
|
||||
tmsg.setFromBytes(bb.begin(), bb.end());
|
||||
|
||||
auto t1 = tmsg.bytesView();
|
||||
for (auto& el : t1) {
|
||||
std::cout << "TOKEN VIEW: [" << el << "]\n";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
TEST_CASE("[ADC NET MESSAGE]")
|
||||
{
|
||||
AdcKeyParamNetMessage<DD> msg;
|
||||
@@ -73,3 +125,5 @@ TEST_CASE("[ADC NET MESSAGE]")
|
||||
std::cout << "\n\nN = " << N << "\n";
|
||||
std::cout << sr << "\n";
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user