github.com/memikequinn/go-ethereum@v1.6.6-0.20170621145815-58a1e13e6dd7/swarm/storage/memstore_test.go (about)

     1  // Copyright 2016 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package storage
    18  
    19  import (
    20  	"testing"
    21  )
    22  
    23  func testMemStore(l int64, branches int64, t *testing.T) {
    24  	m := NewMemStore(nil, defaultCacheCapacity)
    25  	testStore(m, l, branches, t)
    26  }
    27  
    28  func TestMemStore128_10000(t *testing.T) {
    29  	testMemStore(10000, 128, t)
    30  }
    31  
    32  func TestMemStore128_1000(t *testing.T) {
    33  	testMemStore(1000, 128, t)
    34  }
    35  
    36  func TestMemStore128_100(t *testing.T) {
    37  	testMemStore(100, 128, t)
    38  }
    39  
    40  func TestMemStore2_100(t *testing.T) {
    41  	testMemStore(100, 2, t)
    42  }
    43  
    44  func TestMemStoreNotFound(t *testing.T) {
    45  	m := NewMemStore(nil, defaultCacheCapacity)
    46  	_, err := m.Get(ZeroKey)
    47  	if err != notFound {
    48  		t.Errorf("Expected notFound, got %v", err)
    49  	}
    50  }