Skip to content

Commit

Permalink
tests for openImageFromPath helper
Browse files Browse the repository at this point in the history
  • Loading branch information
auyer committed Apr 26, 2019
1 parent 5504b18 commit ce58e76
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/stego_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"image"
"log"
"testing"
)

var rawInputFile = "./stegosaurus.png"
var encodedInputFile = "./encoded_stegosaurus.png"

func TestOpenImageFromPath(t *testing.T) {
img, err := OpenImageFromPath(rawInputFile)
if err != nil {
log.Printf("Error opening or Decoding file %s: %v", rawInputFile, err)
t.FailNow()
}
if (img.Bounds().Bounds() != image.Rectangle{image.Point{0, 0}, image.Point{1195, 642}}) {
log.Printf("Image has wrong size")
t.FailNow()

}
}

func TestEmptyPathHelperFunction(t *testing.T) {
_, err := OpenImageFromPath(" ")
if err == nil {
log.Print("Empty path given, err could not be nil.")
t.FailNow()
}
}

0 comments on commit ce58e76

Please sign in to comment.