2014-02-09 22:52:19 +00:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Ensure that meta with bad magic is invalid.
|
|
|
|
func TestMetaValidateMagic(t *testing.T) {
|
|
|
|
m := &meta{magic: 0x01234567}
|
2014-02-16 19:18:44 +00:00
|
|
|
assert.Equal(t, m.validate(), ErrInvalid)
|
2014-02-09 22:52:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure that meta with a bad version is invalid.
|
|
|
|
func TestMetaValidateVersion(t *testing.T) {
|
|
|
|
m := &meta{magic: magic, version: 200}
|
2014-02-16 19:18:44 +00:00
|
|
|
assert.Equal(t, m.validate(), ErrVersionMismatch)
|
2014-02-09 22:52:19 +00:00
|
|
|
}
|