Skip to content

Commit

Permalink
Feat: smt data driven test framework (#79)
Browse files Browse the repository at this point in the history
* Data driven test framework

* Impl ToString for Test to generate test names

* revert unrelated change

* Stable

* Format

* Data test stable

* undo change to smt

* Use `?` instead of `unwrap`

* Reorder dependencies
  • Loading branch information
bvrooman authored Apr 20, 2022
1 parent ec32ed9 commit 8972446
Show file tree
Hide file tree
Showing 21 changed files with 1,836 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fuel-merkle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,14 @@ sha2 = "0.9"
thiserror = "1.0"

[dev-dependencies]
datatest-stable = "0.1"
fuel-merkle-test-helpers = { path = "test-helpers" }
hex = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8"
thiserror = "1.0"

[[test]]
name = "tests-data"
path = "./tests-data/tests-data.rs"
harness = false
44 changes: 44 additions & 0 deletions fuel-merkle/tests-data/fixtures/Test Delete Non-existent Key.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
expected_root:
encoding: hex
value: 108f731f2414e33ae57e584dc26bd276db07874436b2264ca6e520c658185c6b
name: Test Delete Non-existent Key
steps:
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: b40711a88c7039756fb8a73827eabe2c0fe5a0346ca7e0a104adc0fc764f528d
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 433ebf5bc03dffa38536673207a21281612cef5faa9bc7a4d5b9be2fdb12cf1a
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 88185d128d9922e0e6bcd32b07b6c7f20f27968eab447a1d8d1cdf250f79f7d3
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 1bc5d0e3df0ea12c4d0078668d14924f95106bbe173e196de50fe13a900b0937
- action: delete
key:
encoding: hex
value: 72034de8a594b12de51205feba7ade26899d8425e81eac7f8c296bf974a51c60
95 changes: 95 additions & 0 deletions fuel-merkle/tests-data/fixtures/Test Delete Sparse Union.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
expected_root:
encoding: hex
value: e912e97abc67707b2e6027338292943b53d01a7fbd7b244674128c7e468dd696
name: Test Delete Sparse Union
steps:
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: b40711a88c7039756fb8a73827eabe2c0fe5a0346ca7e0a104adc0fc764f528d
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 433ebf5bc03dffa38536673207a21281612cef5faa9bc7a4d5b9be2fdb12cf1a
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 88185d128d9922e0e6bcd32b07b6c7f20f27968eab447a1d8d1cdf250f79f7d3
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 1bc5d0e3df0ea12c4d0078668d14924f95106bbe173e196de50fe13a900b0937
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 221f8af2372a95064f2ef7d7712216a9ab46e7ef98482fd237e106f83eaa7569
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: b253668f6b59f1ff28522831931e4d3c5a3de533965af22e961735437c0172cb
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 1561ade0621c5acf44b780521f95a1e0b19b4e5032945b860c4032fc28a3a23b
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 17eb70034b5b71092521d184c5e7b069d47de657e51aef2be11a00c115036943
- action: update
data:
encoding: utf-8
value: DATA
key:
encoding: hex
value: 3b28a6c3766c6295adad976d349705ef49393fbfdebe4facb5862d2cdfa285d3
- action: delete
key:
encoding: hex
value: b40711a88c7039756fb8a73827eabe2c0fe5a0346ca7e0a104adc0fc764f528d
- action: delete
key:
encoding: hex
value: 88185d128d9922e0e6bcd32b07b6c7f20f27968eab447a1d8d1cdf250f79f7d3
- action: delete
key:
encoding: hex
value: 221f8af2372a95064f2ef7d7712216a9ab46e7ef98482fd237e106f83eaa7569
- action: delete
key:
encoding: hex
value: 1561ade0621c5acf44b780521f95a1e0b19b4e5032945b860c4032fc28a3a23b
- action: delete
key:
encoding: hex
value: 3b28a6c3766c6295adad976d349705ef49393fbfdebe4facb5862d2cdfa285d3
5 changes: 5 additions & 0 deletions fuel-merkle/tests-data/fixtures/Test Empty Root.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
expected_root:
encoding: hex
value: "0000000000000000000000000000000000000000000000000000000000000000"
name: Test Empty Root
steps: []
Loading

0 comments on commit 8972446

Please sign in to comment.