diff --git a/.gitignore b/.gitignore index 22b85c8..1007419 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store main +*.coverprofile diff --git a/.travis.yml b/.travis.yml index d931af1..483fc5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,28 @@ sudo: no go: - 1.9 -go_import_path: - - "github.com/tatsy/gopt" +go_import_path: github.com/tatsy/gopt + +before_install: + - go get golang.org/x/tools/cmd/cover + - go get github.com/mattn/goveralls + - go get github.com/modocache/gover install: - make + - export GOPATH=$TRAVIS_BUILD_DIR + - go build ./... script: - make test + - go list -f '{{if len .TestGoFiles}}"go test -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"{{end}}' ./... | xargs -L 1 sh -c + +after_success: + - $HOME/gopath/bin/gover + - $HOME/gopath/bin/goveralls -coverprofile=gover.coverprofile -service=travis-ci -repotoken $COVERALLS_REPO_TOKEN + +env: + global: + secure: IX5ny+aDB+4lFpO5riuBHyTrWoUhdx5vPCAbavVupJdxuC+yRl1d3+KtCPOojlmbCqCEVseYkH0Iht8Sg7v5dRf2lqoX4p5i54akuP0BBTE5XQi0KAh9vCH/zkx9Kl1WTjm/4QzFxYwy3dCRUNNQZMu/4gFXnVG27GzcAkaQypBdKmpT5Kg8AlAqPTHmvflzTAINdtGHrw0SjL+yE86dQzjw59ipS1omadEfW++ZKyEMR8Wu1B1yPhxPKhVFI+Xq3PHNz9+HyjDYfvyqEgDNVe16/Wx2qLwDKh0CSbhsgxN8uPOrXAxZZjVL9Br1/8wZM39hQTsTW0CD2Fj+YKHxph+uOWEV1l9nBvHIvTR+3gVJewrib8rHK/KY4PARYjKWrhY6Prkd57a5/bjkbjIRoGboS/hNiT2p3yU6C2gd+PqtoygA5X+UX78ab7sGlcxpE8ITfgM/DJe4WbWItjczRa6n4Gm5/APHy1snZs+V+udbXp2I1NLZ/xl+SqISceSnUOvb+6zJ8Y9dPzcJtZOtlzsNCztm7R8Gg6m1p0DYcDkLgJFy6ejdXq/0/yz25qGMpdEfkvFFqDnoPtc4jm/U9MHavHtsqR0roRQfIqtCfD/6u35OGctwI3rrMttI/UoQMjYrjsz7BewVX10f+HOOqngoplaliIHIFmFftNpCuMM= + branches: only: diff --git a/Makefile b/Makefile index 076fadc..5127c8d 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ all: - go build src/main.go + export GOPATH=`pwd` + go build ./... run: go run src/main.go test: - go test ./src/... --count 10 --cover + go test ./... -v --count 10 --cover clean: - rm -rf main image.jpg + rm -rf main *.jpg *.png diff --git a/src/accelerator/bvh.go b/src/accelerator/bvh.go index 046597e..9a9bdc6 100644 --- a/src/accelerator/bvh.go +++ b/src/accelerator/bvh.go @@ -2,7 +2,7 @@ package accelerator import ( "sort" - . "../core" + . "core" ) type BvhNode struct { diff --git a/src/accelerator/bvh_test.go b/src/accelerator/bvh_test.go index c169af3..d164cbb 100644 --- a/src/accelerator/bvh_test.go +++ b/src/accelerator/bvh_test.go @@ -5,9 +5,9 @@ import ( "math" "math/rand" "testing" - . "../core" - . "../shape" - . "../bsdf" + . "core" + . "shape" + . "bsdf" ) func TestAxisSorter(t *testing.T) { diff --git a/src/bsdf/lambert.go b/src/bsdf/lambert.go index 9f782b0..406cf29 100644 --- a/src/bsdf/lambert.go +++ b/src/bsdf/lambert.go @@ -2,7 +2,7 @@ package bsdf import ( // "math" - . "../core" + . "core" ) type LambertBsdf struct { diff --git a/src/integrator/path.go b/src/integrator/path.go index 36ed521..5efc2a4 100644 --- a/src/integrator/path.go +++ b/src/integrator/path.go @@ -1,8 +1,8 @@ package integrator import ( - . "../core" - . "../accelerator" + . "core" + . "accelerator" ) type PathIntegrator struct { diff --git a/src/main.go b/src/main.go index 466ccc0..45a244b 100644 --- a/src/main.go +++ b/src/main.go @@ -2,13 +2,13 @@ package main import ( "fmt" - . "./core" - . "./accelerator" - . "./bsdf" - . "./shape" - . "./sensor" - . "./sampler" - . "./integrator" + . "core" + . "accelerator" + . "bsdf" + . "shape" + . "sensor" + . "sampler" + . "integrator" ) const ( diff --git a/src/sampler/independent.go b/src/sampler/independent.go index eefaacd..9eb3d23 100644 --- a/src/sampler/independent.go +++ b/src/sampler/independent.go @@ -2,7 +2,7 @@ package sampler import ( "math/rand" - . "../core" + . "core" ) type IndependentSampler struct { diff --git a/src/sensor/perspective.go b/src/sensor/perspective.go index 6243e7c..6fee14f 100644 --- a/src/sensor/perspective.go +++ b/src/sensor/perspective.go @@ -2,7 +2,7 @@ package sensor import ( "math" - . "../core" + . "core" ) type PerspectiveSensor struct { diff --git a/src/shape/sphere.go b/src/shape/sphere.go index 240605d..9419bac 100644 --- a/src/shape/sphere.go +++ b/src/shape/sphere.go @@ -1,7 +1,7 @@ package shape import ( - . "../core" + . "core" ) type Sphere struct { diff --git a/src/shape/triangle.go b/src/shape/triangle.go index c14b593..7489f96 100644 --- a/src/shape/triangle.go +++ b/src/shape/triangle.go @@ -2,7 +2,7 @@ package shape import ( "math" - . "../core" + . "core" ) type Triangle struct { diff --git a/src/shape/triangle_test.go b/src/shape/triangle_test.go index 52ec12e..34bbca3 100644 --- a/src/shape/triangle_test.go +++ b/src/shape/triangle_test.go @@ -2,7 +2,7 @@ package shape import ( "testing" - . "../core" + . "core" ) func TestTriangleIntersect(t *testing.T) { diff --git a/src/shape/trimesh.go b/src/shape/trimesh.go index c6cd8fd..358f802 100644 --- a/src/shape/trimesh.go +++ b/src/shape/trimesh.go @@ -7,7 +7,7 @@ import ( "bufio" "strings" "strconv" - . "../core" + . "core" ) type TriMesh struct {