Add extra test case to MemoryPoW

This commit is contained in:
catbref 2020-05-28 14:15:42 +01:00
parent 31e85226f4
commit cdf0795881

View File

@ -71,10 +71,18 @@ public class MemoryPoWTests {
public void testKnownCompute2() {
byte[] data = new byte[] { (byte) 0xaa, (byte) 0xbb, (byte) 0xcc };
int difficulty = 12;
int expectedNonce = 4013;
int nonce = MemoryPoW.compute2(data, 8 * 1024 * 1024, 12);
int nonce = MemoryPoW.compute2(data, 8 * 1024 * 1024, difficulty);
System.out.println(String.format("Nonce: %d", nonce));
System.out.println(String.format("Difficulty %d, nonce: %d", difficulty, nonce));
assertEquals(expectedNonce, nonce);
difficulty = 16;
expectedNonce = 41029;
nonce = MemoryPoW.compute2(data, 8 * 1024 * 1024, difficulty);
System.out.println(String.format("Difficulty %d, nonce: %d", difficulty, nonce));
assertEquals(expectedNonce, nonce);
}