aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-10-05 10:38:10 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-10-05 10:38:10 -0400
commitb898c8fce687de9320bfae8dd2392e92c5464831 (patch)
tree0eae81bd8a40703143a5bbe74ce6648ca0b143c7 /src/test
parent8bc52d069247b3c7968bbb5c9ced9e6a7baa57e8 (diff)
parent452506fc4153be072fe443fe3e3cbf76d9563a42 (diff)
downloadbitcoin-b898c8fce687de9320bfae8dd2392e92c5464831.tar.xz
Merge branch 'no-cryptopp' of https://github.com/tcatm/bitcoin
Diffstat (limited to 'src/test')
-rw-r--r--src/test/miner_tests.cpp35
-rw-r--r--src/test/test_bitcoin.cpp3
2 files changed, 37 insertions, 1 deletions
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
new file mode 100644
index 0000000000..e773542d71
--- /dev/null
+++ b/src/test/miner_tests.cpp
@@ -0,0 +1,35 @@
+#include <boost/test/unit_test.hpp>
+
+#include "../uint256.h"
+
+extern void SHA256Transform(void* pstate, void* pinput, const void* pinit);
+
+BOOST_AUTO_TEST_SUITE(miner_tests)
+
+BOOST_AUTO_TEST_CASE(sha256transform_equality)
+{
+ unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
+
+
+ unsigned char pstate[32];
+ unsigned char pinput[32];
+
+ int i;
+
+ for (i = 0; i < 32; i++) {
+ pinput[i] = i;
+ pstate[i] = 0;
+ }
+
+ uint256 hash;
+
+ SHA256Transform(&hash, pinput, pSHA256InitState);
+
+ BOOST_TEST_MESSAGE(hash.GetHex());
+
+ uint256 hash_reference("0x2df5e1c65ef9f8cde240d23cae2ec036d31a15ec64bc68f64be242b1da6631f3");
+
+ BOOST_CHECK(hash == hash_reference);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp
index 4f98a93c19..8863aad478 100644
--- a/src/test/test_bitcoin.cpp
+++ b/src/test/test_bitcoin.cpp
@@ -12,10 +12,11 @@
#include "base64_tests.cpp"
#include "util_tests.cpp"
#include "base58_tests.cpp"
+#include "miner_tests.cpp"
CWallet* pwalletMain;
void Shutdown(void* parg)
{
- exit(0);
+ exit(0);
}