Skip to content

Commit

Permalink
decode to MacIface tests, wife is harassing me to stop working - more…
Browse files Browse the repository at this point in the history
… tomorrow
  • Loading branch information
sabhiram committed Feb 22, 2015
1 parent 877e68f commit 03c5aa7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cmd/wol/alias_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
package main

import (
"bytes"
"encoding/gob"

"github.com/stretchr/testify/assert"
"testing"
)

// This is just a dummy test to enable cross package coverage
func TestDecodeToMacIface(test *testing.T) {
assert.Equal(test, 1, 1)
var TestCases = []MacIface {
MacIface{ "00:00:00:00:00:00", "eth0" },
MacIface{ "00:00:00:00:00:AA", "eth1" },
}

for _, entry := range TestCases {
// First encode the MacIface to a bunch of bytes
buf := bytes.NewBuffer(nil)
err := gob.NewEncoder(buf).Encode(entry);
assert.Equal(test, err, nil)

// Invoke the function and validate that it is equal
// to our starting MacIface
result, err := DecodeToMacIface(buf)
assert.Equal(test, err, nil)
assert.Equal(test, entry, result)
}
}

// TODO: Add BoltDB related alias tests here...

0 comments on commit 03c5aa7

Please sign in to comment.