github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/core/vm/gas_table_test.go (about)

     1  package vm
     2  
     3  import "testing"
     4  
     5  func TestMemoryGasCost(t *testing.T) {
     6  	//size := uint64(math.MaxUint64 - 64)
     7  	size := uint64(0xffffffffe0)
     8  	v, err := memoryGasCost(&Memory{}, size)
     9  	if err != nil {
    10  		t.Error("didn't expect error:", err)
    11  	}
    12  	if v != 36028899963961341 {
    13  		t.Errorf("Expected: 36028899963961341, got %d", v)
    14  	}
    15  
    16  	_, err = memoryGasCost(&Memory{}, size+1)
    17  	if err == nil {
    18  		t.Error("expected error")
    19  	}
    20  }