Test SWAPN¶
Documentation for tests/amsterdam/eip8024_dupn_swapn_exchange/test_swapn.py@tests-bal@v5.7.0.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip8024_dupn_swapn_exchange/test_swapn.py --fork Amsterdam
Test Functions Overview¶
| Name | Type | Cases (Amsterdam) | Description |
|---|---|---|---|
test_endofcode_behavior |
state_test | 1 | Test SWAPN when the immediate byte is beyond the end of code. |
test_swapn_basic |
state_test | 8 | Test SWAPN with various stack indices (17-235). |
test_swapn_jump_to_immediate_byte_0x5b_succeeds |
state_test | 1 | Test that jumping to 0x5b after SWAPN succeeds (backward compat). |
test_swapn_jump_to_valid_immediate_fails |
state_test | 1 | Test jumping to a valid immediate byte fails. |
test_swapn_preserves_other_stack_items |
state_test | 1 | Test SWAPN only swaps the specified items, leaving others unchanged. |
test_swapn_stack_underflow |
state_test | 1 | Test SWAPN causes transaction failure on stack underflow. |
test_swapn_valid_immediates |
state_test | 6 | Test SWAPN with valid immediate values (0-90 and 128-255). |
test_swapn_with_dup1_and_push |
state_test | 1 | Test SWAPN swapping top and bottom after building stack with DUP1. |