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

Side by Side Diff: third_party/WebKit/Source/core/xml/XPathFunctionsTest.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/xml/XPathFunctions.h" 5 #include "core/xml/XPathFunctions.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/xml/XPathExpressionNode.h" // EvaluationContext 8 #include "core/xml/XPathExpressionNode.h" // EvaluationContext
9 #include "core/xml/XPathPredicate.h" // Number, StringExpression 9 #include "core/xml/XPathPredicate.h" // Number, StringExpression
10 #include "core/xml/XPathValue.h" 10 #include "core/xml/XPathValue.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 "position is 1, this is the character at position 1"; 76 "position is 1, this is the character at position 1";
77 EXPECT_EQ("", substring("12345", NAN, 3.0)) 77 EXPECT_EQ("", substring("12345", NAN, 3.0))
78 << "should select no characters since NaN <= position is always false"; 78 << "should select no characters since NaN <= position is always false";
79 EXPECT_EQ("", substring("12345", 1.0, NAN)) 79 EXPECT_EQ("", substring("12345", 1.0, NAN))
80 << "should select no characters since position < 1. + NaN is always " 80 << "should select no characters since position < 1. + NaN is always "
81 "false"; 81 "false";
82 EXPECT_EQ("12345", 82 EXPECT_EQ("12345",
83 substring("12345", -42, std::numeric_limits<double>::infinity())) 83 substring("12345", -42, std::numeric_limits<double>::infinity()))
84 << "should select characters at -42 <= position < Infinity, which is all " 84 << "should select characters at -42 <= position < Infinity, which is all "
85 "of them"; 85 "of them";
86 EXPECT_EQ("", substring("12345", -std::numeric_limits<double>::infinity(), 86 EXPECT_EQ("",
87 std::numeric_limits<double>::infinity())) 87 substring("12345", -std::numeric_limits<double>::infinity(),
88 std::numeric_limits<double>::infinity()))
88 << "since -Inf+Inf is NaN, should select no characters since position " 89 << "since -Inf+Inf is NaN, should select no characters since position "
89 "< NaN is always false"; 90 "< NaN is always false";
90 } 91 }
91 92
92 TEST(XPathFunctionsTest, substring_emptyString) { 93 TEST(XPathFunctionsTest, substring_emptyString) {
93 EXPECT_EQ("", substring("", 0.0, 1.0)) 94 EXPECT_EQ("", substring("", 0.0, 1.0))
94 << "substring of an empty string should be the empty string"; 95 << "substring of an empty string should be the empty string";
95 } 96 }
96 97
97 TEST(XPathFunctionsTest, substring) { 98 TEST(XPathFunctionsTest, substring) {
(...skipping 19 matching lines...) Expand all
117 TEST(XPathFunctionsTest, substring_extremePositionLength) { 118 TEST(XPathFunctionsTest, substring_extremePositionLength) {
118 EXPECT_EQ("", substring("no way", 1e100, 7.0)) 119 EXPECT_EQ("", substring("no way", 1e100, 7.0))
119 << "extremely large positions should result in the empty string"; 120 << "extremely large positions should result in the empty string";
120 121
121 EXPECT_EQ("no way", substring("no way", -1e200, 1e300)) 122 EXPECT_EQ("no way", substring("no way", -1e200, 1e300))
122 << "although these indices are not representable as long, this should " 123 << "although these indices are not representable as long, this should "
123 << "produce the string because indices are computed as doubles"; 124 << "produce the string because indices are computed as doubles";
124 } 125 }
125 126
126 } // namespace blink 127 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/xml/XPathExpression.cpp ('k') | third_party/WebKit/Source/core/xml/XPathParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698