Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: mathrand_test.go

Issue 1243323002: Refactor a bit. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix golint Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mathrand.go ('k') | memcache.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mathrand_test.go
diff --git a/mathrand_test.go b/mathrand_test.go
deleted file mode 100644
index 1c572e39772e4a96230524ae67b8e535e437e4a0..0000000000000000000000000000000000000000
--- a/mathrand_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package gae
-
-import (
- "math/rand"
- "testing"
- "time"
-
- "github.com/luci/luci-go/common/clock/testclock"
- . "github.com/smartystreets/goconvey/convey"
- "golang.org/x/net/context"
-)
-
-func TestMathRand(t *testing.T) {
- t.Parallel()
-
- Convey("test mathrand", t, func() {
- now := time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)
- c, _ := testclock.UseTime(context.Background(), now)
-
- // Note that the non-randomness below is because time is fixed at the
- // top of the outer test function. Normally it would evolve with time.
- Convey("unset", func() {
- r := rand.New(rand.NewSource(now.UnixNano()))
- i := r.Int()
- So(GetMathRand(c).Int(), ShouldEqual, i)
- So(GetMathRand(c).Int(), ShouldEqual, i)
- })
-
- Convey("set persistance", func() {
- c = SetMathRand(c, rand.New(rand.NewSource(now.UnixNano())))
- r := rand.New(rand.NewSource(now.UnixNano()))
- So(GetMathRand(c).Int(), ShouldEqual, r.Int())
- So(GetMathRand(c).Int(), ShouldEqual, r.Int())
- })
-
- Convey("nil set", func() {
- c = SetMathRand(c, nil)
- r := rand.New(rand.NewSource(now.UnixNano()))
- i := r.Int()
- So(GetMathRand(c).Int(), ShouldEqual, i)
- So(GetMathRand(c).Int(), ShouldEqual, i)
- })
- })
-}
« no previous file with comments | « mathrand.go ('k') | memcache.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698