mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Broke the crypto test out into a separate boost auto test case.
This commit is contained in:
parent
b8ce26d9f9
commit
bf4865adaf
29
crypto.cpp
29
crypto.cpp
@ -26,9 +26,38 @@
|
|||||||
#include <RLP.h>
|
#include <RLP.h>
|
||||||
#include <Log.h>
|
#include <Log.h>
|
||||||
#include <Transaction.h>
|
#include <Transaction.h>
|
||||||
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace eth;
|
using namespace eth;
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(crypto_tests)
|
||||||
|
{
|
||||||
|
cnote << "Testing Crypto...";
|
||||||
|
secp256k1_start();
|
||||||
|
|
||||||
|
KeyPair p(Secret(fromHex("3ecb44df2159c26e0f995712d4f39b6f6e499b40749b1cf1246c37f9516cb6a4")));
|
||||||
|
BOOST_REQUIRE(p.pub() == Public(fromHex("97466f2b32bc3bb76d4741ae51cd1d8578b48d3f1e68da206d47321aec267ce78549b514e4453d74ef11b0cd5e4e4c364effddac8b51bcfc8de80682f952896f")));
|
||||||
|
BOOST_REQUIRE(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075")));
|
||||||
|
{
|
||||||
|
Transaction t;
|
||||||
|
t.nonce = 0;
|
||||||
|
t.receiveAddress = h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b"));
|
||||||
|
t.value = 1000;
|
||||||
|
cnote << RLP(t.rlp(false));
|
||||||
|
cnote << toHex(t.rlp(false));
|
||||||
|
cnote << t.sha3(false);
|
||||||
|
t.sign(p.secret());
|
||||||
|
cnote << RLP(t.rlp(true));
|
||||||
|
cnote << toHex(t.rlp(true));
|
||||||
|
cnote << t.sha3(true);
|
||||||
|
BOOST_REQUIRE(t.sender() == p.address());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int cryptoTest()
|
int cryptoTest()
|
||||||
{
|
{
|
||||||
cnote << "Testing Crypto...";
|
cnote << "Testing Crypto...";
|
||||||
|
2
main.cpp
2
main.cpp
@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(basic_tests)
|
|||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
r += vmTest();
|
r += vmTest();
|
||||||
r += cryptoTest(); // TODO: Put in tests repo.
|
|
||||||
// r += daggerTest();
|
// r += daggerTest();
|
||||||
// r += stateTest();
|
// r += stateTest();
|
||||||
// r += peerTest(argc, argv);
|
// r += peerTest(argc, argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user