Initial release
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
##########################################################################################
|
||||
# VSTGUI base64codecspeed
|
||||
##########################################################################################
|
||||
set(target base64codecspeed)
|
||||
|
||||
set(${target}_sources
|
||||
"main.cpp"
|
||||
"../../lib/vstguidebug.cpp"
|
||||
)
|
||||
|
||||
##########################################################################################
|
||||
include_directories(../../../)
|
||||
add_executable(${target}
|
||||
${${target}_sources}
|
||||
)
|
||||
target_link_libraries(${target}
|
||||
${${target}_PLATFORM_LIBS}
|
||||
)
|
||||
|
||||
vstgui_set_cxx_version(${target} ${VSTGUI_CXX_VERSION})
|
||||
set_target_properties(${target} PROPERTIES ${APP_PROPERTIES} FOLDER Tests)
|
||||
target_compile_definitions(${target} ${VSTGUI_COMPILE_DEFINITIONS})
|
||||
@@ -0,0 +1,30 @@
|
||||
// This file is part of VSTGUI. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this
|
||||
// distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
|
||||
|
||||
#include "vstgui/uidescription/base64codec.h"
|
||||
#include "vstgui/lib/malloc.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
|
||||
using namespace VSTGUI;
|
||||
|
||||
int main ()
|
||||
{
|
||||
Buffer<uint8_t> origData;
|
||||
origData.allocate (1024*1024*500);
|
||||
|
||||
std::independent_bits_engine<std::default_random_engine, sizeof (uint16_t) * 8, uint16_t> rbe;
|
||||
std::generate (origData.get (), origData.get () + origData.size (), std::ref (rbe));
|
||||
|
||||
auto encoderResult = Base64Codec::encode (origData.get (), origData.size ());
|
||||
auto decoderResult = Base64Codec::decode (encoderResult.data.get (), encoderResult.dataSize);
|
||||
|
||||
if (origData.size () != decoderResult.dataSize)
|
||||
return -1;
|
||||
|
||||
if (memcmp (origData.get (), decoderResult.data.get (), origData.size ()) != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user