github.com/dashpay/godash@v0.0.0-20160726055534-e038a21e0e3d/database/ffldb/export_test.go (about)

     1  // Copyright (c) 2015-2016 The btcsuite developers
     2  // Copyright (c) 2016 The Dash developers
     3  // Use of this source code is governed by an ISC
     4  // license that can be found in the LICENSE file.
     5  
     6  /*
     7  This test file is part of the ffldb package rather than than the ffldb_test
     8  package so it can bridge access to the internals to properly test cases which
     9  are either not possible or can't reliably be tested via the public interface.
    10  The functions are only exported while the tests are being run.
    11  */
    12  
    13  package ffldb
    14  
    15  import "github.com/dashpay/godash/database"
    16  
    17  // TstRunWithMaxBlockFileSize runs the passed function with the maximum allowed
    18  // file size for the database set to the provided value.  The value will be set
    19  // back to the original value upon completion.
    20  func TstRunWithMaxBlockFileSize(idb database.DB, size uint32, fn func()) {
    21  	ffldb := idb.(*db)
    22  	origSize := ffldb.store.maxBlockFileSize
    23  
    24  	ffldb.store.maxBlockFileSize = size
    25  	fn()
    26  	ffldb.store.maxBlockFileSize = origSize
    27  }