[email protected] | 05f9b68 | 2008-09-29 22:18:01 | [diff] [blame^] | 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. |
| 4 | |
| 5 | #include "base/rand_util.h" |
| 6 | |
| 7 | #include <limits> |
| 8 | |
| 9 | #include "testing/gtest/include/gtest/gtest.h" |
| 10 | |
| 11 | namespace { |
| 12 | |
| 13 | const int kIntMin = std::numeric_limits<int>::min(); |
| 14 | const int kIntMax = std::numeric_limits<int>::max(); |
| 15 | |
| 16 | } // namespace |
| 17 | |
| 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); |
| 22 | } |