Output data about media requests to the netlog too.
[chromium-blink-merge.git] / base / rand_util_unittest.cc
blobf56c0ece09421ae098bc8ddca7b81138217714ae
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/rand_util.h"
7 #include <limits>
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace {
13 const int kIntMin = std::numeric_limits<int>::min();
14 const int kIntMax = std::numeric_limits<int>::max();
16 } // namespace
18 TEST(RandUtilTest, SameMinAndMax) {
19 EXPECT_EQ(base::RandInt(0, 0), 0);
20 EXPECT_EQ(base::RandInt(kIntMin, kIntMin), kIntMin);
21 EXPECT_EQ(base::RandInt(kIntMax, kIntMax), kIntMax);
24 TEST(RandUtilTest, RandDouble) {
25 // Force 64-bit precision, making sure we're not in a 80-bit FPU register.
26 volatile double number = base::RandDouble();
27 EXPECT_GT(1.0, number);
28 EXPECT_LE(0.0, number);