Skip to content

Commit

Permalink
enabling testing subpackages
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsole committed Jul 23, 2023
1 parent 5f538d2 commit 584a64a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run:
CGO_ENABLED=$(CGO_ENABLED) go run .

test:
CGO_ENABLED=$(CGO_ENABLED) go test .
CGO_ENABLED=$(CGO_ENABLED) go test ./...

.PHONY: \
build \
Expand Down
31 changes: 0 additions & 31 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@ import (
"github.com/nielsole/go_tile/utils"
)

func TestParse(t *testing.T) {
z, x, y, ext, err := utils.ParsePath("/tile/4/3/2.webp")
if err != nil {
t.Error(err)
}
if z != 4 || x != 3 || y != 2 || ext != "webp" {
t.Fail()
}
}

func TestParseError(t *testing.T) {
invalid_paths := []string{
"/tile/4/3/2",
"/tile/4/3/2.jpg",
"/tile/4/3/2.png/",
"/tile/4/3/2.png/3",
"/tile/4/3/2.png/3/4",
"/tile/-1/3/2.png",
"/tile/1.5/3/2.png",
"/tile/10000/3.5/2.png",
"/tile/100000000000000000000000000000000000000000000000000000000000000000/3/2.5.png",
"/tile/abc/3/2.png",
}
for _, path := range invalid_paths {
_, _, _, _, err := utils.ParsePath(path)
if err == nil {
t.Errorf("expected error for path %s", path)
}
}
}

// cpu: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
// BenchmarkPngRead-4 88027 13260 ns/op
// BenchmarkWriteTileResponse-4 55233 21662 ns/op
Expand Down

0 comments on commit 584a64a

Please sign in to comment.