Skip to content

Commit 89f62a6

Browse files
authored
Merge pull request #68 from refcell/brock/testing-infra
feat(e2e): gas snapshot infra and consolidated test helpers
2 parents 76aa326 + 93b5693 commit 89f62a6

22 files changed

Lines changed: 1502 additions & 2259 deletions

Justfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,27 @@ check-stdlib:
8383
done < <(find std -name '*.edge' -print0 | sort -z)
8484
exit $failed
8585

86-
# Run acceptance tests
86+
# Run acceptance tests and update gas snapshot
8787
e2e:
88+
#!/usr/bin/env bash
89+
set -euo pipefail
90+
rm -rf /tmp/edge-gas
8891
cargo test -p edge-e2e
92+
if [ -f /tmp/edge-gas/e2e.csv ]; then
93+
sort /tmp/edge-gas/e2e.csv > crates/e2e/.gas-snapshot
94+
echo "Gas snapshot written to crates/e2e/.gas-snapshot ($(wc -l < crates/e2e/.gas-snapshot) entries)"
95+
fi
8996

90-
# Run acceptance tests for CI
97+
# Run acceptance tests for CI and update gas snapshot
9198
e2e-ci:
99+
#!/usr/bin/env bash
100+
set -euo pipefail
101+
rm -rf /tmp/edge-gas
92102
cargo nextest run -p edge-e2e
103+
if [ -f /tmp/edge-gas/e2e.csv ]; then
104+
sort /tmp/edge-gas/e2e.csv > crates/e2e/.gas-snapshot
105+
echo "Gas snapshot written to crates/e2e/.gas-snapshot ($(wc -l < crates/e2e/.gas-snapshot) entries)"
106+
fi
93107

94108
# Run benchmarks
95109
bench:

