github.com/sberex/go-sberex@v1.8.2-0.20181113200658-ed96ac38f7d7/swarm/storage/memstore_test.go (about)

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