(t *testing.T)
| 58 | } |
| 59 | |
| 60 | func TestGetDimensions(t *testing.T) { |
| 61 | tests := []struct { |
| 62 | filename string |
| 63 | width int |
| 64 | height int |
| 65 | }{ |
| 66 | {"./testdata/ben.jpg", 2000, 1500}, |
| 67 | {"./testdata/acai.jpg", 4032, 3024}, |
| 68 | {"./testdata/dog.jpg", 4592, 3448}, |
| 69 | {"./testdata/small-png.png", 167, 167}, |
| 70 | } |
| 71 | |
| 72 | for _, tt := range tests { |
| 73 | width, height, err := GetDimensions(openFile(tt.filename)) |
| 74 | if err != nil { |
| 75 | t.Errorf("Received unexpected error when getting dimensions: %s", err) |
| 76 | } |
| 77 | if width != tt.width { |
| 78 | t.Errorf("GetDimensions(%s) has wrong width. Expected %d to be %d", tt.filename, width, tt.width) |
| 79 | } |
| 80 | if height != tt.height { |
| 81 | t.Errorf("GetDimensions(%s) has wrong height dims. Expected %d to be %d", tt.filename, height, tt.height) |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | func TestManipulate(t *testing.T) { |
| 87 | tests := []struct { |
nothing calls this directly
no test coverage detected