From 2971d1437fd2fe271af6211a0a22ec10465faa69 Mon Sep 17 00:00:00 2001 From: leovct Date: Thu, 25 Jul 2024 18:31:57 +0200 Subject: [PATCH] docs: document mstore test --- stack_ops_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stack_ops_test.go b/stack_ops_test.go index be14d54..e525c8f 100644 --- a/stack_ops_test.go +++ b/stack_ops_test.go @@ -37,10 +37,13 @@ func TestMStore(t *testing.T) { op := func(evm IEVM) error { return evm.MStore() } // Stack + // [32, 444, 2, 3] offset := 32 initialStack := []uint64{3, 2, 444, uint64(offset)} // Memory + // Each word is represented by 32 bytes. + // [111, 222, 333] word1 := uint256.NewInt(111).Bytes32() word2 := uint256.NewInt(222).Bytes32() word3 := uint256.NewInt(333).Bytes32() @@ -48,11 +51,9 @@ func TestMStore(t *testing.T) { memory = append(append(append(memory, word1[:]...), word2[:]...), word3[:]...) // Expected + // - Stack: [2, 3] + // - Memory: [111, 444, 333] expectedStack := []uint64{3, 2} - var expectedMemory []byte - newWord := uint256.NewInt(444).Bytes32() - expectedMemory = append(append(append(expectedMemory, word1[:]...), newWord[:]...), word3[:]...) - testStackOperationWithNewEVM(t, op, nil, initialStack, expectedStack, memory, nil) }