Skip to content

Commit

Permalink
Make test go through all entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Masley committed Jul 24, 2017
1 parent 4c78ffb commit 867919c
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions controlPanel/controlPanel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func TestDataDump(t *testing.T) {
}

func TestSearching(t *testing.T) {
var err error
InitTemplates()
s := CreateAndPopulateTestState()
StatePointer = s
Expand All @@ -114,34 +115,37 @@ func TestSearching(t *testing.T) {
}

if len(d.GetEBlockDBEntries()) > 0 {
eb := d.GetEBlockDBEntries()[0]
eblock, err := s.DB.FetchEBlock(eb.GetKeyMR())
if err != nil {
t.Error(err)
t.FailNow()
}

e, err = s.DB.FetchEntry(eblock.GetEntryHashes()[0])
if err != nil {
t.Error(err)
t.FailNow()
for _, ebhash := range d.GetEBlockDBEntries() {
eblock, err := s.DB.FetchEBlock(ebhash.GetKeyMR())
if err != nil {
t.Error(err)
t.FailNow()
}

for _, ehash := range eblock.GetEntryHashes() {
e, err = s.DB.FetchEntry(ehash)
if err != nil {
t.Error(err)
t.FailNow()
}

c.Input = e.GetHash().String()
content, err := searchfor(c)
if err != nil {
t.Error(err)
t.FailNow()
}

if !strings.Contains(string(content), e.GetChainID().String()) {
t.Error("Does not contain correct content")
}
}
}
}
}

c.Input = e.GetHash().String()
content, err := searchfor(c)
if err != nil {
t.Error(err)
t.FailNow()
}

if !strings.Contains(string(content), e.GetChainID().String()) {
t.Error("Does not contain correct content")
}

c.Input = primitives.RandomHash().String()
content, err = searchfor(c)
content, err := searchfor(c)
if err != nil {
t.Error(err)
t.FailNow()
Expand Down

0 comments on commit 867919c

Please sign in to comment.