Purge goconvey and mock
These packages really impact on test readability with crazy action at a distance. In addition to this removal of goconvey reduced the test run time for leveldb on average by about 40-50%.
This commit is contained in:
parent
3f6cfc98d5
commit
1c181429da
9 changed files with 602 additions and 587 deletions
|
|
@ -17,44 +17,58 @@ package iterator
|
|||
// A quickly mocked version of the TripleStore interface, for use in tests.
|
||||
// Can better used Mock.Called but will fill in as needed.
|
||||
|
||||
import (
|
||||
"github.com/stretchrcom/testify/mock"
|
||||
import "github.com/google/cayley/graph"
|
||||
|
||||
"github.com/google/cayley/graph"
|
||||
)
|
||||
|
||||
type TestTripleStore struct {
|
||||
mock.Mock
|
||||
type store struct {
|
||||
data []string
|
||||
iter graph.Iterator
|
||||
}
|
||||
|
||||
func (ts *TestTripleStore) ValueOf(s string) graph.Value {
|
||||
args := ts.Mock.Called(s)
|
||||
return args.Get(0)
|
||||
func (ts *store) ValueOf(s string) graph.Value {
|
||||
for i, v := range ts.data {
|
||||
if s == v {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (ts *TestTripleStore) AddTriple(*graph.Triple) {}
|
||||
func (ts *TestTripleStore) AddTripleSet([]*graph.Triple) {}
|
||||
func (ts *TestTripleStore) Triple(graph.Value) *graph.Triple { return &graph.Triple{} }
|
||||
func (ts *TestTripleStore) TripleIterator(d graph.Direction, i graph.Value) graph.Iterator {
|
||||
args := ts.Mock.Called(d, i)
|
||||
return args.Get(0).(graph.Iterator)
|
||||
|
||||
func (ts *store) AddTriple(*graph.Triple) {}
|
||||
|
||||
func (ts *store) AddTripleSet([]*graph.Triple) {}
|
||||
|
||||
func (ts *store) Triple(graph.Value) *graph.Triple { return &graph.Triple{} }
|
||||
|
||||
func (ts *store) TripleIterator(d graph.Direction, i graph.Value) graph.Iterator {
|
||||
return ts.iter
|
||||
}
|
||||
func (ts *TestTripleStore) NodesAllIterator() graph.Iterator { return &Null{} }
|
||||
func (ts *TestTripleStore) TriplesAllIterator() graph.Iterator { return &Null{} }
|
||||
func (ts *TestTripleStore) GetIteratorByString(string, string, string) graph.Iterator {
|
||||
return &Null{}
|
||||
|
||||
func (ts *store) NodesAllIterator() graph.Iterator { return &Null{} }
|
||||
|
||||
func (ts *store) TriplesAllIterator() graph.Iterator { return &Null{} }
|
||||
|
||||
func (ts *store) NameOf(v graph.Value) string {
|
||||
i := v.(int)
|
||||
if i < 0 || i >= len(ts.data) {
|
||||
return ""
|
||||
}
|
||||
return ts.data[i]
|
||||
}
|
||||
func (ts *TestTripleStore) NameOf(v graph.Value) string {
|
||||
args := ts.Mock.Called(v)
|
||||
return args.Get(0).(string)
|
||||
}
|
||||
func (ts *TestTripleStore) Size() int64 { return 0 }
|
||||
func (ts *TestTripleStore) DebugPrint() {}
|
||||
func (ts *TestTripleStore) OptimizeIterator(it graph.Iterator) (graph.Iterator, bool) {
|
||||
|
||||
func (ts *store) Size() int64 { return 0 }
|
||||
|
||||
func (ts *store) DebugPrint() {}
|
||||
|
||||
func (ts *store) OptimizeIterator(it graph.Iterator) (graph.Iterator, bool) {
|
||||
return &Null{}, false
|
||||
}
|
||||
func (ts *TestTripleStore) FixedIterator() graph.FixedIterator {
|
||||
|
||||
func (ts *store) FixedIterator() graph.FixedIterator {
|
||||
return NewFixedIteratorWithCompare(BasicEquality)
|
||||
}
|
||||
func (ts *TestTripleStore) Close() {}
|
||||
func (ts *TestTripleStore) TripleDirection(graph.Value, graph.Direction) graph.Value { return 0 }
|
||||
func (ts *TestTripleStore) RemoveTriple(t *graph.Triple) {}
|
||||
|
||||
func (ts *store) Close() {}
|
||||
|
||||
func (ts *store) TripleDirection(graph.Value, graph.Direction) graph.Value { return 0 }
|
||||
|
||||
func (ts *store) RemoveTriple(t *graph.Triple) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue