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

Side by Side Diff: Source/wtf/SaturatedArithmeticTest.cpp

Issue 1184043002: Fix unit test style in Source/wtf/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: apply review comments Created 5 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/RefPtrTest.cpp ('k') | Source/wtf/StringExtrasTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, Google Inc. All rights reserved. 2 * Copyright (c) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 32
33 #include "wtf/SaturatedArithmetic.h" 33 #include "wtf/SaturatedArithmetic.h"
34 #include <gtest/gtest.h> 34 #include <gtest/gtest.h>
35 #include <limits.h> 35 #include <limits.h>
36 36
37 namespace { 37 namespace WTF {
38 38
39 TEST(SaturatedArithmeticTest, Addition) 39 TEST(SaturatedArithmeticTest, Addition)
40 { 40 {
41 EXPECT_EQ(0, saturatedAddition(0, 0)); 41 EXPECT_EQ(0, saturatedAddition(0, 0));
42 EXPECT_EQ(1, saturatedAddition(0, 1)); 42 EXPECT_EQ(1, saturatedAddition(0, 1));
43 EXPECT_EQ(100, saturatedAddition(0, 100)); 43 EXPECT_EQ(100, saturatedAddition(0, 100));
44 EXPECT_EQ(150, saturatedAddition(100, 50)); 44 EXPECT_EQ(150, saturatedAddition(100, 50));
45 45
46 EXPECT_EQ(-1, saturatedAddition(0, -1)); 46 EXPECT_EQ(-1, saturatedAddition(0, -1));
47 EXPECT_EQ(0, saturatedAddition(1, -1)); 47 EXPECT_EQ(0, saturatedAddition(1, -1));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 const unsigned kOverflowed = intMaxForLayoutUnit + 100; 147 const unsigned kOverflowed = intMaxForLayoutUnit + 100;
148 EXPECT_EQ(getMaxSaturatedSetResultForTesting(kFractionBits), 148 EXPECT_EQ(getMaxSaturatedSetResultForTesting(kFractionBits),
149 saturatedSet(kOverflowed, kFractionBits)); 149 saturatedSet(kOverflowed, kFractionBits));
150 150
151 const unsigned kNotOverflowed = intMaxForLayoutUnit - 100; 151 const unsigned kNotOverflowed = intMaxForLayoutUnit - 100;
152 EXPECT_EQ((intMaxForLayoutUnit - 100) << kFractionBits, 152 EXPECT_EQ((intMaxForLayoutUnit - 100) << kFractionBits,
153 saturatedSet(kNotOverflowed, kFractionBits)); 153 saturatedSet(kNotOverflowed, kFractionBits));
154 } 154 }
155 155
156 156 } // namespace WTF
157 } // namespace
OLDNEW
« no previous file with comments | « Source/wtf/RefPtrTest.cpp ('k') | Source/wtf/StringExtrasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698