|
|
@ -40,6 +40,14 @@ func Test_LogNewEmpty(t *testing.T) {
|
|
|
|
if lci != 0 {
|
|
|
|
if lci != 0 {
|
|
|
|
t.Fatalf("got wrong value for last command index of not empty log: %d", lci)
|
|
|
|
t.Fatalf("got wrong value for last command index of not empty log: %d", lci)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f, err := l.HasCommand()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatalf("failed to get has command: %s", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if f {
|
|
|
|
|
|
|
|
t.Fatalf("got wrong value for has command of empty log: %v", f)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func Test_LogNewExistNotEmpty(t *testing.T) {
|
|
|
|
func Test_LogNewExistNotEmpty(t *testing.T) {
|
|
|
@ -91,6 +99,14 @@ func Test_LogNewExistNotEmpty(t *testing.T) {
|
|
|
|
t.Fatalf("got wrong value for last command index of not empty log: %d", lci)
|
|
|
|
t.Fatalf("got wrong value for last command index of not empty log: %d", lci)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f, err := l.HasCommand()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatalf("failed to get has command: %s", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if !f {
|
|
|
|
|
|
|
|
t.Fatalf("got wrong value for has command of non-empty log: %v", f)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if err := l.Close(); err != nil {
|
|
|
|
if err := l.Close(); err != nil {
|
|
|
|
t.Fatalf("failed to close log: %s", err)
|
|
|
|
t.Fatalf("failed to close log: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -311,6 +327,14 @@ func Test_LogDeleteAll(t *testing.T) {
|
|
|
|
if li != 0 {
|
|
|
|
if li != 0 {
|
|
|
|
t.Fatalf("got wrong value for last index of empty log: %d", li)
|
|
|
|
t.Fatalf("got wrong value for last index of empty log: %d", li)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f, err := l.HasCommand()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatalf("failed to get has command: %s", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if f {
|
|
|
|
|
|
|
|
t.Fatalf("got wrong value for has command of empty log: %v", f)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func Test_LogLastCommandIndexNotExist(t *testing.T) {
|
|
|
|
func Test_LogLastCommandIndexNotExist(t *testing.T) {
|
|
|
|