-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from rogerwelin/v0.14.0
V0.14.0
- Loading branch information
Showing
13 changed files
with
134 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ jobs: | |
uses: actions/checkout@v2 | ||
|
||
- name: Unit-tests | ||
run: go test -v ./... | ||
run: go test -race -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM alpine:3.12.4 | ||
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* | ||
COPY cassowary /usr/bin/cassowary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package client | ||
|
||
import ( | ||
"image/color" | ||
|
||
"gonum.org/v1/plot" | ||
"gonum.org/v1/plot/plotter" | ||
"gonum.org/v1/plot/vg" | ||
) | ||
|
||
// PlotBoxplot outputs a boxplot png | ||
func (c *Cassowary) PlotBoxplot(durations []float64) error { | ||
p := plot.New() | ||
p.Title.Text = "Box Plot" | ||
|
||
vs := make(plotter.Values, len(durations)) | ||
for i, d := range durations { | ||
vs[i] = d | ||
} | ||
|
||
box, err := plotter.NewBoxPlot(vg.Length(20), 0.0, vs) | ||
if err != nil { | ||
panic(err) | ||
} | ||
box.FillColor = color.RGBA{R: 70, G: 130, B: 180, A: 1} | ||
p.Add(box) | ||
|
||
if err := p.Save(512, 512, "boxplot.png"); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package client | ||
|
||
import ( | ||
"math/rand" | ||
"os" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestBoxPlot(t *testing.T) { | ||
num := 100 | ||
res := make([]float64, num) | ||
filename := "boxplot.png" | ||
cass := &Cassowary{} | ||
rand.Seed(time.Now().UnixNano()) | ||
|
||
for i := 0; i < num; i++ { | ||
res = append(res, rand.Float64()*(200.0-10.0)) | ||
} | ||
|
||
err := cass.PlotBoxplot(res) | ||
if err != nil { | ||
t.Errorf("Expected ok but got: %v", err) | ||
} | ||
_, err = os.Stat(filename) | ||
if os.IsNotExist(err) { | ||
t.Errorf("Expected %s in current dir but got: %v", filename, err) | ||
} | ||
|
||
_ = os.Remove(filename) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters