Browse Source

Merge pull request #1696 from chriseth/ifdef_clean_in_tests

Removed (and added) some #ifs (but removed more than I added).
cl-refactor
chriseth 10 years ago
parent
commit
d4c10dcff2
  1. 4
      alethzero/CMakeLists.txt
  2. 6
      alethzero/Transact.cpp
  3. 11
      test/CMakeLists.txt
  4. 2
      test/libethereum/state.cpp
  5. 5
      test/libevmcore/CMakeLists.txt
  6. 4
      test/libsolidity/Assembly.cpp
  7. 3
      test/libsolidity/SolidityABIJSON.cpp
  8. 4
      test/libsolidity/SolidityCompiler.cpp
  9. 4
      test/libsolidity/SolidityEndToEndTest.cpp
  10. 4
      test/libsolidity/SolidityExpressionCompiler.cpp
  11. 4
      test/libsolidity/SolidityInterface.cpp
  12. 4
      test/libsolidity/SolidityNameAndTypeResolution.cpp
  13. 4
      test/libsolidity/SolidityNatspecJSON.cpp
  14. 4
      test/libsolidity/SolidityOptimizer.cpp
  15. 4
      test/libsolidity/SolidityParser.cpp
  16. 4
      test/libsolidity/SolidityScanner.cpp
  17. 4
      test/libsolidity/SolidityTypes.cpp

4
alethzero/CMakeLists.txt

@ -51,7 +51,9 @@ target_link_libraries(${EXECUTABLE} ethcore)
target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} devcrypto)
target_link_libraries(${EXECUTABLE} secp256k1) target_link_libraries(${EXECUTABLE} secp256k1)
target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} lll)
target_link_libraries(${EXECUTABLE} solidity) if (SOLIDITY)
target_link_libraries(${EXECUTABLE} solidity)
endif ()
target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} evmcore)
target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} devcore)
target_link_libraries(${EXECUTABLE} web3jsonrpc) target_link_libraries(${EXECUTABLE} web3jsonrpc)

6
alethzero/Transact.cpp

@ -168,6 +168,7 @@ static std::string toString(TransactionException _te)
} }
} }
#if ETH_SOLIDITY
static string getFunctionHashes(dev::solidity::CompilerStack const& _compiler, string const& _contractName) static string getFunctionHashes(dev::solidity::CompilerStack const& _compiler, string const& _contractName)
{ {
string ret = ""; string ret = "";
@ -182,6 +183,7 @@ static string getFunctionHashes(dev::solidity::CompilerStack const& _compiler, s
} }
return ret; return ret;
} }
#endif
static tuple<vector<string>, bytes, string> userInputToCode(string const& _user, bool _opt) static tuple<vector<string>, bytes, string> userInputToCode(string const& _user, bool _opt)
{ {
@ -197,6 +199,7 @@ static tuple<vector<string>, bytes, string> userInputToCode(string const& _user,
boost::replace_all_copy(u, " ", ""); boost::replace_all_copy(u, " ", "");
data = fromHex(u); data = fromHex(u);
} }
#if ETH_SOLIDITY
else if (sourceIsSolidity(_user)) else if (sourceIsSolidity(_user))
{ {
dev::solidity::CompilerStack compiler(true); dev::solidity::CompilerStack compiler(true);
@ -220,6 +223,7 @@ static tuple<vector<string>, bytes, string> userInputToCode(string const& _user,
errors.push_back("Solidity: Uncaught exception"); errors.push_back("Solidity: Uncaught exception");
} }
} }
#endif
#if ETH_SERPENT #if ETH_SERPENT
else if (sourceIsSerpent(_user)) else if (sourceIsSerpent(_user))
{ {
@ -394,6 +398,7 @@ void Transact::on_send_clicked()
// If execution is a contract creation, add Natspec to // If execution is a contract creation, add Natspec to
// a local Natspec LEVELDB // a local Natspec LEVELDB
ethereum()->submitTransaction(s, value(), m_data, ui->gas->value(), gasPrice()); ethereum()->submitTransaction(s, value(), m_data, ui->gas->value(), gasPrice());
#if ETH_SOLIDITY
string src = ui->data->toPlainText().toStdString(); string src = ui->data->toPlainText().toStdString();
if (sourceIsSolidity(src)) if (sourceIsSolidity(src))
try try
@ -407,6 +412,7 @@ void Transact::on_send_clicked()
} }
} }
catch (...) {} catch (...) {}
#endif
} }
else else
ethereum()->submitTransaction(s, value(), m_context->fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice()); ethereum()->submitTransaction(s, value(), m_context->fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice());

11
test/CMakeLists.txt

@ -23,19 +23,18 @@ add_subdirectory(libdevcrypto)
add_subdirectory(libethcore) add_subdirectory(libethcore)
add_subdirectory(libethereum) add_subdirectory(libethereum)
add_subdirectory(libevm) add_subdirectory(libevm)
add_subdirectory(libevmcore)
add_subdirectory(libnatspec) add_subdirectory(libnatspec)
add_subdirectory(libp2p) add_subdirectory(libp2p)
add_subdirectory(libsolidity) if (SOLIDITY)
add_subdirectory(libsolidity)
endif ()
if (JSONRPC)
add_subdirectory(libweb3jsonrpc) add_subdirectory(libweb3jsonrpc)
endif ()
add_subdirectory(libwhisper) add_subdirectory(libwhisper)
set(SRC_LIST ${SRC_LIST} ${SRC}) set(SRC_LIST ${SRC_LIST} ${SRC})
if (NOT JSONRPC)
list(REMOVE_ITEM SRC_LIST "libweb3jsonrpc/./AccountHolder.cpp")
endif()
include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS})
include_directories(BEFORE ..) include_directories(BEFORE ..)
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})

