Update storage kind test

Testing proto and snapshot kinds are equivalent when cast to each other.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan 2017-07-25 13:59:16 -07:00
parent 9434bf9e8a
commit 6012f5047d

View File

@ -18,15 +18,28 @@ func TestMetastore(t *testing.T) {
// TestKidnConversion ensures we can blindly cast from protobuf types. // TestKidnConversion ensures we can blindly cast from protobuf types.
func TestKindConversion(t *testing.T) { func TestKindConversion(t *testing.T) {
for _, testcase := range []snapshot.Kind{ for _, testcase := range []struct {
snapshot.KindView, s snapshot.Kind
snapshot.KindActive, p proto.Kind
snapshot.KindCommitted, }{
{
s: snapshot.KindView,
p: proto.KindView,
},
{
s: snapshot.KindActive,
p: proto.KindActive,
},
{
s: snapshot.KindCommitted,
p: proto.KindCommitted,
},
} { } {
cast := proto.Kind(testcase) if testcase.s != snapshot.Kind(testcase.p) {
uncast := snapshot.Kind(cast) t.Fatalf("snapshot kind value cast failed: %v != %v", testcase.s, testcase.p)
if uncast != testcase { }
t.Fatalf("kind value cast failed: %v != %v", uncast, testcase) if testcase.p != proto.Kind(testcase.s) {
t.Fatalf("proto kind value cast failed: %v != %v", testcase.s, testcase.p)
} }
} }
} }