Fixed tests

This commit is contained in:
tevador 2019-08-30 09:44:24 +02:00
parent 22689eda49
commit eee355d85b

View File

@ -156,6 +156,7 @@ int main() {
randomx::JitCompiler jit; randomx::JitCompiler jit;
jit.generateSuperscalarHash(cache->programs, cache->reciprocalCache); jit.generateSuperscalarHash(cache->programs, cache->reciprocalCache);
jit.generateDatasetInitCode(); jit.generateDatasetInitCode();
jit.enableAll();
uint64_t datasetItem[8]; uint64_t datasetItem[8];
jit.getDatasetInitFunc()(cache, (uint8_t*)&datasetItem, 0, 1); jit.getDatasetInitFunc()(cache, (uint8_t*)&datasetItem, 0, 1);
assert(datasetItem[0] == 0x680588a85ae222db); assert(datasetItem[0] == 0x680588a85ae222db);
@ -967,25 +968,25 @@ int main() {
auto test_a = [&] { auto test_a = [&] {
char hash[RANDOMX_HASH_SIZE]; char hash[RANDOMX_HASH_SIZE];
calcStringHash("test key 000", "This is a test", &hash); calcStringHash("test key 000", "This is a test", &hash);
assert(equalsHex(hash, "b33f8d10a8655d6f1925e3754adeb0a6da4c2f48a81cd4c220a412f1ef016a15")); assert(equalsHex(hash, "639183aae1bf4c9a35884cb46b09cad9175f04efd7684e7262a0ac1c2f0b4e3f"));
}; };
auto test_b = [&] { auto test_b = [&] {
char hash[RANDOMX_HASH_SIZE]; char hash[RANDOMX_HASH_SIZE];
calcStringHash("test key 000", "Lorem ipsum dolor sit amet", &hash); calcStringHash("test key 000", "Lorem ipsum dolor sit amet", &hash);
assert(equalsHex(hash, "62ac336786ad3a7aff990beb2f643bd748d81dba585a52149d0baebdea0e9823")); assert(equalsHex(hash, "300a0adb47603dedb42228ccb2b211104f4da45af709cd7547cd049e9489c969"));
}; };
auto test_c = [&] { auto test_c = [&] {
char hash[RANDOMX_HASH_SIZE]; char hash[RANDOMX_HASH_SIZE];
calcStringHash("test key 000", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", &hash); calcStringHash("test key 000", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", &hash);
assert(equalsHex(hash, "6c550ebe765f7b784d2c183552fbb6048b58f17a3f115baf2b968724eb2f7a23")); assert(equalsHex(hash, "c36d4ed4191e617309867ed66a443be4075014e2b061bcdaf9ce7b721d2b77a8"));
}; };
auto test_d = [&] { auto test_d = [&] {
char hash[RANDOMX_HASH_SIZE]; char hash[RANDOMX_HASH_SIZE];
calcStringHash("test key 001", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", &hash); calcStringHash("test key 001", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", &hash);
assert(equalsHex(hash, "cb602b9c498b67e31e519fbdc07e288de46f949b14ad620380df6250eaffbd4e")); assert(equalsHex(hash, "e9ff4503201c0c2cca26d285c93ae883f9b1d30c9eb240b820756f2d5a7905fc"));
}; };
auto test_e = [&] { auto test_e = [&] {
@ -994,7 +995,7 @@ int main() {
//std::cout << std::endl; //std::cout << std::endl;
//outputHex(std::cout, (const char*)hash, sizeof(hash)); //outputHex(std::cout, (const char*)hash, sizeof(hash));
//std::cout << std::endl; //std::cout << std::endl;
assert(equalsHex(hash, "f60caf300917760337e8ce51487484e6a33d4aaa15aa79c985efb4ea00390918")); assert(equalsHex(hash, "c56414121acda1713c2f2a819d8ae38aed7c80c35c2a769298d34f03833cd5f1"));
}; };
runTest("Hash test 1a (interpreter)", stringsEqual(RANDOMX_ARGON_SALT, "RandomX\x03"), test_a); runTest("Hash test 1a (interpreter)", stringsEqual(RANDOMX_ARGON_SALT, "RandomX\x03"), test_a);