2
test/libethereum/state.cpp

@ -171,10 +171,12 @@ BOOST_AUTO_TEST_CASE(stMemoryStressTest)
dev::test::executeTests("stMemoryStressTest", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); dev::test::executeTests("stMemoryStressTest", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests);
} }
#if ETH_SOLIDITY
BOOST_AUTO_TEST_CASE(stSolidityTest) BOOST_AUTO_TEST_CASE(stSolidityTest)
{ {
dev::test::executeTests("stSolidityTest", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); dev::test::executeTests("stSolidityTest", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests);
} }
#endif
BOOST_AUTO_TEST_CASE(stMemoryTest) BOOST_AUTO_TEST_CASE(stMemoryTest)
{ {

5
test/libevmcore/CMakeLists.txt

@ -1,5 +0,0 @@
cmake_policy(SET CMP0015 NEW)
aux_source_directory(. SRCS)
add_sources(${SRCS})

4
test/libevmcore/Assembly.cpp → test/libsolidity/Assembly.cpp

@ -20,8 +20,6 @@
* Unit tests for Assembly Items from evmcore/Assembly.h * Unit tests for Assembly Items from evmcore/Assembly.h
*/ */
#if ETH_SOLIDITY
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
@ -120,5 +118,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

3
test/libsolidity/SolidityABIJSON.cpp

@ -19,7 +19,6 @@
* @date 2014 * @date 2014
* Unit tests for the solidity compiler JSON Interface output. * Unit tests for the solidity compiler JSON Interface output.
*/ */
#if ETH_SOLIDITY
#include "../TestHelper.h" #include "../TestHelper.h"
#include <libsolidity/CompilerStack.h> #include <libsolidity/CompilerStack.h>
@ -501,5 +500,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} }
#endif

4
test/libsolidity/SolidityCompiler.cpp

@ -20,8 +20,6 @@
* Unit tests for the solidity compiler. * Unit tests for the solidity compiler.
*/ */
#if ETH_SOLIDITY
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
@ -193,5 +191,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

4
test/libsolidity/SolidityEndToEndTest.cpp

@ -21,8 +21,6 @@
* Unit tests for the solidity expression compiler, testing the behaviour of the code. * Unit tests for the solidity expression compiler, testing the behaviour of the code.
*/ */
#if ETH_SOLIDITY
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
@ -3704,5 +3702,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

4
test/libsolidity/SolidityExpressionCompiler.cpp

@ -20,8 +20,6 @@
* Unit tests for the solidity expression compiler. * Unit tests for the solidity expression compiler.
*/ */
#if ETH_SOLIDITY
#include <string> #include <string>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
@ -491,5 +489,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

4
test/libsolidity/SolidityInterface.cpp

@ -20,8 +20,6 @@
* Unit tests for generating source interfaces for Solidity contracts. * Unit tests for generating source interfaces for Solidity contracts.
*/ */
#if ETH_SOLIDITY
#include "../TestHelper.h" #include "../TestHelper.h"
#include <libsolidity/CompilerStack.h> #include <libsolidity/CompilerStack.h>
#include <libsolidity/AST.h> #include <libsolidity/AST.h>
@ -149,5 +147,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} }
#endif

4
test/libsolidity/SolidityNameAndTypeResolution.cpp

@ -20,8 +20,6 @@
* Unit tests for the name and type resolution of the solidity parser. * Unit tests for the name and type resolution of the solidity parser.
*/ */
#if ETH_SOLIDITY
#include <string> #include <string>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
@ -1671,5 +1669,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

4
test/libsolidity/SolidityNatspecJSON.cpp

@ -20,8 +20,6 @@
* Unit tests for the solidity compiler JSON Interface output. * Unit tests for the solidity compiler JSON Interface output.
*/ */
#if ETH_SOLIDITY
#include "../TestHelper.h" #include "../TestHelper.h"
#include <json/json.h> #include <json/json.h>
#include <libsolidity/CompilerStack.h> #include <libsolidity/CompilerStack.h>
@ -539,5 +537,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} }
#endif

4
test/libsolidity/SolidityOptimizer.cpp

@ -20,8 +20,6 @@
* Tests for the Solidity optimizer. * Tests for the Solidity optimizer.
*/ */
#if ETH_SOLIDITY
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
@ -816,5 +814,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

4
test/libsolidity/SolidityParser.cpp

@ -20,8 +20,6 @@
* Unit tests for the solidity parser. * Unit tests for the solidity parser.
*/ */
#if ETH_SOLIDITY
#include <string> #include <string>
#include <memory> #include <memory>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
@ -855,5 +853,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

4
test/libsolidity/SolidityScanner.cpp

@ -20,8 +20,6 @@
* Unit tests for the solidity scanner. * Unit tests for the solidity scanner.
*/ */
#if ETH_SOLIDITY
#include <libsolidity/Scanner.h> #include <libsolidity/Scanner.h>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
@ -288,5 +286,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} // end namespaces } // end namespaces
#endif

4
test/libsolidity/SolidityTypes.cpp

@ -20,8 +20,6 @@
* Unit tests for the type system of Solidity. * Unit tests for the type system of Solidity.
*/ */
#if ETH_SOLIDITY
#include <libsolidity/Types.h> #include <libsolidity/Types.h>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
@ -93,5 +91,3 @@ BOOST_AUTO_TEST_SUITE_END()
} }
} }
} }
#endif

Loading…
Cancel
Save