Checkpoint
This commit is contained in:
125 files changed
+59376
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package display_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.maze.io/go/harmon/display"
|
||||
)
|
||||
|
||||
func TestParseSize(t *testing.T) {
|
||||
testCases := []struct {
|
||||
Test string
|
||||
DefaultWidth int
|
||||
DefaultHeight int
|
||||
Width int
|
||||
Height int
|
||||
}{
|
||||
{"", 128, 64, 128, 64},
|
||||
{"x32", 128, 64, 128, 32},
|
||||
{"64x", 128, 64, 64, 64},
|
||||
{"123x456", 128, 64, 123, 456},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.Test, func(it *testing.T) {
|
||||
w, h, err := display.ParseSize(test.Test, test.DefaultWidth, test.DefaultHeight)
|
||||
if err != nil {
|
||||
it.Fatal(err)
|
||||
}
|
||||
if w != test.Width {
|
||||
it.Errorf("expected %q to return width %d, got %d", test.Test, test.Width, w)
|
||||
}
|
||||
if h != test.Height {
|
||||
it.Errorf("expected %q to return height %d, got %d", test.Test, test.Height, h)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user