crates/e2e/.gas-snapshot

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
test_arrays::element_access(), 358, 328, 328, 328
2+
test_arrays::get(uint256), 2331, 2326, 2326, 2326
3+
test_arrays::set(uint256,uint256), 22502, 22497, 22497, 22497
4+
test_arrays::slice_sum(), 510, 439, 439, 439
5+
test_arrays::sum_array(), 1158, 1124, 1124, 1124
6+
test_checked_arith::chain_safe(uint256,uint256), 516, 516, 516, 516
7+
test_checked_arith::masked_add(uint256), 864, 864, 864, 864
8+
test_checked_arith::safe_add(uint256,uint256), 516, 516, 516, 516
9+
test_checked_arith::safe_mul(uint256,uint256), 1056, 1056, 1056, 1056
10+
test_checked_arith::safe_sub(uint256,uint256), 534, 534, 534, 534
11+
test_default_methods::test_chained_default_call(), 462, 449, 276, 276
12+
test_default_methods::test_chained_default(), 434, 421, 248, 248
13+
test_default_methods::test_default_method_call(), 377, 364, 276, 276
14+
test_default_methods::test_default_method(), 344, 332, 245, 245
15+
test_default_methods::test_full_override(), 236, 223, 189, 189
16+
test_default_methods::test_override_method_call(), 370, 357, 277, 277
17+
test_default_methods::test_override_method(), 283, 270, 190, 190
18+
test_default_methods::test_partial_override_chain(), 425, 412, 247, 247
19+
test_default_methods::test_required_method_call(), 263, 250, 247, 247
20+
test_default_methods::test_required_method(), 148, 135, 132, 132
21+
test_enums2::direction_north(), 165, 140, 140, 140
22+
test_enums2::direction_west(), 222, 118, 118, 118
23+
test_enums2::is_north_check(uint256), 306, 306, 306, 306
24+
test_enums2::result_err_value(), 269, 263, 255, 255
25+
test_enums2::result_ok_value(), 152, 146, 138, 138
26+
test_generics::test_entry_key(), 322, 303, 303, 303
27+
test_generics::test_entry_value(), 324, 304, 301, 301
28+
test_generics::test_identity(), 252, 252, 252, 252
29+
test_generics::test_max(), 283, 253, 253, 253
30+
test_generics::test_min(), 323, 283, 283, 283
31+
test_generics::test_option_none(), 307, 307, 299, 299
32+
test_generics::test_option_some(), 264, 258, 258, 258
33+
test_generics::test_result_err(), 234, 228, 220, 220
34+
test_generics::test_result_ok(), 349, 343, 335, 335
35+
test_generics::test_turbofish_identity(), 196, 196, 196, 196
36+
test_generics::test_turbofish_max(), 285, 255, 255, 255
37+
test_impl::test_counter_add(), 224, 211, 177, 177
38+
test_impl::test_counter_get(), 161, 148, 145, 145
39+
test_impl::test_point_scale(), 354, 329, 249, 249
40+
test_impl::test_point_sum(), 135, 113, 110, 110
41+
test_impl::test_point_x(), 195, 176, 176, 176
42+
test_inline_asm::asm_add(), 149, 149, 149, 149
43+
test_inline_asm::asm_caller(), 202, 202, 202, 202
44+
test_inline_asm::asm_computed_local(), 244, 210, 210, 210
45+
test_inline_asm::asm_hex_literal(), 201, 201, 201, 201
46+
test_inline_asm::asm_identity(), 96, 96, 96, 96
47+
test_inline_asm::asm_local_var(), 208, 208, 208, 208
48+
test_inline_asm::asm_mul_add(), 158, 158, 158, 158
49+
test_inline::add_offset_val(), 250, 109, 109, 109
50+
test_inline::double_val(), 195, 129, 129, 129
51+
test_inline::inline_in_branch(uint256), 354, 306, 306, 306
52+
test_inline::inline_in_loop(), 1039, 879, 879, 879
53+
test_inline::triple_val(), 254, 114, 114, 114
54+
test_inline::weighted_sum_val(), 441, 164, 164, 164
55+
test_logs::emit_no_indexed(uint256), 23257, 23250, 23250, 23250
56+
test_logs::emit_one_indexed(uint256,uint256), 23566, 23559, 23559, 23559
57+
test_logs::emit_three_indexed(uint256,uint256,uint256), 24125, 24123, 24123, 24123
58+
test_logs::emit_two_indexed(address,address,uint256), 24014, 24007, 24007, 24007
59+
test_logs::get_marker(), 2213, 2213, 2213, 2213
60+
test_loop_storage::accumulate(uint256), 23541, 23541, 23541, 23541
61+
test_loop_storage::count_up(uint256), 23161, 23161, 23161, 23161
62+
test_loop_storage::get_count(), 2229, 2229, 2229, 2229
63+
test_loop_storage::get_last_val(), 2230, 2230, 2230, 2230
64+
test_loop_storage::get_total(), 2285, 2285, 2285, 2285
65+
test_loop_storage::read_write_loop(uint256), 45014, 45014, 45014, 45014
66+
test_loop_storage::reset(), 4790, 4790, 4790, 4790
67+
test_mappings::counter_get(address), 2411, 2405, 2405, 2405
68+
test_mappings::counter_inc(address), 22574, 22562, 22562, 22562
69+
test_mappings::map_add(address,uint256), 5474, 5462, 5462, 5462
70+
test_mappings::map_get(address), 2353, 2347, 2347, 2347
71+
test_mappings::map_set(address,uint256), 22463, 22458, 22458, 22458
72+
test_mappings::nested_get(address,address), 2576, 2564, 2564, 2564
73+
test_mappings::nested_set(address,address,uint256), 22575, 22563, 22563, 22563
74+
test_mappings::nested_two_spenders(address,address,address,uint256,uint256), 44809, 44785, 44785, 44785
75+
test_mappings::two_keys(address,address,uint256,uint256), 44595, 44583, 44583, 44583
76+
test_merkle::hash_two(bytes32,bytes32), 516, 516, 516, 516
77+
test_merkle::verify(bytes32,bytes32,bytes32[4],uint256), 1530, 1530, 1530, 1530
78+
test_packed_storage::store_and_read_b(), 22397, 22358, 22340, 22340
79+
test_packed_storage::store_and_read_g(), 22345, 22306, 22282, 22282
80+
test_packed_storage::store_and_read_r(), 22342, 22304, 22282, 22282
81+
test_packed_storage::store_and_read_sum(), 22489, 22400, 22340, 22340
82+
test_packed_storage::store_pair_read_a(), 22387, 22360, 22342, 22342
83+
test_packed_storage::store_pair_read_b(), 22379, 22352, 22340, 22340
84+
test_packed_storage::write_subfield_preserves(), 22427, 22300, 22225, 22225
85+
test_packed_storage::write_subfield_r(), 22499, 22418, 22370, 22370
86+
test_packed_structs::packed_field_sum(), 393, 289, 232, 232
87+
test_packed_structs::packed_pair_a(), 279, 247, 232, 232
88+
test_packed_structs::packed_pair_b(), 158, 126, 117, 117
89+
test_packed_structs::packed_rgb_b(), 292, 248, 233, 233
90+
test_packed_structs::packed_rgb_g(), 240, 196, 175, 175
91+
test_packed_structs::packed_rgb_r(), 293, 250, 230, 230
92+
test_packed_structs::packed_two_structs(), 338, 225, 204, 204
93+
test_packed_transient::store_and_read_b(), 397, 358, 340, 340
94+
test_packed_transient::store_and_read_g(), 345, 306, 282, 282
95+
test_packed_transient::store_and_read_r(), 342, 304, 282, 282
96+
test_packed_transient::store_and_read_sum(), 489, 400, 340, 340
97+
test_packed_transient::store_pair_read_a(), 387, 360, 342, 342
98+
test_packed_transient::store_pair_read_b(), 379, 352, 340, 340
99+
test_packed_transient::write_subfield_preserves(), 427, 300, 225, 225
100+
test_packed_transient::write_subfield_r(), 499, 418, 370, 370
101+
test_structs::point_sum(), 158, 133, 130, 130
102+
test_structs::point_x(), 148, 131, 131, 131
103+
test_structs::point_y(), 188, 168, 165, 165
104+
test_structs::two_structs(), 256, 217, 214, 214
105+
test_supertraits::test_base_method_call(), 96, 96, 96, 96
106+
test_supertraits::test_base_method(), 131, 119, 117, 117
107+
test_supertraits::test_extended_method_call(), 255, 242, 162, 162
108+
test_supertraits::test_extended_method(), 216, 203, 123, 123
109+
test_trait_bounds::test_bound_other(), 217, 209, 209, 209
110+
test_trait_bounds::test_bound_satisfied(), 157, 150, 150, 150
111+
test_trait_bounds::test_extract_other_method(), 359, 346, 266, 266
112+
test_trait_bounds::test_extract_other(), 417, 404, 324, 324
113+
test_trait_bounds::test_extract_wrapper_method(), 311, 298, 295, 295
114+
test_trait_bounds::test_extract_wrapper(), 282, 269, 266, 266
115+
test_trait_bounds::test_multiple_bounds_other(), 333, 325, 325, 325
116+
test_trait_bounds::test_multiple_bounds(), 216, 208, 208, 208
117+
test_trait_bounds::test_scale_other(), 464, 451, 294, 294
118+
test_trait_bounds::test_scale_wrapper(), 360, 347, 267, 267
119+
test_trait_bounds::test_type_bound_other(), 333, 310, 316, 316
120+
test_trait_bounds::test_type_bound(), 303, 280, 286, 286
121+
test_traits::test_add_overload(), 281, 242, 270, 270
122+
test_traits::test_double_method(), 276, 263, 183, 183
123+
test_traits::test_double_then_triple(), 414, 401, 241, 241
124+
test_traits::test_double(), 331, 319, 240, 240
125+
test_traits::test_eq_overload(), 308, 282, 279, 279
126+
test_traits::test_triple_method(), 219, 206, 126, 126
127+
test_traits::test_triple(), 333, 320, 240, 240
128+
test_transient::get_counter(), 2285, 2285, 2285, 2285
129+
test_transient::get_tval(), 284, 284, 284, 284
130+
test_transient::get_tval2(), 229, 229, 229, 229
131+
test_transient::inc_counter(), 22196, 22196, 22196, 22196
132+
test_transient::set_both(uint256,uint256), 22393, 22393, 22393, 22393
133+
test_transient::set_tval(uint256), 306, 306, 306, 306
134+
test_transient::set_tval2(uint256), 306, 306, 306, 306
135+
test_unsafe_arith::test_add_overflow(), 96, 96, 96, 96
136+
test_unsafe_arith::test_mul_overflow(), 181, 173, 173, 173
137+
test_unsafe_arith::test_sub_underflow(), 122, 122, 122, 122
138+
test_unsafe_arith::test_unsafe_add(), 135, 129, 129, 129
139+
test_unsafe_arith::test_unsafe_mul(), 120, 112, 112, 112
140+
test_unsafe_arith::test_unsafe_sub(), 166, 160, 160, 160

0 commit comments

Comments
 (0)