Skip to content

Commit 14f68d0

Browse files
Transpile f19bf2900
1 parent d95c31c commit 14f68d0

File tree

2 files changed

+1
-103
lines changed

2 files changed

+1
-103
lines changed

test/utils/Bytes.t.sol

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -114,106 +114,4 @@ contract BytesTest is Test {
114114
assertEq(result[i], buffer[sanitizedStart + i]);
115115
}
116116
}
117-
118-
function testSpliceWithStartOnly(bytes memory buffer, uint256 start) public pure {
119-
bytes memory originalBuffer = bytes.concat(buffer);
120-
bytes memory result = buffer.splice(start);
121-
122-
// Result should be the same object as input (modified in place)
123-
assertEq(result, buffer);
124-
125-
// Should contain bytes from start to end, moved to beginning
126-
assertEq(result.length, Math.saturatingSub(originalBuffer.length, start));
127-
128-
// Verify content matches moved content
129-
for (uint256 i = 0; i < result.length; ++i) {
130-
assertEq(result[i], originalBuffer[start + i]);
131-
}
132-
}
133-
134-
function testSplice(bytes memory buffer, uint256 start, uint256 end) public pure {
135-
bytes memory originalBuffer = bytes.concat(buffer);
136-
bytes memory result = buffer.splice(start, end);
137-
138-
// Result should be the same object as input (modified in place)
139-
assertEq(result, buffer);
140-
141-
// Calculate expected bounds after sanitization
142-
uint256 sanitizedEnd = Math.min(end, originalBuffer.length);
143-
uint256 sanitizedStart = Math.min(start, sanitizedEnd);
144-
uint256 expectedLength = sanitizedEnd - sanitizedStart;
145-
146-
assertEq(result.length, expectedLength);
147-
148-
// Verify content matches moved content
149-
for (uint256 i = 0; i < result.length; ++i) {
150-
assertEq(result[i], originalBuffer[sanitizedStart + i]);
151-
}
152-
}
153-
154-
// REVERSE BITS
155-
function testSymbolicReverseBytes32(bytes32 value) public pure {
156-
assertEq(Bytes.reverseBytes32(Bytes.reverseBytes32(value)), value);
157-
}
158-
159-
function testSymbolicReverseBytes16(bytes16 value) public pure {
160-
assertEq(Bytes.reverseBytes16(Bytes.reverseBytes16(value)), value);
161-
}
162-
163-
function testSymbolicReverseBytes16Dirty(bytes16 value) public pure {
164-
assertEq(Bytes.reverseBytes16(Bytes.reverseBytes16(_dirtyBytes16(value))), value);
165-
assertEq(Bytes.reverseBytes16(_dirtyBytes16(Bytes.reverseBytes16(value))), value);
166-
}
167-
168-
function testSymbolicReverseBytes8(bytes8 value) public pure {
169-
assertEq(Bytes.reverseBytes8(Bytes.reverseBytes8(value)), value);
170-
}
171-
172-
function testSymbolicReverseBytes8Dirty(bytes8 value) public pure {
173-
assertEq(Bytes.reverseBytes8(Bytes.reverseBytes8(_dirtyBytes8(value))), value);
174-
assertEq(Bytes.reverseBytes8(_dirtyBytes8(Bytes.reverseBytes8(value))), value);
175-
}
176-
177-
function testSymbolicReverseBytes4(bytes4 value) public pure {
178-
assertEq(Bytes.reverseBytes4(Bytes.reverseBytes4(value)), value);
179-
}
180-
181-
function testSymbolicReverseBytes4Dirty(bytes4 value) public pure {
182-
assertEq(Bytes.reverseBytes4(Bytes.reverseBytes4(_dirtyBytes4(value))), value);
183-
assertEq(Bytes.reverseBytes4(_dirtyBytes4(Bytes.reverseBytes4(value))), value);
184-
}
185-
186-
function testSymbolicReverseBytes2(bytes2 value) public pure {
187-
assertEq(Bytes.reverseBytes2(Bytes.reverseBytes2(value)), value);
188-
}
189-
190-
function testSymbolicReverseBytes2Dirty(bytes2 value) public pure {
191-
assertEq(Bytes.reverseBytes2(Bytes.reverseBytes2(_dirtyBytes2(value))), value);
192-
assertEq(Bytes.reverseBytes2(_dirtyBytes2(Bytes.reverseBytes2(value))), value);
193-
}
194-
195-
// Helpers
196-
function _dirtyBytes16(bytes16 value) private pure returns (bytes16 dirty) {
197-
assembly ("memory-safe") {
198-
dirty := or(value, shr(128, not(0)))
199-
}
200-
}
201-
202-
function _dirtyBytes8(bytes8 value) private pure returns (bytes8 dirty) {
203-
assembly ("memory-safe") {
204-
dirty := or(value, shr(192, not(0)))
205-
}
206-
}
207-
208-
function _dirtyBytes4(bytes4 value) private pure returns (bytes4 dirty) {
209-
assembly ("memory-safe") {
210-
dirty := or(value, shr(224, not(0)))
211-
}
212-
}
213-
214-
function _dirtyBytes2(bytes2 value) private pure returns (bytes2 dirty) {
215-
assembly ("memory-safe") {
216-
dirty := or(value, shr(240, not(0)))
217-
}
218-
}
219117
}

0 commit comments

Comments
 (0)