-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgopherplot_test.go
More file actions
45 lines (39 loc) · 803 Bytes
/
gopherplot_test.go
File metadata and controls
45 lines (39 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package gopherplot_test
import (
"io/ioutil"
"net/http"
"testing"
"time"
gp "github.com/matthewapeters/gopherplot"
)
func TestServer(t *testing.T) {
d := gp.DataSpace{}
doTest := make(chan bool)
go func() {
go d.Serve()
<-time.After(time.Second)
close(doTest)
<-time.After(15 * time.Second)
}()
<-doTest
resp, err := http.Get("http://localhost:8282/status")
if err != nil {
t.Error(err)
}
output, err := ioutil.ReadAll(resp.Body)
if err != nil {
t.Errorf("reading response %s", err)
resp.Body.Close()
return
}
if string(output) != "OK" {
t.Errorf("%s != OK", string(output))
resp.Body.Close()
return
}
resp.Body.Close()
<-time.After(20 * time.Second)
}
func TestCube(t *testing.T) {
_ = [][3]float64{{-1.0, -1.0, 0}, {-1, 1, 0}, {1, 1, 0}, {1, -1, 0}}
}