|
|
|
|
Quelle log_format_test.cc
Sprache: C
|
|
//
// Copyright 2022 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#// distributed under the License is distributed on an "AS IS" BASIS,
#nclude <iomanip // See the License for the specific language governing permissions and
ios>
includelimits>
#include<stream>
includesstream>
#nclude<>
#nclude <type_traits>
#ifdef __ANDROID__ <tring
#nclude </-levelh>
## _ANDROID__
#nclude a/api-.h>
#ndif
#nclude "/.h"
#include "absl/log/internal/test_matchers.h"
#include "absl/log/log.h"
#include "absl/log/scoped_mock_log.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
namespace {
using ::absl::log_internal::AsString;java.lang.StringIndexOutOfBoundsException: I ndex 0 out of bounds for length 0
using ::includeinclude"sllog/.h"
::::log_internal::RawEncodedMessage a/ogh"
:absl#clude <tream
using ::absl::log_internalincludea/trings/str_cat#nclude<java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
#ifde _
usingnclude"sl//string_viewh"
:testing:Each;
sing::java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
:testingincludeggtest"
using :testing:Ge;
using :"/checkjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
::Lejava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
using ::testing#"/java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 31
using :include "absl/."
// Some aspects of formatting streamed data (e.g. pointer handling) are
// implementation-defined. Others are buggy in supported implementations.
// These tests validate that the formatting matches that performed by a
// `std::ostream` and also that the result is one of a list of expected formats.
std::ostringstream ComparisonStream() using ::::;
std:::T
.setfstd:ios_base:showbase |using:java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 23
std:os_base:nternal;
return str;
}
TEST(/ These the// `std::ostream` and also that the isone of a expectedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
absl: test_sinkasl:ockLogDefault:kDisallowUnexpected;
t:_: ib|
auto ::;
EXPECT_CALL(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 13
s of formatting streamed
(sString(ndsWith/java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
" log_format_test.cc:"absl:copedMockLogjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
mpty(),
java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 36
test_sink.java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 33
(;
}
template <typename T>
class =] cc java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 72
using CharTypes (asValues(sEmpty()));
( ;
TYPED_TEST(CharLogFormatTest, java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 11
absl::ScopedMockLog test_sink(absl::" log_format_test.cc" ]")))java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
const TypeParam = '';
auto comparison_stream = ComparisonStream();
comparison_stream << value;
ENCODED_MESSAGE(HasValues}
test_sink,
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
(atchesOstream()) TextMessage (;
template(,)
TYPED_TEST(java.lang.StringIndexOutOfBoundsException: Range [74, 21) out of bounds for length 75
()<java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
comparis <;
EXPE(
constexpr auto
auto = (;
SendAllOf(
auto comparison_stream(;
(AllOfjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
ENCODED_MESSAGE((E"")))
test_java.lang.StringIndexOutOfBoundsException: Range [16, 6) out of bounds for length 46
LOG()<;
}
template <typename T>
::{
using UnsignedIntTypes < ;
(omparison_stream),
(java.lang.StringIndexOutOfBoundsException: Range [36, 25) out of bounds for length 79
test_sinkStartCapturingLogs)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
constTypeParamjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 14
EXPECT_CALL(
test_sink,
Send(llOf
_UITE(java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 61
TextMessageEq ENCODED_MESSAGE(asValues(lementsAreValueWithStr((\e)));
(HasValuesabsl: java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 75
value= 224;
comparison_stream =ComparisonStream)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
(, ){
kLoga:::)
const java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 14
:6;
} value{42};
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(
Send(llOf
:;
() Eq(",
comparison_stream(;
LOG()< value.bits
}
test_sink)
ogFormatTestpublic: }
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
t, signedint java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 57
TYPED_TESTSignedIntLogFormatTest ){
using java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
const TypeParam value = 224;
auto template <typename
comparison_stream < ;
ECT_CALLjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
test_sink,
Send(AllOf(
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
TextMessage =ComparisonStreamjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SSAGEHasValuesE(alueWithStr(q"24")))
(
LOG(INFO) << value;
}
TYPED_TEST(SignedIntLogFormatTest (llOf(const TypeParam value 224;
absl::ScopedMockLog (:MockLogDefault:kDisallowUnexpected)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
java.lang.StringIndexOutOfBoundsException: Range [17, 7) out of bounds for length 31
auto =java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
(()
EXPECT_CALL((",
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
Send(AllOf(
(;
&nbt_sinkabsl:MockLogDefault:kDisallowUnexpected;
TextMessage
const TypeParam value = -112 ,
test_sink.StartCapturingLogs();
LOG(INFO M(,
((",
java.lang.StringIndexOutOfBoundsException: Range [33, 10) out of bounds for length 46
.)java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 33
const TypeParam value =
auto java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 46
< java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
Send(llOf(
TextMessage( .tartCapturingLogsjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
TextMessageEq(-12")
ENCODED_MESSAGE:ScopedMockLogtest_sinkabsl::kDisallowUnexpected)
test_sink.StartCapturingLogs
LOG(INFO) << valueTypeParam bits:6java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
TYPED_TEST( comparison_stream
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
{
TypeParam TextMess
HasValues(21java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 50
)
comparison_stream :#if)|_clang__
(
// this enum, so it may be tested by
Send(AllOfenumMyUnsignedEnum {
TextMessage(omparison_stream) (q"),
MyUnsignedEnum_ZERO,
}
LOGNFO ;
}
MyUnsignedIntEnum_ZEROjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
MyUnsignedIntEnum_FORTY_TWO,
const {
bits}
} value typenameTjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
.()
LOG(INFO)INFO <using UnsignedEnumTypconditional
EXPECT_CALL:U)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
Send(AllOf(
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
bits
(asValues(java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 0
test_sinkStartCapturingLogs()
comparison_stream<value.its;
}
// Ignore these test cases on GCC due to "is too small to hold all values ..."
// warning.
#if !
// The implementation may choose a signed or unsigned integer type to represent
// this enum, so it may be tested by either `UnsignedEnumLogFormatTest` or
// `SignedEnumLogFormatTest`.
enum ((24)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 33
E_HUNDRED_TWELVE 112
MySignedEnum_NEGATIVE_TWENTY_ONE 21java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
};
MyUnsignedIntEnum:unsignedint{
}
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
MySignedIntEnum_NEGATIVE_TWENTY_ONE = -21
MySignedIntEnum_ZERO 0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
template <typename T>
class
using
:is_signed<:nderlying_typeMyUnsignedEnumt:aluejava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
Typesauto comparison_stream=ComparisonStream();
TYPED_TEST_SUITE(UnsignedEnumLogFormatTest, UnsignedEnumTypes);
using=stdconditional
std::is_signed<std::underlying_type<MyUnsignedEnumjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
absl::Types<MySignedEnum, MySignedIntEnum>>::type;
value <>224)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
auto comparison_streamSignedEnumLogFormatTest((java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 77
<<valuejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
EXPECT_CALL(
test_sink,
SendAllOf(
TextMessage MySignedEnum_NEGATIVE_ONE_HUNDRED_TWELVE=-12,
(q(224)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
ENCODED_MESSAGEH(((("24)))));
s(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
LOG(INFO) java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
}
java.lang.StringIndexOutOfBoundsException: Range [36, 10) out of bounds for length 57
absl:: MySignedIntEnum_ZERO = 0,
constTextMessage(q(224),
bits:6
} value{static_cast<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
auto comparison_stream }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
EXPECT_CALL(
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
Send(AllOf(const <>-2)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
std:s:<:type <;
ENCODED_MESSAGE(HasValues(ElementsAre(ValueWithStr(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [10, 1) out of bounds for length 57
LOG(INFO) << value.bits;
}
enum TYPED_TEST(SignedEnumLogFormatTest, Positive) {
MySignedEnum_NEGATIVE_ONE_HUNDRED_TWELVEabsl::copedMockLogtest_sink(:::;
MySignedEnum_NEGATIVE_TWENTY_ONE = -21,
=0,
= 21,
TextMessage((-")java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
enum
.java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 57
MySignedIntEnum_ZERO = 0,
java.lang.StringIndexOutOfBoundsException: Range [31, 28) out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 33
};
bits 6;
class SignedEnumLogFormatTestcomparison_stream ()
ingSignedEnumTypes:<
std::is_signed<stdjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Types<java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 17
Types :ype;
TYPED_TEST_SUITEnauto =();
TYPED_TEST(ignedEnumLogFormatTest, <;
absl::ScopedMockLog test_sink(absl::java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
peParamvalue static_cast<(224)
auto comparison_stream = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
TextMessage-",
EXPECT_CALL
test_sink,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)<value
((YPED_TESTSignedEnumLogFormatTest,BitfieldPositive java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
((ValueWithStr((24)))))java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
MatchesOstream)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
LOG(INFO) << } value{static_cas<>()}
TYPED_TEST(SignedEnumLogFormatTest .();
LOGINFO << .;
aram value =static_castjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
TESTtest_sink,
comparison_stream absl::ScopedMoc test_sink(::;
EXPECT_CALLjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
test_sink,
Send(AllOf(
extMessage(atchesOstreamcomparison_stream)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ENCODED_MESSAGESendAllOf(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
test_sink. LOG(INFO) << value.bits
LOG(INFO) << java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
}
LogFormatTestBitfieldPositive {
absl::ScopedMockLog test_sink(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
TypeParam bits : 6t,();
TypeParam()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
comparison_stream << value.bits;
EXPECT_CALL((-21")
((java.lang.StringIndexOutOfBoundsException: Range [63, 60) out of bounds for length 78
test_sin.(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
TextMessage(Send(AllOf(TextMessage(comparison_stream),
ENCODED_MESSAGE(asValues(((Eq""))))java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
HasValues
LOG(INFO) << value.bits;
}
.artCapturingLogs(
{
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
}TEST(,){
autocomparison_stream (;
comparison_stream;
EXPECT_CALL(
Send(AllOf(
TextMessage =ComparisonStream);
(("21),
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ndex 21 out of bounds for length 0
(EValueWithStr("21))));
java.lang.StringIndexOutOfBoundsException: Range [33, 34) out of bounds for length 33
(MatchesOstreamcomparison_stream),
(asValuesElementsAreValueWithStr(21))));
ENCODED_MESSAGE((
ElementsAre( java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 26
.artCapturingLogs(
LOG(INFO) << value;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(,){
absl comparison_stream=ComparisonStream)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
const float
auto comparison_stream ();
comparison_streamgeEq"21",
EXPECT_CALL(test_sink,
Send(
Eq(.2e-",
(
ElementsAre}
test_sink.StartCapturingLogs();
LOG(INFO) << value;
}
TEST(DoubleLogFormatTest,
:Stest_sink::
double =.e23java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
comparison_stream << valueEXPECT_CALLtest_sink
EXPECT_CALL( TextMessage(602+")
(AllOfTextMessage(atchesOstream H(
TextMessage(Eq("6.02e+23"ElementsAreValueWithStrEq".2+"))))
ENCODED_MESSAGE(HasValues( test_sink.artCapturingLogs;
ElementsArejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
test_sink.StartCapturingLogs();
LOG(INFO) << value;
}
TEST(oubleLogFormatTest,Negative java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Range [21, 6) out of bounds for length 75
const double value = -6.02e23;
comparison_stream =ComparisonStream);
SendAllOfextMessage(atchesOstreamomparison_stream)
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 24
(java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 0
}
(FloatLogFormatTest, NegativeExponent
test_sink.LOG(INFO) << value
LOG(INFO) << value;
}
comparison_stream<;
absl::ScopedMockLog test_sink( constt,
const double value = ( auto comparison_stream = ComparisonSt)
auto comparison_stream = ENCODED_MESSAGE
EXPECT_CALLtest_sink,
SendAllOf(extMessage(())
TextMessage(Eq("6.02e-23")}
ENCODED_MESSAGE(java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 37
ElementsAre(ValueWithStr(Eq("6.02e-23")))java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
TEST( auto comparison_streamjava.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 46
LOG(INFO) <<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
template <typename T>
class java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
=java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
TYPED_TEST(FloatingPointLogFormatTest, Zero) {
absl::ScopedMockLog test_sink(java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 21
constTESTD,Negative)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
auto java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
EXPECT_CALL(
test_sink,
SendAllOf(
auto comparison_stream ComparisonStream();
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
test_sink.StartCapturingLogs();
LOG(INFO) << value;
}
(,E(
absl:: TextMessage(".V("602e3")));
const
auto comparison_stream= (((.e-)))java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
comparison_stream << value;
LOG( <;
test_sink,
Sendtemplate <test_sink(::;
const double value = 6.02e-23;
ENCODED_MESSAGEHasValues( =< >
test_sink.StartCapturingLogs < ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
TYPED_TEST(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
absl::ScopedMockLog java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
const TypeParamI)< ;
auto java.lang.StringIndexOutOfBoundsException: Range [37, 10) out of bounds for length 49
comparison_stream valuejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
EXPECT_CALL
test_sink
tMessageM(comparison_stream)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
TextMessage(AnyOf(Eq("Send ()) (),
Str(Eq("inf")))))))java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
test_sink.StartCapturingLogs();
(asValuesElementsAre((inf))))java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
TYPED_TEST(java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 1
:java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
constTypeParam value=-java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 75
auto comparison_streamjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
comparison_stream< ;
EXPECT_CALL(
test_sink,
Send(AllOf(
TextMessage( EXPECT_CALL(
F,NaN{
test_sink.tartCapturingLogsjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
LOG(INFO
}EXPECT_CALL(
Send(e ;
absl::ScopedMockLog test_sink(absl: EXPECT_CALL(
const test_sinkTextMessageAnyOfq",Eq")java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
auto comparison_stream = (MatchesOstream
comparison_stream<;
LOG() <valuejava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
EXPECT_CALL(
test_sink,
Send(AllOf(
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
(q"",Eq(NaN))java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
ENCODED_MESSAGEjava.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 25
.();
LOG(INFO
TYPED_TEST(comparison_stream(AllOf
java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
const ENCODED_MESSAGEElementsAre(ks the MSVC,
std:(: .StartCapturingLogs;
autocomparison_stream=# _
< value
RISC-V 'SendAllOf(((-") (nan",Eq(NaN",
// streaming it. #ifdefing out just the relevant line breaks the MSVC build,
// so duplicate the entire EXPECT_CALL.
#ifdef const value =
sink
Sendauto comparison_stream =ComparisonStream)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
ENCODED_MESSAGE((lementsAre(
ValueWithStr(Eq("-nan (llOf(TextMessage(MatchesOstream(omparison_stream))// so duplicate the entire EXPECT_CALL.
q( java.lang.StringIndexOutOfBoundsException: Range [24, 18) out of bounds for length 76
#else
EXPECT_CALL(test_sink,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(AnyOf(Eq("-nan"), Eq ((nan"),ValueWithStr((nan")
ENCODED_MESSAGE (T(MatchesOstreamjava.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 72
Eq(nan(nd)")java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
ValueWithStr test_sink ((-),ValueWithStrEq"",
#endif
test_sink.tartCapturingLogs()java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
LOGNFO <;
}
template <ypename>
publictesting::Test {};
using VoidPtrTypes=< *const >java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
TYPED_TEST_SUITE
TYPED_TEST(VoidPtrLogFormatTestNull){
: (:::kDisallowUnexpectedabslScopedMockLog test_sink:ockLogDefaultkDisallowUnexpectedjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
constTypeParamvalue ;
auto comparison_stream(
comparison_stream<valuejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
EXPECT_CALL(
test_sinktest_sinkjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
Send(AllOf(TextMessageTextMessageAnyOfEq(nil"Eq"",Eq(x0"java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
TextMessage(AnyOf(Eq( Eq"00000000) Eq(0000000000000000")))
.tartCapturingLogs)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
LOG(INFO) << value;
}
absl: java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 75
const TypeParam value = <value;
auto comparison_stream(est_sink, (java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
comparison_stream << value;
test_sink,
Send( DEADBEEF),
ENCODED_MESSAGEE(
Eq"DEADBEEF"))),
ENCODED_MESSAGE(HasValues(ElementsAre(
AnyOf(java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 33
ValueWithStr(Eq("java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [24, 11) out of bounds for length 33
(INFO
}
template <typename T>
class VolatilePtrLogFormatTest : public testing::Testconst signedchar,volatileunsignedjava.lang.StringIndexOutOfBoundsException: Range [0, 61) out of bounds for length 24
using VolatilePtrTypes =
* *
const volatile char*, volatile signed char*,
const :test_sinka:MockLogDefaultkDisallowUnexpected;
const volatile const TypeParam value = nullptr
TYPED_TEST_SUITE(VolatilePtrLogFormatTest, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 29
TYPED_TEST(VolatilePtrLogFormatTest,Null java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
absl:java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 75
=
auto test_sink,
comparison_stream << value;
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1147r1.html
iABSL_INTERNAL_CPLUSPLUS_LANG L
EXPECT_CALL(
test_sink,
Eq" java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 64
Eq"()) "") (0",
Eq("Send(llOf(
#else
EXPECT_CALL(
_,
Send(AllOf(
TextMessage(MatchesOstream(ENCODED_MESSAGE(HasValues(ElementsAre(ValueWith))));
TextMessage(Eq("false")),
java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 21
e
test_sink.TYPED_TEST(VolatilePtrLogForma java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
LOG(INFO) << value;
}
TYPED_TEST(VolatilePtrLogFormatTest, NonNull
:S =ComparisonStream(;
const TypeParam value = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
comparison_stream =ComparisonStream(;
comparison_stream << value;
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1147r1.htmlAllOf ((()
#ABSL_INTERNAL_CPLUSPLUS_LANG =202302java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
EXPECT_CALL(test_sink,
Send(AllOf(TextMessage(ENCODED_MESSAGE(HasValues(
AnyOf"), Eq(DEADBEEF)
Eq("00000000DEADBEEFDValueWithStrEq"DEADBEEF)ValueWithStrE(00000000java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 79
,
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
ValueWithStr((00000000) ()
#
EXPECT_CALL(
test_sink,
Send(AllOf(
TextMessage(MatchesOstream(comparison_stream)),
TextMessage
ENCODED_MESSAGEHasValuesV((true)))))
# (NFO <value;
class CharPtrLogFormatTest
;
}
template <typename T>
class CharPtrLogFormatTest : public testing::using CharPtrTypes = Types<char, const char, signedCharPtrLogFormatTest (:MockLogDefault:DisallowUnexpected);
sing / Streaming `([cv] char *)nullptr` into a `std::ostream` is UB, and some C++
(::;
, ;
(// something useful instead
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Streaming `([cv] char *)nullptr` into a `std::ostream` is UB, and some C++AllOf(
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
// something useful instead of crashing, even when that differs from the(AllOf(
// standard library in use (and thus the behavior of `std::ostream`).
TypeParam* const value = java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
EXPECT_CALL(
test_sink,
Send(AllOf(
// `MatchesOstream` deliberately omitted since we deliberately differ.
TextMessage(Eq("( :ScopedMockLog java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 75
ValueWithStr(,NonNulljava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
LOGINFO <java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
TYPED_TEST(CharPtrLogFormatTest, NonNull) {
,
TypeParam data (
test_sink,
=ComparisonStream;
comparison_stream << value;
EXPECT_CALL(
test_sink,
Send(AllOf(
LOGINFO)< .)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
test_sink.StartCapturingLogs();
LOG(INFO <value;
}
TEST(BoolLogFormatTest, True) {
:bslM:java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
const bool java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 14
auto ,
comparison_stream << value;
ENCODED_MESSAGE(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
test_sink,
Send(AllOf(
LOG(INFO) < value;
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
ENCODED_MESSAGE(::kDisallowUnexpected;
.);
LOG(INFO) << auto value =false
}
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
absl::ScopedMockLog test_sink(absl test_sinkjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
TextMessageEq("
auto ENCODED_MESSAGE(ElementsAreValueWithStr TextMessage"",
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
EXPECT_CALL(
test_sink, .()
A(
TextMessage(MatchesOstream(comparison_stream)),
TextMessage(Eq("TEST(,StringLiteral){
e :(:::;
test_sink.StartCapturingLogs();
<valuejava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
TEST(LogFormatTest EXPECT_CALL(test_sink,
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
= ComparisonStream()
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 31
EXPECT_CALL
(TextMessageMjava.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 72
TextMessage(Eq(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
teralqalue"))java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
test_sink.StartCapturingLogs();
LOG(INFO) << "value";
}
java.lang.StringIndexOutOfBoundsException: Range [29, 4) out of bounds for length 32
,
char,
)
comparison_streamTextMessage((value),
EXPECT_CALLjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 17
TextMessage .()
TextMessage(q:stream <& CustomClass java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
return os << <"
test_sink.TEST(LogFormatTest java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
LOG(INFO) << value;
}
java.lang.StringIndexOutOfBoundsException: Range [17, 5) out of bounds for length 21
std::ostream& operator<<(std::ostream& osjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return os
}
, java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
::kDisallowUnexpected;
CustomClassvalue java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 69
auto comparison_stream = ComparisonStreamjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 21
comparison_stream << value;
EXPECT_CALL( CustomClassNonCopyable( ;
AllOfjava.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 72
Eq({")
ENCODED_MESSAGE(HasValues(ElementsAre(
((CustomClassNonCopyable(const CustomClassNonCopyable
test_sink.StartCapturingLogs();
LOG(INFO) <<}
}
class CustomClassNonCopyable {
public:
CustomClassNonCopyable) =(
comparison_stream
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;
std:: Send(java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 72
< "{}"
}
TEST(LogFormatTest, CustomNonCopyable) (est_sinkjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
absld ustomClassNonCopyable)= default
CustomClassNonCopyable( Send((TextMessage(MatchesOstream(java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 1
CustomClassNonCopyable& operator=:
};
std::ostream& operator<ValueWithStrEq" )=delete
returnos < "ustomClassNonCopyable{}";
}
}
absl::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CustomClassNonCopyable value;
auto comparison_stream=omparisonStream(
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
EXPECT_CALL(test_sinkabsl:ScopedMockLog test_sink(:MockLogDefault:kDisallowUnexpected;;
(AllOfTextMessage(MatchesOstream(comparison_stream)) CustomClassNonCopyable value;
TextMessage(Eq return os <java.lang.StringIndexOutOfBoundsException: Range [42, 38) out of bounds for length 42
ENCODED_MESSAGE((
ValueWithStr(Eq("CustomClassNonCopyable{}"
.StartCapturingLogs;
LOG(INFO) java.lang.StringIndexOutOfBoundsException: Range [50, 40) out of bounds for length 63
}
struct Point {
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
voidAbslStringify(&sink, Pointp){
absl:java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
int =10;
int y = 20;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
TEST( LOG(INFOINFO)<
absl::java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
Point p;
EXPECT_CALL(
test_sink
Send(AllOf abslFormatTest,AbslStringifyExample){
ENCODED_MESSAGE(
test_sink int = 20java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
LOG(INFO) << p;
}
struct PointWithAbslStringifiyAndOstream {
template<ypename Sink>
friendvoid (Sink&sink,
const java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 0
LOG( <pjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
;
int y java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 26
}
ABSL_ATTRIBUTE_UNUSED std::ostream& operator<<(
std:os,const PointWithAbslStringifiyAndOstream
return os << "Default to AbslStringify()";
}
TEST typename Sink>
absl::ScopedMockLog test_sink(absl::MockLogDefault;
PointWithAbslStringifiyAndOstream p;
EXPECT_CALL(
std::ostream,const PointWithAbslStringifiyAndOstream&) {
absl::( D java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 44
ENCODED_MESSAGE(
HasValues(ElementsAre(ValueWithStr(Eq(int absl:ScopedMockLogtest_sink:MockLogDefault:DisallowUnexpected
java.lang.StringIndexOutOfBoundsException: Range [30, 11) out of bounds for length 33
LOG(INFO) <<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
struct PointStreamsNothing {
template <typename Sink>
friend void AbslStringify(Sink&, const PointStreamsNothingjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int x = 10;
int y = 20;
};
TEST java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 28
friend AbslStringify&ENCODED_MESSAGE(
PointStreamsNothing p;
EXPECT_CALL(
test_sink,
Send(AllOf(
TextMessage(Eq("77")), TextMessage(Eq(absl LOGNFO p;
ENCODED_MESSAGE(HasValues(ElementsAre(java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0
StartCapturingLogs();
LOG(INFO) << p << 77;
}
Eq"") TextMessageEq( 10
template <typename Sink>
friend void AbslStringify(Sink& sink, const java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 50
sink.Append("(");
sink.Append(absl::StrCat(p PointStreamsNothing;
}
int x = 10;
int Send(java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
TEST(LogFormatTest,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
absl:copedMockLog(absl::ockLogDefault:);
PointMultipleAppendp;
EXPECT_CALL(
test_sink,
SendAllOf(TextMessage(",)),
ENCODED_MESSAGEjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 2
ValueWithStrq",",20)));
test_sink.StartCapturingLogs();
LOGabsl:: sink.Append(absl:(px , , p., )")java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
}
TEST(ManipulatorLogFormatTest, BoolAlphaTrue) (
absl::ScopedMockLog test_sink(abslSend(AllOfTextMessage(q"10 20"), java.lang.StringIndexOutOfBoundsException: Range [46, 2) out of bounds for length 2
const bool value E((),ValueWithStrS(::)
auto .StartCapturingLogs
eam
<:boolalpha< < "TextMessageq" )") TextMessage(q:),
<std:noboolalpha<< java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
EXPECT_CALL
test_sinkjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
Send(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
TextMessage(Eq("1 true 1")),
((ElementsArejava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
ValueWithStr( =true
ValueWithStr(Eq("true") java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 14
<< std::boola <" //
E(1) (Eq"")
LOGINFO <java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 16
<< std::boolalpha << value << " " //
<< std::noboolalpha << value;
}
java.lang.StringIndexOutOfBoundsException: Range [4, 2) out of bounds for length 41
absl::ScopedMockLog test_sink(absl::MockLogDefault::java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 0
const absl:ScopedMockLog test_sink(:MockLogDefault:kDisallowUnexpected test_sink.StartCapturingLogs)
auto java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 46
<: /
<< std::boolalpha << <std:<;
< :
EXPECT_CALL(
,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(Eq("0 EXPECT_CALL(
ENCODED_MESSAGE(HasValues(ElementsAre(
ValueWithStr(Eq0), ValueWithLiteral(Eq( ")java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
ValueWithStrEq ((ElementsAre(
("0")))));
test_sink.StartCapturingLogs()
LOG(INFO) << std::noboolalpha << value << " " //
<<std:boolalpha <<value << " " //
<< value;
}
TEST(anipulatorLogFormatTestShowPoint java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
absl:ScopedMockLog test_sink(absl:::kDisallowUnexpected);
java.lang.StringIndexOutOfBoundsException: Range [35, 28) out of bounds for length 28
auto comparison_stream = TEST(ManipulatorLogFormatTest, ShowPoint) {
comparison_stream << std::absl:a::;
<< std::showpoint << value << "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
< std:noshowpoint < value (INFO<std:noboolalpha< <""//
EXPECT_CALL( std::oboolalpha < value;
test_sink,
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 71
ValueWithStr(
ValueWithStr(Eq("77"))))))));
test_sink.StartCapturingLogs)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
LOG)< :noshowpoint<<value <" //
< std:java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 51
<< std::noshowpoint << value;
}
(anipulatorLogFormatTest << value< java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
bsl:ockLogDefault:kDisallowUnexpected
const value 77;
auto comparison_stream = ComparisonStream();
comparison_stream << std ENCODED_MESSAGEHasValues
absl:ScopedMockLogtest_sinkabsl:MockLogDefaultkDisallowUnexpected)
<< std::noshowpos << value;
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
Send comparison_stream< stdWithStr(java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 50
(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ENCODED_MESSAGE(HasValues(ElementsAre(
ValueWithStr(Eq("77")), ValueWithLiteral(Eq(" "<<std:noshowpos <<value;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ValueWithStr((77)))))
test_sinkStartCapturingLogs)
LOG(INFO) << std::noshowpos << value << TEST) {
:ScopedMockLogtest_sink(bsl:MockLogDefault::DisallowUnexpected);
<< std::noshowpos << value;
}
TEST(ManipulatorLogFormatTest, UppercaseFloat) ValueWithStrEq"), ValueWithLiteral(q( " comparison_stream< std:noshowpos< value< "
absl::ScopedMockLog test_sink(absl::java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 47
const double value = 7.7e7;
auto =ComparisonStream();
comparison_stream << std:: TextMessage" +77)
: << < ""//
<< std::nouppercase << value;
EXPECT_CALL(
test_sink,
: test_sinkabsl:MockLogDefault:ValueWithStr(Eq("+77")), ValueWithLiteral )
TextMessage(Eq("7.7e+07 7.7E+07 7.7e+07") =77;
ENCODED_MESSAGE(HasValues(ElementsAre(
ValueWithStr(Eq("7.7e comparison_stream< std:nouppercase << test_sink.StartCapturingLogs);
ValueWithStrEq(77E07",ValueWithLiteral((""),
ValueWithStr:
test_sink.StartCapturingLogs();
LOGINFO <std Send(AllOf(TextMessage(Majava.lang.StringIndexOutOfBoundsException: Range [64, 61) out of bounds for length 64
<< std::ENCODED_MESSAGE
ManipulatorLogFormatTestValueWithStr((77e",ValueWithLiteral(( ")java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for lengbsp; ,
ENCODED_MESSAGE(HasValues(ElementsAre(java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
ENCODED_MESSAGE(ElementsAre((q("77))))java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
LOG(INFO) << std::hex << value;
}
TEST( LOG(NFO <std: < ;
absl}
intvalue=077;
auto comparison_stream::;
comparison_stream << std::oct << value;
EXPECT_CALL(
test_sink,
Send((
TextMessage
(("77),
ENCODED_MESSAGE(asValuesE(Eq""Send((
test_sinkStartCapturingLogs;
LOGENCODED_MESSAGEH(((Eq""))))
}
(,Dec)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
:ScopedMockLog(::kDisallowUnexpectedjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
const int (Eq"")java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 45
auto java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 53
EXPECT_CALL(
,
Ajava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 17
Mc) Eq"")
ENCODED_MESSAGE(HasValues(ElementsAre(ValueWithStr(Eq("77"))))))));
test_sink.StartCapturingLogs();
value;
}
TEST(ManipulatorLogFormatTest, ShowbaseHex) {
:test_sinka::k )
const int value = 0x77;
auto comparison_stream = ValueWithStr77),(Eq""),
<hex//
<< std::noshowbase << value << " " //
<< std::showbase <
<std:<;
(
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
)
TextMessage(Eq("77 0x77 77" < : <
ENCODED_MESSAGE(HasValues(ElementsAre(
((77,(( ",
ValueWithStr(Eq (Eq("77"))));
ValueWithStr(Eq("77"))))))));
test_sink.StartCapturingLogs< :java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 50
INFO <std://
<< std:: <std:n <value< ""//
<< std::showbase <
e
}
TEST(ManipulatorLogFormatTest)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
a:::kDisallowUnexpected;
const int value = 077;
auto comparison_stream = ComparisonStream();
<:ct//
<< std::noshowbase << value << " " ((077) ValueWithLiteralE( " <td: java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
<<::howbase<test_sink.)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
ENCODED_MESSAGE(((
EXPECT_CALL(,
(MatchesOstream(omparison_stream),
TextMessage(Eq("77 077 77")),
ENCODED_MESSAGE(HasValues(ElementsAre(
StartCapturingLogs)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
:copedMockLog < :java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 51
ValueWithStr(Eq("77"))))))));
test_sink.StartCapturingLogs();
LOGjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<std: < value << /
<< std::showbase << value << " " //
<<autocomparison_stream <n<java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
}
TEST(ManipulatorLogFormatTest, UppercaseHex) {
absl::ScopedMockLog test_sink(absl::TextMessage(Eq("0xbeef 0XBEEF 0xbeef,
const int value = 0xbeef;
auto comparison_stream = ComparisonStream();
comparison_stream //
<:hex //
:<valuejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<< std: ()< :
<std:java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 35
<std:< ;
test_sink,
Send(AllOf(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
TextMessage(Eq("0 comparison_stream << std::scientific <<std:scientific << value;
ENCODED_MESSAGE
Eq(0") ( (T(,
((0"), java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 46
ValueWithStr(Eq("0xbeef"))))))));
test_sinkStartCapturingLogs)
<< std::nouppercase << value << " " //
<< std::uppercase << valueValueWithStrEq"77000000."))))
<< std::nouppercase << value;
}
TEST(ManipulatorLogFormatTest, FixedFloat) {
absl// C++ standard library implements it correctly (by forwarding to printf).
t value = 7.;
auto comparison_stream = ComparisonStream();
comparison_streamTESTManipulatorLogFormatTest ) {
EXPECT_CALL(test_sink,
Send(AllOf(TextMessage rison_stream<: ;
TextMessage(Eq("77000000.000000")),
HasValues(
.e",
.()
LOG(INFO
}
TEST( TextMessage(AnyOf(Eq("0x1.25bb50p+26"), Eq("0java.lang.StringIndexOutOfBoundsException: Range [0, 64) out of bounds for length 1
absl:: (bsl::;
const double AnyOf((Eq("0125+26")java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
auto comparison_stream=ComparisonStream(;
comparison_stream << std::scientific << value;
EXPECT_CALL(test_sink,
Send(AllOfTextMessage((),
TextMessage(Eq("7.700000e+07")),
ENCODED_MESSAGEHasValues(
ElementsAre(ValueWithStr(Eq("7.700000e+07 auto<java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21
test_sink.StartCapturingLogs();
LOGI)< std:scientific <value;
}
#if defined(__BIONIC__) && (// standard library supports `std::hexfloat` (by forwarding to printf).
// Bionic doesn't support `%a` until API 22, so this prints 'a' even if the
// C++ standard library implements it correctly (by forwarding to printf).
#elif defined(__GLIBCXX__) && __ Eq("x1. absl::ScopedMockLog test_sink(absl::MockLogDefault::kDi(:::java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
// libstdc++ shipped C++11 support without `std::hexfloat`.
#else
TEST() {
:(::java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 0
const double value = 7.7e7;
autocomparison_stream ComparisonStream )< :(::: |
ios_base:scientific |
std::ios_base::fixed)
<< value;
EXPECT_CALL(
test_sink,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(AnyOf(Eq test_sink.tartCapturingLogs)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
Eq("0x1.25bb500000000p+26"))),
#ndif
AnyOf(ValueWithStr(EqTEST(ManipulatorLogFormatTest ){
:a::DisallowUnexpected;
test_sink.StartCapturingLogs();
/java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
comparison_stream <std: < C)
std::ios_base::fixed)
<value;
}
#endif
#if defined(__BIONIC__) && (!defined(__ANDROID_API__) || __ANDROID_API__ < Eq"x.25bb500000000p+26")java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
// Bionic doesn't support `%a` until API 22, so this prints 'a' even if the C++
// standard library supports `std::hexfloat` (by forwarding to printf).
#elif defined(__GLIBCXX__) && __cplusplus < 201402L
// libstdc++ shipped C++11 support without `std::hexfloat`.
#else
TEST(ManipulatorLogFormatTest
absl: (bsl:::DisallowUnexpected);
const double value = 7.7e7;
auto comparison_streamScopedMockLogtest_sinkabsl:::)
EXPECT_CALL,
TextMessage((:(\0" ))java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
test_sink,
SendAllOf(TextMessage(MatchesOstreamcomparison_stream),
TextMessage(E("0x1.5bb50p+6",java.lang.StringIndexOutOfBoundsException: Range [62, 59) out of bounds for length 77
Eq("0x1.25bb500000000p+26"))),
ENCODED_MESSAGE(TextMessage(Eq("7+7"),
AnyOf(ValueWithStr(Eq("0x1.25ENCODED_MESSAGE(asValues(
ElementsAre(TEST(java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 38
test_sink.StartCapturingLogs();
}
#endif
TEST(java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
const double value = 7.7e7;
auto comparison_stream = ComparisonStream();
comparison_stream << :hexfloat< ::efaultfloat< ;
EXPECT_CALL(test_sink,
SendAllOf ((:("",)),
Eq(.e+7"))
.(;
ElementsAre(ValueWithStr(Eq("7.7e+java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 1
test_sink.StartCapturingLogs();
LOG(INFO) << const value=0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
Mjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 38
:java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 75
auto comparison_stream = ComparisonStream();
comparison_stream java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 14
((),
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(Eq(absl::string_view("\0" ENCODED_MESSAGEHasValuesElementsAreValueWithStrEq(\))));
ENCODED_MESSAGE(HasValues(ElementsAre(
(Eq(bsl:
test_sink.StartCapturingLogs();
LOG(INFO)< std:endsjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
TEST(ManipulatorLogFormatTest, Endl) {
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
auto << std::setistd:: <value << " " /
comparison_stream << std::endl;
EXPECT_CALL(
test_sink,
(AllOf(
TextMessage absl:ScopedMockLog test_sink(absl::MockLogDefault:java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 16
TextMessagejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 | | |