Eric Mastro 7f59e545b2 Add more tests
- Marketplace tests for requestsForHost, and additional tests for myRequests and mySlots
- Added Utils lib with tests
- Added additional Bytes32AddressSetMap.keys expectations
2022-12-22 10:29:06 +01:00

24 lines
504 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
library Utils {
function _resize(bytes32[] memory array, uint8 newSize)
internal
pure
returns (bytes32[] memory)
{
require(newSize <= array.length, "size out of bounds");
if (newSize == 0) {
bytes32[] memory empty;
return empty;
} else {
bytes32[] memory sized = new bytes32[](newSize);
for (uint8 i = 0; i < newSize; i++) {
sized[i] = array[i];
}
return sized;
}
}
}