mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
major work on the broadcast admin and stress client
This commit is contained in:
@@ -139,6 +139,87 @@ private:
|
||||
std::string m_data;
|
||||
};
|
||||
|
||||
// test class for 9.7.* and 9.8.*
|
||||
/*class test_9_7_X : public test_case_handler {
|
||||
public:
|
||||
test_9_1_X(int minor, int subtest) : m_minor(minor),m_subtest(subtest){
|
||||
// needs more C++11 intializer lists =(
|
||||
m_test_sizes[0] = 65536;
|
||||
m_test_sizes[1] = 262144;
|
||||
m_test_sizes[2] = 1048576;
|
||||
m_test_sizes[3] = 4194304;
|
||||
m_test_sizes[4] = 8388608;
|
||||
m_test_sizes[5] = 16777216;
|
||||
}
|
||||
|
||||
void on_open(connection_ptr connection) {
|
||||
std::cout << "Test 9." << m_minor << "." << m_subtest;
|
||||
|
||||
|
||||
|
||||
m_data.reserve(m_test_sizes[m_subtest-1]);
|
||||
|
||||
if (m_minor == 1) {
|
||||
fill_utf8(connection,true);
|
||||
m_start_time = boost::posix_time::microsec_clock::local_time();
|
||||
connection->send(m_data,false);
|
||||
} else if (m_minor == 2) {
|
||||
fill_binary(connection,true);
|
||||
m_start_time = boost::posix_time::microsec_clock::local_time();
|
||||
connection->send(m_data,true);
|
||||
} else {
|
||||
std::cout << " has unknown definition." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Just does random ascii right now. True random UTF8 with multi-byte stuff
|
||||
// would probably be better
|
||||
void fill_utf8(connection_ptr connection,bool random = true) {
|
||||
if (random) {
|
||||
uint32_t data;
|
||||
for (int i = 0; i < m_test_sizes[m_subtest-1]; i++) {
|
||||
if (i%4 == 0) {
|
||||
data = uint32_t(connection->rand());
|
||||
}
|
||||
|
||||
m_data.push_back(char(((reinterpret_cast<uint8_t*>(&data)[i%4])%95)+32));
|
||||
}
|
||||
} else {
|
||||
m_data.assign(m_test_sizes[m_subtest-1],'*');
|
||||
}
|
||||
}
|
||||
|
||||
void fill_binary(connection_ptr connection, bool random = true) {
|
||||
if (random) {
|
||||
int32_t data;
|
||||
for (int i = 0; i < m_test_sizes[m_subtest-1]; i++) {
|
||||
if (i%4 == 0) {
|
||||
data = connection->rand();
|
||||
}
|
||||
|
||||
m_data.push_back((reinterpret_cast<char*>(&data))[i%4]);
|
||||
}
|
||||
} else {
|
||||
m_data.assign(m_test_sizes[m_subtest-1],'*');
|
||||
}
|
||||
}
|
||||
|
||||
void on_message(connection_ptr connection,websocketpp::message::data_ptr msg) {
|
||||
m_end_time = boost::posix_time::microsec_clock::local_time();
|
||||
|
||||
// Check whether the echoed data matches exactly
|
||||
m_pass = (msg->get_payload() == m_data);
|
||||
|
||||
connection->recycle(msg);
|
||||
this->end(connection);
|
||||
}
|
||||
private:
|
||||
int m_minor;
|
||||
int m_subtest;
|
||||
size_t m_test_sizes[6];
|
||||
std::string m_data;
|
||||
};*/
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
std::string uri;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user