mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 17:56:49 +00:00
Latests HF perf test (#5789)
This commit is contained in:
@@ -1356,8 +1356,7 @@ struct HostFuncImpl_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(result.has_value() && result.value() == 0);
|
||||
|
||||
// Should fail for too large data
|
||||
std::vector<uint8_t> bigData(
|
||||
1024 * 1024 + 1, 0x42); // > maxWasmDataLength
|
||||
std::vector<uint8_t> bigData(maxWasmDataLength + 1, 0x42);
|
||||
auto const tooBig =
|
||||
hfs.updateData(Slice(bigData.data(), bigData.size()));
|
||||
if (BEAST_EXPECT(!tooBig.has_value()))
|
||||
@@ -2102,6 +2101,7 @@ struct HostFuncImpl_test : public beast::unit_test::suite
|
||||
Bytes const float2 = {0xD4, 0x87, 0x1A, 0xFD, 0x49, 0x8D, 0x00, 0x00}; // 2
|
||||
Bytes const float10 = {0xD4, 0xC3, 0x8D, 0x7E, 0xA4, 0xC6, 0x80, 0x00}; // 10
|
||||
Bytes const floatInvalidZero = {0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // INVALID
|
||||
Bytes const floatPi = {0xD4, 0x8B, 0x29, 0x43, 0x0A, 0x25, 0x6D, 0x21}; // 3.141592653589793
|
||||
|
||||
std::string const invalid = "invalid_data";
|
||||
|
||||
@@ -2744,8 +2744,14 @@ struct HostFuncImpl_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
{
|
||||
auto const result =
|
||||
hfs.floatPower(makeSlice(floatMaxIOU), 40000, 0);
|
||||
auto const result = hfs.floatPower(makeSlice(floatMaxIOU), 81, 0);
|
||||
BEAST_EXPECT(!result) &&
|
||||
BEAST_EXPECT(
|
||||
result.error() == HostFunctionError::FLOAT_INPUT_MALFORMED);
|
||||
}
|
||||
|
||||
{
|
||||
auto const result = hfs.floatPower(makeSlice(floatMaxIOU), 2, 0);
|
||||
BEAST_EXPECT(!result) &&
|
||||
BEAST_EXPECT(
|
||||
result.error() ==
|
||||
@@ -2809,6 +2815,46 @@ struct HostFuncImpl_test : public beast::unit_test::suite
|
||||
result.error() == HostFunctionError::FLOAT_INPUT_MALFORMED);
|
||||
}
|
||||
|
||||
// perf test logs
|
||||
// {
|
||||
// auto const result = hfs.floatLog(makeSlice(floatPi), 0);
|
||||
// if (BEAST_EXPECT(result))
|
||||
// {
|
||||
// std::cout << "lg(" << floatToString(makeSlice(floatPi))
|
||||
// << ") = " << floatToString(makeSlice(*result))
|
||||
// << std::endl;
|
||||
// }
|
||||
// }
|
||||
// {
|
||||
// auto const result = hfs.floatLog(makeSlice(floatIntMax), 0);
|
||||
// if (BEAST_EXPECT(result))
|
||||
// {
|
||||
// std::cout << "lg(" << floatToString(makeSlice(floatIntMax))
|
||||
// << ") = " << floatToString(makeSlice(*result))
|
||||
// << std::endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
// {
|
||||
// auto const result = hfs.floatLog(makeSlice(floatMaxExp), 0);
|
||||
// if (BEAST_EXPECT(result))
|
||||
// {
|
||||
// std::cout << "lg(" << floatToString(makeSlice(floatMaxExp))
|
||||
// << ") = " << floatToString(makeSlice(*result))
|
||||
// << std::endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
// {
|
||||
// auto const result = hfs.floatLog(makeSlice(floatMaxIOU), 0);
|
||||
// if (BEAST_EXPECT(result))
|
||||
// {
|
||||
// std::cout << "lg(" << floatToString(makeSlice(floatMaxIOU))
|
||||
// << ") = " << floatToString(makeSlice(*result))
|
||||
// << std::endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
{
|
||||
auto const x =
|
||||
hfs.floatSet(9'500'000'000'000'001, -14, 0); // almost 80+15
|
||||
|
||||
Reference in New Issue
Block a user