aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-05-28 18:50:03 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:38:47 +0800
commitf5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e (patch)
tree748c799d5a97e881459d64fc3e99495867a45844 /packages/contracts/src
parentb3c253ea2a685bea3add43a81229911269eb4e89 (diff)
downloaddexon-sol-tools-f5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e.tar
dexon-sol-tools-f5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e.tar.gz
dexon-sol-tools-f5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e.tar.bz2
dexon-sol-tools-f5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e.tar.lz
dexon-sol-tools-f5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e.tar.xz
dexon-sol-tools-f5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e.tar.zst
dexon-sol-tools-f5bc0b205c217eac8abdfee9dcdb3c4d21b5c31e.zip
Generate tests from vectors
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol27
1 files changed, 24 insertions, 3 deletions
diff --git a/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol b/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol
index 0c6f8fbc9..18deede4c 100644
--- a/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol
+++ b/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol
@@ -19,12 +19,33 @@
pragma solidity ^0.4.24;
import "../../utils/LibMem/LibMem.sol";
-import "../../utils/LibBytes/LibBytes.sol";
contract TestLibMem is
- LibMem,
- LibBytes
+ LibMem
{
+ function testMemcpy(
+ bytes mem, ///< Memory contents we want to apply memcpy to
+ uint256 dest,
+ uint256 source,
+ uint256 length
+ )
+ public // not external, we need input in memory
+ pure
+ returns (bytes)
+ {
+ // Sanity check. Overflows are not checked.
+ require(source + length <= mem.length);
+ require(dest + length <= mem.length);
+
+ // Get pointer to memory contents
+ uint256 offset = getMemAddress(mem) + 32;
+
+ // Execute memcpy adjusted for memory array location
+ memcpy(offset + dest, offset + source, length);
+
+ // Return modified memory contents
+ return mem;
+ }
function test1()
external