-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move integration test cases into subdirectory
- Loading branch information
Showing
6 changed files
with
114 additions
and
90 deletions.
There are no files selected for viewing
90 changes: 0 additions & 90 deletions
90
packages/web/docs/implementation-guides/pointers/testing/test-cases.mdx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
...s/web/docs/implementation-guides/pointers/testing/test-cases/string-storage.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
sidebar_position: 2 | ||
sidebar_label: string storage | ||
--- | ||
|
||
import CodeListing from "@site/src/components/CodeListing"; | ||
import TestedPointer from "./TestedPointer"; | ||
|
||
# Test case: `string storage` | ||
|
||
Representing a Solidity `string storage` using an **ethdebug/format/pointer** | ||
requires the use of conditional logic to identify the one or more regions that | ||
correspond to raw UTF-8 Solidity string data. The `dereference()` function | ||
should behave as expected for such a pointer and observe the changing string | ||
value. | ||
|
||
## Test source | ||
|
||
<CodeListing | ||
packageName="@ethdebug/pointers" | ||
sourcePath="src/test-cases.ts" | ||
extract={sourceFile => sourceFile.getVariableStatement("stringStorageTest")} | ||
/> | ||
|
||
## Tested pointer | ||
|
||
<TestedPointer | ||
pointerQuery="string-storage-contract-variable-slot" | ||
/> |
27 changes: 27 additions & 0 deletions
27
...s/web/docs/implementation-guides/pointers/testing/test-cases/struct-storage.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 1 | ||
sidebar_label: <struct> storage | ||
--- | ||
|
||
import CodeListing from "@site/src/components/CodeListing"; | ||
import TestedPointer from "./TestedPointer"; | ||
|
||
# Test case: `<struct> storage` | ||
|
||
Solidity tightly packs struct storage words starting from the right-hand side. | ||
This test ensures that relative offsets are computed properly for a struct | ||
with a few small fields (`struct Record { uint8 x; uint8 y; bytes4 salt; }`). | ||
|
||
## Test source | ||
|
||
<CodeListing | ||
packageName="@ethdebug/pointers" | ||
sourcePath="src/test-cases.ts" | ||
extract={sourceFile => sourceFile.getVariableStatement("structStorageTest")} | ||
/> | ||
|
||
## Tested pointer | ||
|
||
<TestedPointer | ||
pointerQuery="struct-storage-contract-variable-slot" | ||
/> |
31 changes: 31 additions & 0 deletions
31
packages/web/docs/implementation-guides/pointers/testing/test-cases/test-cases.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
sidebar_position: 7 | ||
--- | ||
|
||
import CodeListing from "@site/src/components/CodeListing"; | ||
import TestedPointer from "./TestedPointer"; | ||
|
||
# Test cases | ||
|
||
This reference implementation currently defines the following integration test | ||
cases. | ||
|
||
Test cases are aggregated into the `observeTraceTests` variable: | ||
|
||
<CodeListing | ||
packageName="@ethdebug/pointers" | ||
sourcePath="src/test-cases.ts" | ||
extract={sourceFile => sourceFile.getVariableStatement("observeTraceTests")} | ||
links={{ | ||
structStorageTest: "/docs/implementation-guides/pointers/testing/test-cases/struct-storage/", | ||
stringStorageTest: "/docs/implementation-guides/pointers/testing/test-cases/string-storage/", | ||
uint256ArrayMemoryTest: "/docs/implementation-guides/pointers/testing/test-cases/uint256-array-memory/", | ||
}} | ||
/> | ||
|
||
To see a brief introduction and the relevant code listings for each test case, | ||
please use the sidebar navigation or the hyperlinks included above. | ||
|
||
This variable will be used to generate automated tests dynamically, as will | ||
be described in the next section | ||
[Hooking up Jest](/docs/implementation-guides/pointers/testing/jest). |
27 changes: 27 additions & 0 deletions
27
...docs/implementation-guides/pointers/testing/test-cases/uint256-array-memory.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 3 | ||
sidebar_label: uint256[] memory | ||
--- | ||
|
||
import CodeListing from "@site/src/components/CodeListing"; | ||
import TestedPointer from "./TestedPointer"; | ||
|
||
# Test case: `uint256[] memory` | ||
|
||
Memory arrays are primarily referenced using stack-located memory offset values, | ||
and so this test case ensures that stack slot indexes are properly adjusted over | ||
the course of the transaction. | ||
|
||
## Test source | ||
|
||
<CodeListing | ||
packageName="@ethdebug/pointers" | ||
sourcePath="src/test-cases.ts" | ||
extract={sourceFile => sourceFile.getVariableStatement("uint256ArrayMemoryTest")} | ||
/> | ||
|
||
## Tested pointer | ||
|
||
<TestedPointer | ||
pointerQuery="uint256-array-memory-pointer-slot" | ||
/> |