January 2020
Intermediate to advanced
640 pages
16h 56m
English
The test suite for the in-memory indexer implementation embeds the shared test suite we outlined in the Verifying indexer implementations using a shared test suite section. Since the suite depends on the gocheck framework, we need to add some extra code to register the suite with the go test framework:
var _ = gc.Suite(new(InMemoryBleveTestSuite)) type InMemoryBleveTestSuite struct { indextest.SuiteBase idx *InMemoryBleveIndexer } // Register our test-suite with go test. func Test(t *testing.T) { gc.TestingT(t) }
To ensure that each test uses a clean index instance, the suite provides a per-test setup method that recreates the index before running each test:
func (s *InMemoryBleveTestSuite) ...