Skip to content

Commit

Permalink
Merge pull request #21 from tri-adam/clean-unit-tests
Browse files Browse the repository at this point in the history
Clean Up Unit Tests
  • Loading branch information
tri-adam authored Jun 16, 2021
2 parents 69d9879 + 9264fe3 commit 4373c51
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
*~
/cmd/siftool/siftool

# couple test images to ignore
/pkg/sif/testdata/testcontainer.sif
/pkg/sif/testdata/test-obj-container.sif
20 changes: 17 additions & 3 deletions pkg/sif/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
const (
headerLen = 128
descrLen = 585

testObjContainer = "testdata/test-obj-container.sif"
)

func TestNextAligned(t *testing.T) {
Expand Down Expand Up @@ -60,14 +58,21 @@ func TestDataStructs(t *testing.T) {
}

func TestCreateContainer(t *testing.T) {
f, err := os.CreateTemp("", "sif-test-*")
if err != nil {
t.Fatal(err)
}
defer os.Remove(f.Name())
f.Close()

id, err := uuid.NewV4()
if err != nil {
t.Fatal(err)
}

// general info for the new SIF file creation
cinfo := CreateInfo{
Pathname: "testdata/testcontainer.sif",
Pathname: f.Name(),
Launchstr: HdrLaunch,
Sifversion: HdrVersion,
ID: id,
Expand Down Expand Up @@ -142,6 +147,15 @@ func TestCreateContainer(t *testing.T) {
}

func TestAddDelObject(t *testing.T) {
f, err := os.CreateTemp("", "sif-test-*")
if err != nil {
t.Fatal(err)
}
defer os.Remove(f.Name())
f.Close()

testObjContainer := f.Name()

// data we need to create a dummy labels descriptor
labinput := DescriptorInput{
Datatype: DataLabels,
Expand Down
Binary file removed pkg/sif/testdata/testcontainer.sif
Binary file not shown.

0 comments on commit 4373c51

Please sign in to comment.