-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decode to MacIface tests, wife is harassing me to stop working - more…
… tomorrow
- Loading branch information
Showing
1 changed file
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... |