improved test

master
Charles Iliya Krempeaux 2015-10-10 09:18:03 -07:00
parent 07c6353bb8
commit 47bcf79c3a
1 changed files with 18 additions and 0 deletions

View File

@ -3,13 +3,31 @@ package flog
import ( import (
"testing" "testing"
"fmt"
"math/rand"
"time"
) )
func TestNewDiscardRouter(t *testing.T) { func TestNewDiscardRouter(t *testing.T) {
randomness := rand.New(rand.NewSource( time.Now().UTC().UnixNano() ))
router := NewDiscardRouter() router := NewDiscardRouter()
if nil == router { if nil == router {
t.Errorf("After trying to create a discard router, expected it to be not nil, but was: %v", router) t.Errorf("After trying to create a discard router, expected it to be not nil, but was: %v", router)
} }
message := fmt.Sprint("%x", randomness.Int63n(9999999999))
context := make(map[string]interface{})
limit := randomness.Int63n(30)
for i:=int64(0); i<limit; i++ {
context[ fmt.Sprintf("%x", randomness.Int63n(1000*limit)) ] = fmt.Sprintf("%x", randomness.Int63n(999999999999999))
}
router.Route(message, context) // Just make sure it doesn't panic or deadlok, by calling this.
} }