OpenVPN 3 Core Library
Loading...
Searching...
No Matches
test_comp.cpp File Reference
#include <iostream>
#include <algorithm>
#include "test_common.hpp"
#include <openvpn/common/size.hpp>
#include <openvpn/common/exception.hpp>
#include <openvpn/common/file.hpp>
#include <openvpn/buffer/buffer.hpp>
#include <openvpn/compress/compress.hpp>
#include <openvpn/compress/lzoasym.hpp>
#include <openvpn/frame/frame.hpp>
Include dependency graph for test_comp.cpp:

Go to the source code of this file.

Classes

class  MySessionStats
 

Namespaces

namespace  unittests
 

Macros

#define BLOCK_SIZE   1500
 
#define N_COMPRESS   1
 
#define N_EXPAND   1
 
#define SUPPORT_SWAP   false
 

Enumerations

enum class  comppair { lzo , lzoasym , snappy , lz4 }
 

Functions

Frame::Ptr frame_init (const size_t payload)
 
void verify_eq (const Buffer &b1, const Buffer &b2)
 
void test (const std::string &filename, Compress &compressor, Compress &decompressor, const Frame &frame, const size_t block_size, const size_t n_compress, const size_t n_expand_per_compress, size_t &bytes, size_t &compress_bytes)
 
void test_with_corpus (Compress &compressor, Compress &decompressor, const Frame &frame, const size_t block_size, const size_t n_compress, const size_t n_expand_per_compress, size_t &bytes, size_t &compress_bytes)
 
void runTest (comppair alg, bool verbose=false)
 

Macro Definition Documentation

◆ BLOCK_SIZE

#define BLOCK_SIZE   1500

Definition at line 16 of file test_comp.cpp.

◆ N_COMPRESS

#define N_COMPRESS   1

Definition at line 20 of file test_comp.cpp.

◆ N_EXPAND

#define N_EXPAND   1

To test and compare speed of the decompression algorithms define N_EXPAND to be more than 1 by either editing this define or by adding a -DN_EXPAND=1000 or -DN_COMPRESS=1000 for the compression speed in the CmakeLists and looks at the time the unit test take for the different combinations.

Definition at line 30 of file test_comp.cpp.

◆ SUPPORT_SWAP

#define SUPPORT_SWAP   false

Definition at line 34 of file test_comp.cpp.

Enumeration Type Documentation

◆ comppair

enum class comppair
strong
Enumerator
lzo 
lzoasym 
snappy 
lz4 

Definition at line 182 of file test_comp.cpp.

Function Documentation

◆ frame_init()

Frame::Ptr frame_init ( const size_t  payload)

Definition at line 53 of file test_comp.cpp.

◆ runTest()

void runTest ( comppair  alg,
bool  verbose = false 
)

Definition at line 190 of file test_comp.cpp.

◆ test()

void test ( const std::string &  filename,
Compress compressor,
Compress decompressor,
const Frame frame,
const size_t  block_size,
const size_t  n_compress,
const size_t  n_expand_per_compress,
size_t &  bytes,
size_t &  compress_bytes 
)

Definition at line 98 of file test_comp.cpp.

◆ test_with_corpus()

void test_with_corpus ( Compress compressor,
Compress decompressor,
const Frame frame,
const size_t  block_size,
const size_t  n_compress,
const size_t  n_expand_per_compress,
size_t &  bytes,
size_t &  compress_bytes 
)

Definition at line 139 of file test_comp.cpp.

Here is the caller graph for this function:

◆ verify_eq()

void verify_eq ( const Buffer b1,
const Buffer b2 
)
inline

Definition at line 93 of file test_comp.cpp.

Here is the caller graph for this function: