forked from lthn/blockchain
fixed cmake, fixed compilation problems, implemented plain_api test draft
This commit is contained in:
parent
e6dd2d28a5
commit
c0f1d7b577
6 changed files with 71 additions and 12 deletions
|
|
@ -163,11 +163,15 @@ if(STATIC)
|
|||
endif()
|
||||
|
||||
|
||||
#find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options ) #locale
|
||||
set(Boost_INCLUDE_DIRS "/Users/roky/projects/Zano/mobile_repo/ofxiOSBoost/libs/boost/include")
|
||||
set(Boost_LIBRARY_DIRS "/Users/roky/projects/Zano/mobile_repo/ofxiOSBoost/libs/boost/ios/")
|
||||
set(Boost_LIBRARIES "libboost.a")
|
||||
set(Boost_VERSION "ofxiOSBoost 1.60.0")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
set(Boost_INCLUDE_DIRS "/Users/roky/projects/Zano/mobile_repo/ofxiOSBoost/libs/boost/include")
|
||||
set(Boost_LIBRARY_DIRS "/Users/roky/projects/Zano/mobile_repo/ofxiOSBoost/libs/boost/ios/")
|
||||
set(Boost_LIBRARIES "libboost.a")
|
||||
set(Boost_VERSION "ofxiOSBoost 1.60.0")
|
||||
else()
|
||||
find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options ) #locale
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
message(STATUS "Boost: ${Boost_VERSION} from ${Boost_LIBRARY_DIRS}")
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib")
|
|||
set_property(TARGET zlibstatic PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET mdbx PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET lmdb PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET upnpc-static mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat minigzip zlib example PROPERTY FOLDER "unused")
|
||||
#set_property(TARGET upnpc-static mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat minigzip zlib PROPERTY FOLDER "unused")
|
||||
if(MSVC)
|
||||
set_property(TARGET ntdll_extra_target PROPERTY FOLDER "unused")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
if(CMAKE_SYSTEM_NAME STREQL iOS)
|
||||
{
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
return()
|
||||
}
|
||||
endif()
|
||||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0043 OLD)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -39,16 +39,16 @@ namespace plain_wallet
|
|||
std::string get_sync_status(hwallet h)
|
||||
{
|
||||
plain_wallet_api_impl* pimpl = (plain_wallet_api_impl*)h;
|
||||
pimpl->get_sync_status();
|
||||
return pimpl->get_sync_status();
|
||||
}
|
||||
std::string sync(hwallet h)
|
||||
{
|
||||
plain_wallet_api_impl* pimpl = (plain_wallet_api_impl*)h;
|
||||
pimpl->sync();
|
||||
return pimpl->sync();
|
||||
}
|
||||
std::string invoke(hwallet h, const std::string& params)
|
||||
{
|
||||
plain_wallet_api_impl* pimpl = (plain_wallet_api_impl*)h;
|
||||
pimpl->invoke(params);
|
||||
return pimpl->invoke(params);
|
||||
}
|
||||
}
|
||||
47
tests/functional_tests/plain_wallet_tests.cpp
Normal file
47
tests/functional_tests/plain_wallet_tests.cpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
#include "include_base_utils.h"
|
||||
using namespace epee;
|
||||
#include "misc_language.h"
|
||||
#include "wallet/plain_wallet_api.h"
|
||||
#include "wallet/wallet_helpers.h"
|
||||
#include "wallet/plain_wallet_api_defs.h"
|
||||
|
||||
|
||||
void run_plain_wallet_api_test()
|
||||
{
|
||||
LOG_PRINT_L0("Creating instance...");
|
||||
plain_wallet::hwallet hw = plain_wallet::create_instance("11211", "127.0.0.1.");
|
||||
LOG_PRINT_L0("Creating instance..." << std::hex << hw);
|
||||
|
||||
LOG_PRINT_L0("Generating wallet...");
|
||||
std::string rsp = plain_wallet::generate(hw, "E:\\tmp\\sdsd", "");
|
||||
LOG_PRINT_L0("RESPONSE:" << ENDL << rsp);
|
||||
epee::json_rpc::response<plain_wallet::open_wallet_response, epee::json_rpc::dummy_error> ok_response = AUTO_VAL_INIT(ok_response);
|
||||
epee::serialization::load_t_from_json(ok_response, rsp);
|
||||
|
||||
plain_wallet::start_sync_thread(hw);
|
||||
LOG_PRINT_L0("Started sync thread.");
|
||||
|
||||
while (true)
|
||||
{
|
||||
std::string prog = plain_wallet::get_sync_status(hw);
|
||||
plain_wallet::sync_status_response ssr = AUTO_VAL_INIT(ssr);
|
||||
epee::serialization::load_t_from_json(ssr, prog);
|
||||
LOG_PRINT_L0("Progress: " << ssr.progress << "Finished: " << ssr.finished);
|
||||
if (ssr.finished)
|
||||
break;
|
||||
epee::misc_utils::sleep_no_w(100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
9
tests/functional_tests/plain_wallet_tests.h
Normal file
9
tests/functional_tests/plain_wallet_tests.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
|
||||
void run_plain_wallet_api_test();
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue