error case
This commit is contained in:
snoop 2017-06-11 18:40:57 +09:00
parent 96cda61428
commit d1a698d5b0

View File

@ -4,6 +4,9 @@ import (
"encoding/json"
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensor"
"testing"
"fmt"
"sync"
"strconv"
)
func TestSensorItemMappingService_List(t *testing.T) {
@ -15,3 +18,43 @@ func TestSensorItemMappingService_List(t *testing.T) {
t.Log(res)
}
func TestSensorItemMappingService_List_GoRutine(t *testing.T) {
//s := &sensor.Sensor{}
//s.Id = json.Number("14")
sims := NewSensorItemMappingService()
il := make([]int, 0)
il = append(il, 1)
il = append(il, 2)
il = append(il, 3)
il = append(il, 13)
il = append(il, 14)
for _, ii := range il {
go func(i int) {
s := &sensor.Sensor{}
s.Id = json.Number(strconv.Itoa(ii))
res, _ := sims.List(s)
fmt.Print(res)
}(ii)
}
wg := sync.WaitGroup{}
wg.Add(1)
wg.Wait()
//res, _ := sims.List(s)
//
//t.Log(res)
}