mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
msvc changes in tests, but tests not yet working there
This commit is contained in:
parent
889740217f
commit
4d00b3d6fe
@ -3,53 +3,27 @@ cmake_policy(SET CMP0015 NEW)
|
|||||||
aux_source_directory(. SRC_LIST)
|
aux_source_directory(. SRC_LIST)
|
||||||
list(REMOVE_ITEM SRC_LIST "./createRandomTest.cpp")
|
list(REMOVE_ITEM SRC_LIST "./createRandomTest.cpp")
|
||||||
|
|
||||||
include_directories(..)
|
|
||||||
include_directories(${CRYPTOPP_INCLUDE_DIRS})
|
include_directories(${CRYPTOPP_INCLUDE_DIRS})
|
||||||
include_directories(${JSONCPP_INCLUDE_DIRS})
|
include_directories(${JSONCPP_INCLUDE_DIRS})
|
||||||
|
include_directories(${JSON_RPC_CPP_INCLUDE_DIRS})
|
||||||
|
include_directories(..)
|
||||||
|
|
||||||
file(GLOB HEADERS "*.h")
|
file(GLOB HEADERS "*.h")
|
||||||
add_executable(testeth ${SRC_LIST} ${HEADERS})
|
add_executable(testeth ${SRC_LIST} ${HEADERS})
|
||||||
add_executable(createRandomTest createRandomTest.cpp vm.cpp TestHelper.cpp)
|
add_executable(createRandomTest createRandomTest.cpp vm.cpp TestHelper.cpp)
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(testeth ethereum)
|
target_link_libraries(testeth ethereum)
|
||||||
target_link_libraries(testeth ethcore)
|
target_link_libraries(testeth ethcore)
|
||||||
target_link_libraries(testeth secp256k1)
|
target_link_libraries(testeth secp256k1)
|
||||||
target_link_libraries(testeth gmp)
|
|
||||||
target_link_libraries(testeth solidity)
|
target_link_libraries(testeth solidity)
|
||||||
target_link_libraries(testeth webthree)
|
target_link_libraries(testeth webthree)
|
||||||
|
target_link_libraries(testeth ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE})
|
||||||
|
|
||||||
target_link_libraries(testeth ${CRYPTOPP_LIBRARIES})
|
if (JSON_RPC_CPP_FOUND)
|
||||||
|
|
||||||
if(JSON_RPC_CPP_FOUND)
|
|
||||||
target_link_libraries(testeth ${JSONCPP_LIBRARIES})
|
|
||||||
target_link_libraries(testeth web3jsonrpc)
|
target_link_libraries(testeth web3jsonrpc)
|
||||||
target_link_libraries(testeth ${JSON_RPC_CPP_CLIENT_LIBRARY})
|
target_link_libraries(testeth ${JSON_RPC_CPP_CLIENT_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(createRandomTest ethereum)
|
target_link_libraries(createRandomTest ethereum)
|
||||||
target_link_libraries(createRandomTest ethcore)
|
target_link_libraries(createRandomTest ethcore)
|
||||||
target_link_libraries(createRandomTest boost_chrono)
|
target_link_libraries(createRandomTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE})
|
||||||
target_link_libraries(createRandomTest boost_unit_test_framework)
|
|
||||||
target_link_libraries(createRandomTest ${CRYPTOPP_LIBRARIES})
|
|
||||||
|
|
||||||
if ("${TARGET_PLATFORM}" STREQUAL "w64")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
|
||||||
target_link_libraries(testeth boost_system-mt-s)
|
|
||||||
target_link_libraries(testeth boost_filesystem-mt-s)
|
|
||||||
target_link_libraries(testeth boost_thread_win32-mt-s)
|
|
||||||
target_link_libraries(testeth gcc)
|
|
||||||
target_link_libraries(testeth gdi32)
|
|
||||||
target_link_libraries(testeth ws2_32)
|
|
||||||
target_link_libraries(testeth mswsock)
|
|
||||||
target_link_libraries(testeth shlwapi)
|
|
||||||
target_link_libraries(testeth iphlpapi)
|
|
||||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
|
|
||||||
elseif (UNIX)
|
|
||||||
find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework)
|
|
||||||
else ()
|
|
||||||
target_link_libraries(testeth boost_system)
|
|
||||||
target_link_libraries(testeth boost_filesystem)
|
|
||||||
find_package(Threads REQUIRED)
|
|
||||||
target_link_libraries(testeth ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
endif ()
|
|
||||||
|
@ -62,7 +62,7 @@ struct Setup
|
|||||||
|
|
||||||
web3->setIdealPeerCount(5);
|
web3->setIdealPeerCount(5);
|
||||||
web3->ethereum()->setForceMining(true);
|
web3->ethereum()->setForceMining(true);
|
||||||
auto server = new jsonrpc::CorsHttpServer(8080);
|
auto server = new jsonrpc::HttpServer(8080);
|
||||||
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(*server, *web3, {}));
|
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(*server, *web3, {}));
|
||||||
jsonrpcServer->setIdentities({});
|
jsonrpcServer->setIdentities({});
|
||||||
jsonrpcServer->StartListening();
|
jsonrpcServer->StartListening();
|
||||||
@ -302,8 +302,11 @@ BOOST_AUTO_TEST_CASE(contract_storage)
|
|||||||
|
|
||||||
Json::Value storage = jsonrpcClient->eth_storageAt(contractAddress);
|
Json::Value storage = jsonrpcClient->eth_storageAt(contractAddress);
|
||||||
BOOST_CHECK_EQUAL(storage.getMemberNames().size(), 1);
|
BOOST_CHECK_EQUAL(storage.getMemberNames().size(), 1);
|
||||||
|
// bracers are required, cause msvc couldnt handle this macro in for statement
|
||||||
for (auto name: storage.getMemberNames())
|
for (auto name: storage.getMemberNames())
|
||||||
|
{
|
||||||
BOOST_CHECK_EQUAL(storage[name].asString(), "0x03");
|
BOOST_CHECK_EQUAL(storage[name].asString(), "0x03");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
@ -519,22 +519,23 @@ BOOST_AUTO_TEST_CASE(simple_mapping)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}";
|
"}";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
|
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0x00}));
|
// msvc seems to have problems with initializer-list, when there is only 1 param in the list
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0x00));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0x00));
|
||||||
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00));
|
||||||
callContractFunction(1, bytes({0x01, 0xa1}));
|
callContractFunction(1, bytes({0x01, 0xa1}));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0x00));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0xa1}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0xa1));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00));
|
||||||
callContractFunction(1, bytes({0x00, 0xef}));
|
callContractFunction(1, bytes({0x00, 0xef}));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0xef}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0xef));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0xa1}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0xa1));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00));
|
||||||
callContractFunction(1, bytes({0x01, 0x05}));
|
callContractFunction(1, bytes({0x01, 0x05}));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0xef}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == bytes(1, 0xef));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0x05}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0x01)) == bytes(1, 0x05));
|
||||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0, bytes(1, 0xa7)) == bytes(1, 0x00));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(mapping_state)
|
BOOST_AUTO_TEST_CASE(mapping_state)
|
||||||
@ -702,9 +703,9 @@ BOOST_AUTO_TEST_CASE(structs)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
BOOST_CHECK(callContractFunction(0) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0) == bytes(1, 0x00));
|
||||||
BOOST_CHECK(callContractFunction(1) == bytes());
|
BOOST_CHECK(callContractFunction(1) == bytes());
|
||||||
BOOST_CHECK(callContractFunction(0) == bytes({0x01}));
|
BOOST_CHECK(callContractFunction(0) == bytes(1, 0x01));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(struct_reference)
|
BOOST_AUTO_TEST_CASE(struct_reference)
|
||||||
@ -730,9 +731,9 @@ BOOST_AUTO_TEST_CASE(struct_reference)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
BOOST_CHECK(callContractFunction(0) == bytes({0x00}));
|
BOOST_CHECK(callContractFunction(0) == bytes(1, 0x00));
|
||||||
BOOST_CHECK(callContractFunction(1) == bytes());
|
BOOST_CHECK(callContractFunction(1) == bytes());
|
||||||
BOOST_CHECK(callContractFunction(0) == bytes({0x01}));
|
BOOST_CHECK(callContractFunction(0) == bytes(1, 0x01));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(constructor)
|
BOOST_AUTO_TEST_CASE(constructor)
|
||||||
|
@ -76,8 +76,11 @@ Declaration const& resolveDeclaration(vector<string> const& _namespacedName,
|
|||||||
NameAndTypeResolver const& _resolver)
|
NameAndTypeResolver const& _resolver)
|
||||||
{
|
{
|
||||||
Declaration const* declaration = nullptr;
|
Declaration const* declaration = nullptr;
|
||||||
|
// bracers are required, cause msvc couldnt handle this macro in for statement
|
||||||
for (string const& namePart: _namespacedName)
|
for (string const& namePart: _namespacedName)
|
||||||
|
{
|
||||||
BOOST_REQUIRE(declaration = _resolver.resolveName(namePart, declaration));
|
BOOST_REQUIRE(declaration = _resolver.resolveName(namePart, declaration));
|
||||||
|
}
|
||||||
BOOST_REQUIRE(declaration);
|
BOOST_REQUIRE(declaration);
|
||||||
return *declaration;
|
return *declaration;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <libsolidity/CompilerStack.h>
|
#include <libsolidity/CompilerStack.h>
|
||||||
#include <jsonrpc/json/json.h>
|
#include <jsoncpp/json/json.h>
|
||||||
#include <libdevcore/Exceptions.h>
|
#include <libdevcore/Exceptions.h>
|
||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <libsolidity/CompilerStack.h>
|
#include <libsolidity/CompilerStack.h>
|
||||||
#include <jsonrpc/json/json.h>
|
#include <jsoncpp/json/json.h>
|
||||||
#include <libdevcore/Exceptions.h>
|
#include <libdevcore/Exceptions.h>
|
||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
|
Loading…
Reference in New Issue
Block a user