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
##include<os>
# < <stream>
# <stream>
# sstream # type_traits>
#include <>
##ncludeandroidapi.h>
#fdef _ANDROID__
#nclude <ndroidapilevelh>
#ndif
#nclude gmockgmockhjava.lang.StringIndexOutOfBoundsException: Index 24 out of bou nds for length 24
include"gtest/gtest.h"
#include "absl/log/check.h"
#include "absl/log/internal/test_matchers.h"
#nclude asljava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 25
#include"bsl/og/scoped_mock_log.h"
#include "using :absl#clude <tream>
# "bsl/trings sstream>
#include "absl/strings/java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 17
#nclude bstrings."
#using :testing:Each;
sing::java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
using :# ggtest"
using :testing:Ge;
using :"/checkjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
::;
using # "//hjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
using :::
using ::include "absl/."
using// Some aspects of formatting streamed data (e.g. pointer handling) are
using ::testing::Each;
using :// These tests validate that the formatting matches that performed by a
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
:t:java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 0
using :testing:::;
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 20
str(td:ios_base:showbase |using:java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 23
std:os_base:nternal;
// Some aspects of formatting streamed data (e.g. pointer handling) are
TEST(LogFormatTest, NoMessage) {
// 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() {
std::ostringstream str;using : test_sinkasl:ockLogDefault:kDisallowUnexpected;
_:|::
auto ::;
return str;
}u :java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 23
TEST(// implementation-defined. Others AsString(ndsWith/ These tests validate that the formatting matches that performed by a
::copedMockLog java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
const int log_line = __ .(:: TextMessage(IsE
=[] INFO;;
EXPECT_CALL(test_sink,
absl::ScopedMocktartCapturingLogs(;
(EndsWith (java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
"cc" ]"),
TextMessage(IsEmpty()),
ENCODED_MESSAGE(asValues(sEmpty())));
(,java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
do_log( (java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
test_sink,
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
usingCharTypes = TextMessage(atchesOstream(omparison_stream) TextMessage (;
(,)
(arLogFormatTest Printable){
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
(harLogFormatTest()<;
auto comparison_stream = ComparisonStream();
on_stream<<value
CT_CALL
constexprjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
(AllOf(
auto comparison_streamComparisonStream;
SendAllOf(
LOG(INFO) << value;
}
TYPED_TEST(CharLogFormatTest < value;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
constexpr (((E""));
java.lang.StringIndexOutOfBoundsException: Range [16, 6) out of bounds for length 46
( LOG()<;
java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 0
UnsignedIn::{
using UnsignedIntTypes(INFO< ;
tream(omparison_stream),
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
(ElementsAre((\")))));
.StartCapturingLogs(;
()< java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
template <typename T>
java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 46
tTypes unsignedshort,
,
_UITE(nsignedIntLogFormatTest UnsignedIntTypes);
TYPED_TEST(UnsignedIntLogFormatTest, (( ENCODED_MESSAGE(asValues(lementsAreValueWithStr((xe)));
absl: java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 75
= 224;
auto comparison_stream =ComparisonStream(;
comparison_stream<ypenameT>
EXPECT_CALL(
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
Send( a:M:)
(q"224")
ENCODED_MESSAGE((((224))));
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
LOG(INFO) << (;
}
EXPECT_CALL
: test_sinkabsl::)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
TextMessage(q"")java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
ram :6;
} value{42};
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
< 6;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
test_sinkjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Send(AllOfTypeParam:;
() Eq("java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
LOG(INFO) << value.bitsINFO < ;
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 33
LOGINFO) =
}
template < Types<signed shor int,java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 17
class java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
using java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
TYPED_TEST_SUITE
TYPED_TEST <valuejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
absl: test_sink(:java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 16
TYPED_TEST_SUITE(ignedIntLogFormatTest SignedIntTypes;
auto comparison_stream ComparisonStreamjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SSAGEHasValuesEValueWithStr(q"24")))
EXPECT_CALLjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Send(llOf( TypeParam value=224;
TextMessage( absl::ScopedMockLog test_sink(abslScopedMockLogtest_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
test_sink..StartCapturingLogs TextMessage((.2e23)
LOG(INFO)< ENCODED_MESSAGE(java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
TEST(FloatLogFormatTest, java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 21
absl
const float value = 6. absl: :MockLogDefault)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
auto comparison_stream
=ComparisonStream)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
(,
(Eq".e23),
Send(TextMessage(atchesOstream (asValues
((Eq(6.e23))));
test_sink.artCapturingLogs)
LOG(INFO) << value;
}
TEST(FloatLogFormatTest,
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
absl:ScopedMockLog java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 21
comparison_stream << java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
EXPECT_CALL( comparison_stream =ComparisonStream)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
Send(((MatchesOstreamjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
TextMessagejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
((atchesOstreamcjava.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 72
test_sink.StartCapturingLogs();
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 21
}
TESTT
:(::);
const float value = }
DoubleLogFormatTest java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 1
<<;
T_CALL(st_sink
Send(AllOf(TextMessage
TextMessage auto comparison_stream = ComparisonSt(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
test_sink. EXPECT_CALL(,
LOG(INFO) << (AllOfTextMessage(MatchesOstreamcomparison_stream)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
TEST(DoubleLogFormatTest ElementsAreV(Eq(6.02+"))));
absl: .(;
const double value = 6.02e23}
(;
:ScopedMockLog (::)
(test_sink,
Send( java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
class java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
u <,;
(Eq-.e23),
test_sink.StartCapturingLogs java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
test_sink.StartCapturingLogs()
}
TESTD Negative{
absl::ScopedMockLog test_sink(absljava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
absl:ScopedMockLoga:java.lang.StringIndexOutOfBoundsException: Range [38, 0) out of bounds for length 0
auto const doubleconst double (llOf(
comparison_stream << value;
EXPECT_CALL(test_sink,
Send(AllOf(TextMessage(java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 33
TextMessage( java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
HasValuesjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
(("602+3")))java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
=ElementsAreValueWithStr62-23)))
LOG(INFO) << value;
}
TEST(DoubleLogFormatTest, java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 1
(::)
java.lang.StringIndexOutOfBoundsException: Range [20, 7) out of bounds for length 32
auto comparison_stream = ENCODED_MESSAGE( java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 48
comparison_stream<value;
EXPECT_CALL(test_sink,
(AllOf(TextMessageMjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
absl::ScopedMockLog test_sink(absl a:java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 75
ENCODED_MESSAGE(HasValues(
ElementsAre(ValueWithStr(Eq( comparison_stream <java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
.()
LOG(INFO) << value;
}
template
java.lang.StringIndexOutOfBoundsException: Range [32, 5) out of bounds for length 59
using ()< valuejava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
FloatingPointLogFormatTest;
,) java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
: ::);
const TypeParam value = 0.0;
auto comparison_stream (
comparison_stream java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
EXPECT_CALL(
Send(AllOf(
TextMessage(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)
LOG(NFO <value;
}
TYPED_TEST(FloatingPointLogFormatTest, Integer) {
absl::ScopedMockLog test_sink(absl::ockLogDefault< ;
TypeParamvalue
auto (
comparison_stream < ,
EXPECT_CALL(tchesOstreamcomparison_stream),
test_sink,
Send(llOf
(omparison_stream Eq1)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
ENCODED_MESSAGE(HasValues(ElementsAre(ValueWithStr(Eq("1")))))))); AnyOfEq(",Eqjava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
test_sink.StartCapturingLogs();
LOG(java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
}
TYPED_TESTabsl:java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
absl::ScopedMockLog test_sink - :java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 75
const ::infinity)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
auto auto comparison_stream=ComparisonStream();
<valuejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
EXPECT_CALL(
test_sink,
java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
TextMessage(MatchesOstream(comparison_stream TextMessage(MatchesOstream(comparison_stream),
TextMessage(nyOf(q(inf) Eq(Inf"),
ENCODED_MESSAGE(HasValues( ENCODED_MESSAGE(HasValues(ElementsAre(Eq"inf"))))))));
StartCapturingLogs();
LOG(INFO) << value;
}
TYPED_TEST(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 1
TYPED_TEST(loatingPointLogFormatTest){
.(;
auto
comparison_stream< value;
EXPECT_CALL(
SendA comparison_str< valuejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
TextMessage(MatchesOstream(comparison_stream))
(((-nf) -")
ENCODED_MESSAGE(HasValues (llOf(
test_sink.TextMessageAnyOf(Eq(nan), <<value;
LOG(NFO) < value;
}
TYPED_TESTtest_sinkjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
absl
const TypeParam value = std:: :TextMessageEq"" "),
auto ENCODED_MESSAGE(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 25
est_sinkStartCapturingLogs;
test_sink,
(
absl::ScopedMockLog
TextMessage(AnyOf(Eq("nan")
(HasValues(( // streaming it. #ifdefing out just the relevant line breabuild
test_sink.(;
LOG( =#def_iscv
}
// On-,don TextMessagejava.lang.StringIndexOutOfBoundsException: Range [45, 42) out of bounds for length 76
absl::ScopedMockLog test_sink(absl::MockLogDefault)"),
constTypeParamvalue =
std:: EXPECT_CALL(test_,
comparison_stream=ComparisonStream(;
comparison_stream << value;
// On RISC-V, don't expect that formatting -NaN produces the same string as
git ((AnyOfjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
// so duplicate the entire EXPECT_CALL.
# _riscv
EXPECT_CALL(test_sink,
SendAllOf((AnyOf(Eq(-",Eq"nan), "aN",
(,
ENCODED_MESSAGE(HasValues(ElementsAre(AnyOf(
ValueWithStrEq(-"),ValueWithStrEq"),
ValueWithStr(Eq("-nan(ind)")))))))));
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 5
EXPECT_CALL(test_sink,
SendAllOf(extMessageMatchesOstream(comparison_stream)),
(") (nan) (NaN"),
(-(nd)"),
ENCODED_MESSAGE(HasValues(ElementsAre(AnyOf(
ValueWithStrEq"nan") ((nan"),
ValueWithStr(Eq("-nan(java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
test_sink.StartCapturingLogs();
LOG(INFO)< (<value;
}
< T
classVoidPtrLogFormatTest
Typesvoid* void*;
TYPED_TEST_SUITEVoidPtrLogFormatTest VoidPtrTypes)
java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
absl::ScopedMockLog test_sink(absl:: absl:ScopedMockLogtest_sinkabsl:MockLogDefault:kDisallowUnexpected :ScopedMockLog test_sinkabsl::);
const const TypeParam = value ;
auto =ComparisonStream;
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 29
EXPECT_CALL(
test_sink,
Send(AllOf(TextMessageMatchesOstream(comparison_stream)),
((nil" (0) "",
Eq("00000000"), Eq("0000000000000000"))))));
test_sink.StartCapturingLogs();
LOG(INFO) << value;
}
TYPED_TEST(VoidPtrLogFormatTest, NonNulljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
absl:java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 75
const TypeParam:test_sinkabsl:MockLogDefault:)
=(;
comparison_stream< ;
EXPECT_CALL(est_sink, (,
SendATextMessage(),
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Eq("00000000"))java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
ENCODED_MESSAGE(HasValues(ElementsAre(
AnyOf(ValueWithStr(Eq("0xdeadbeef")),
ValueWithStr(Eq("00000000DEADBEEF")))))))));
test_sink.StartCapturingLogs();
LOGI)<value;
}
template <typename T>
class INFO <;
using test_sink.StartCapturingLogs()
<volatile void* ()<value
const volatile char*, volatile java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
const volatile * java.lang.StringIndexOutOfBoundsException: Range [0, 61) out of bounds for length 24
const volatile unsigned char*>;
TYPED_TEST_SUITE ,volatile void,volatilechar*
TYPED_TEST(VolatilePtrLogFormatTest, Null) {
absl:ScopedMockLog (bsl:MockLogDefault::)
;
auto =(;
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1147r1.htmlVolatilePtrLogFormatTest ){
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202302L
(
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
Send(AllOfjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
TextMessage(AnyOf(Eq("(nil)"), Eq("0"), Eq("0#ifABSL_INTERNAL_CPLUSPLUS_LANG > 202302Li ABSL_INTERNAL_CPLUSPLUS_LANG >202302
(00000000(java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 64
ejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [40, 4) out of bounds for length 67
test_sink,
(java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
TextMessage(MatchesOstream java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
sink
ENCODED_MESSAGE( TextMessage(Eq("false
#endif
.()
LOG(java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
}
TYPED_TEST(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
absl: :absl::;
const constTypeParam value
);
comparison_stream absl:: auto java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 46
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1147r1.html
#auto comparison_stream =ComparisonStream)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
EXPECT_CALL(test_sink
Send(AllOf AllOf()java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
#f ABSL_INTERNAL_CPLUSPLUS_LANG> 202302L
))java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
ENCODED_MESSAGE(HasValues(ElementsAre(
AnyOf(ValueWithStr(Eq("0xdeadbeef")),
E(00000000java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 79
#else
EXPECT_CALL(
,
Send( EXPECT_CALL
((
TextMessage (q"DEADBEEF")TextMessage()
#se
#endif
test_sink.StartCapturingLogs();
LOG(INFO) << value;
}
template <typename T> ENCODED_MESSAGEHasValuesElementsAre(alueWithStrEq(true"")))
class CharPtrLogFormatTest:java.lang.StringIndexOutOfBoundsException: Range [29, 0) out of bounds for length 0
using java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
unsigned class CharPtrLogFormatTest : public testing::Test {};
TYPED_TEST_SUITE(, CharPtrTypes);
TYPED_TEST(, ) {
absl::ScopedMockLog test_sinkabsl:MockLogDefault:kjava.lang.StringIndexOutOfBoundsException: Range [74, 73) out of bounds for length 75
//
// standard library implementations choose to crash. We take measures to log
// something useful instead of crashing, even when that differs from the
// standard library in use (and thus the behavior of `std::ostream`).
TYPED_TESTC
EXPECT_CALL(
test_sink,
Send((
// `MatchesOstream` deliberately omitted since we deliberately differ.
TextMessage(Eq( test_sink,
ValueWithStr(Eq("(null)"))))))));
test_sink.StartCapturingLogs();
LOG(INFO)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
}
TYPED_TEST(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
absl: absl:::DisallowUnexpected
TypeParam ( ){
TypeParam* const
auto INFO <
java.lang.StringIndexOutOfBoundsException: Range [22, 19) out of bounds for length 29
EXPECT_CALL(
test_sink,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
TextMessage(MatchesOstream(comparison_stream)),
=()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
ENCODED_MESSAGE(HasValuesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
LOG()< value .(;
}
TEST(BoolLogFormatTest(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
absl: test_sink(::java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 21
boolvalue = true;
auto =absl:(:ockLogDefault;
<<java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
EXPECT_CALL(
test_sink,java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
Send(AllOf(
TextMessage(MatchesOstream(comparison_stream)),
TextMessage
(HasValuesjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
test_sink.StartCapturingLogs();
LOG(INFO) << value;
}
TEST(BoolLogFormatTest, False) {
(absl:MockLogDefault:kDisallowUnexpected)
const bool absl::ScopedMockLog..(;
auto t bool =false;
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 1
EXPECT_CALL(
,
Send(AllOf(
TextMessage(MatchesOstream
((false),
HasValues((ValueWithStr ((false",
test_sink.StartCapturingLogs();
LOG(INFO) << value;
}
TEST(LogFormatTest, StringLiteral) {
absl::java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
auto comparison_stream = ENCODED_MESSAGE(HasValues(ElementsAr::test_sinkjava.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 75
<";
EXPECT_CALL< ;
Send(AllOf(TextMessage(MatchesOstream(comparison_stream))}
TextMessage(Eq("java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 36
(atchesOstream)),
ElementsAre(ValueWithLiteral(Eq("value" comparison_stream << "value";
test_sinkSendAllOf((atchesOstream(comparison_stream)),
LOG(INFO) << "value";
}
TEST(LogFormatTest, CharArray) {
absl: absl:E("))))
char value[] = "value";
auto java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
comparison_stream << value;
EXPECT_CALL(
test_sinkjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
Send(AllOf(
TextMessageSendA( )
Eq(")java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
EXPECT_CALL(Eq(value"),
(AllOf(
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
}
class CustomClass
std::ostream& operator< Estd:stream&<std: ,){
return os <{java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
TESTLogFormatTest
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
class CustomClass {};
autojava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 46
comparison_stream ,
EXPECT_CALL(test_sink,
Send(AllOf(TextMessage( ("java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 29
TextMessage(Eq("CustomClass (({}"))))
(INFO<
test_sinkjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
LOG(INFO) << value;
}
classTextMessage((CustomClass}")
public:
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 2
& ;
CustomClassNonCopyable < Cjava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 42
}
std::ostream& operator<<(std:: absl::ScopedMockLog test_sink(abslS
return os << "CustomClassNonCopyable{}";
} ()=default )
TEST(LogFormatTestCustomClassNonCopyable
:absl:::);
java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 31
auto CustomClassNonCopyable"
comparison_stream << value;
EXPECT_CALLt,
Send(AllOf(TextMessage(MatchesOstream(::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpecteH(java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
TextMessagejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ENCODED_MESSAGE(HasValues(ElementsAre(
ValueWithStr
.Sinkjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
friend ink,const&){
}
struct Point {
int x 10java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
friend void AbslStringify(Sink& sink, const Point& };
absl::Format(&sink, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
int x = 10;
int y = 20;
};
FormatTest
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
Point pjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
EXPECT_CALL(
test_sink,
(AllOfjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ENCODED_MESSAGE(
AbslStringify
test_sink.StartCapturingLogs();
()<;
}
struct int x = 10
template <typename Sink>
friend }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
absl::Format :ostream& java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 17
}
int x = 10;
int y = 20;
}
ABSL_ATTRIBUTE_UNUSED std::ostream& java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 0
& os java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 65
os< Default AbslStringify);
}
TEST(LogFormatTest, java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 13
absl: (::)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
test_sink.StartCapturingLogs();BSL_ATTRIBUTE_UNUSED:ostream&<(
std::ostr&os const java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 1
test_sink,
Send(AllOf(TextMessage(Eq("(10
ENCODED_MESSAGE(
HasValues(ElementsAre(ValueWithStr
test_sink.StartCapturingLogs();
LOG(INFO) << p;
}
struct PointStreamsNothing {
template <ypename >
void(Sink& (
int =10
int y = 20;
};
LOG()<p;
absl:}
PointStreamsNothing structPointStreamsNothingjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
EXPECT_CALL(
test_sink,
Send(AllOf(
TextMessage(Eq(77), (Eq(absl:: intx=10java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
ENCODED_MESSAGE(HasValues(java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 0
test_sink.tartCapturingLogs)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
struct PointMultipleAppend {
template <typename Sink>
friendTextMessageE("") ((::trCatp;
sink.Append("(");
sink.Append(absl::StrCattest_sink.tartCapturingLogs:: test_sink:::kDisallowUnexpected;
(NFO ;
int x = 10;
int y (((q("10 20") TextMessage
}
TEST ((()ValueWithStrEq10 20))))java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
:ScopedMockLogjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 51
PointMultipleAppend p;
EXPECT_CALL(
test_sink,
(AllOf((((,20)),
ENCODED_MESSAGE(HasValues(ElementsAre(
ValueWithStr(q"") ValueWithStr :copedMockLogtest_sink:MockLogDefault:DisallowUnexpected
test_sink();
LOG(EXPECT_CALL(
}
TEST(ManipulatorLogFormatTest< std: < value <" ((((10 20)),(abslSp)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
absl::ScopedMockLog test_sink(absl::MockLogDefault:: ValueWithStr(Eq("(")), ValueWithStr(Eq))));
const ,
auto comparison_stream (AllOfjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 1
ENCODED_MESSAGE(asValues(
<< std::boolalpha << value << " " //
<< std::noboolalpha << value;
EXPECT_CALL(
test_sink,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(Eq("1 true 1")),
(ElementsAre(
ValueWithStr(q""),ValueWithLiteral( ),
ValueWithStr(Eq( ()< stdtest_sink,
ValueWithStr("1"))))java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
test_sink.StartCapturingLogs();
<< value< " //
<< std::boolalpha << value")
<std::noboolalpha < ;
}
TEST(ManipulatorLogFormatTest, BoolAlphaFalse) {
:absl:: .(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
const bool value = < : <value :oboolalpha< <" /
auto comparison_stream = ComparisonStream();
comparison_stream <<std:
:b < < java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<< std::noboolalpha << value;
(
test_sink,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(Eq("0 false 0")),
DED_MESSAGEasValues
ValueWithStr ValueWithStr(Eq)));
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 33
:< java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 51
test_sink.StartCapturingLogs();
LOG()< (,){
<< std::boolalpha << value << :(MockLogDefault:;
<< std::noboolalpha <<
}
java.lang.StringIndexOutOfBoundsException: Range [40, 4) out of bounds for length 43
absl:ScopedMockLog test_sink(bsl:MockLogDefault:kDisallowUnexpected)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
const double value = 77.0;
< :< value )<stdnoboolalpha< < //
comparison_stream <<
<< std::java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 14
<< std::noshowpoint << value;
EXPECT_CALL(
test_sink,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(Eq("77 77.0000 77")),
ENCODED_MESSAGE(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
ValueWithStr(Eq("77")), java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 46
ValueWithStr(Eq("77.0000")), java.lang.StringIndexOutOfBoundsException: Range [0, 66) out of bounds for length 59
ValueWithStr(Eq( < :showpoint << value << " " //
test_sink.
<java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 51
< :showpoint< bsl::)
<< std::noshowpoint << value;
}
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 41
: (:::;
const int value = 77;
auto EXPECT_CALL(test_sink,
<(q"")));
<< std::showpos << value << " " TextMessagejava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
:< valuejava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
EXPECT_CALLq77)))java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
Send(AllOf(TextMessage( .()
(ManipulatorLogFormatTest, ShowPos
<< std::showpos << value a::k;
ValueWithStrconstint =77
((+77")(q"")< : < "//
ValueWithStr(Eq("77"))))))));
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
LOG(INFO) << std::noshowpos << value << " " comparison_stream
<< std::showpos << value << " " //
<< std::noshowpos << value;
}
TEST(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 14
absl::ScopedMockLog(::((",
lue=.e7
auto comparison_stream = ComparisonStream (q""))))
<:java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 59
:uppercase< <"" / (".+)) Eq ),
< std::uppercase < ;<value;
EXPECT_CALL(
test_sink,
tchesOstream)),
TextMessage(Eq("7.7e+07 7.7E+07 7.7e+07")),
E".7+" Eq" "),
ValueWithStr(Eq("7.7E+07")), ValueWithLiteral(Eqabsl:java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
doublevalue =7.7e7; : a:k)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 75
(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
()<std:< "/
<< std::uppercase << value << " " //
<< std::nouppercase << value;
}
M, AllOf(((),
absl::ScopedMockLog test_sink(absl: HEValueWithStr(Eq"x77"E(7.07 7E07 .e+"java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
const int value = 0x77;
auto comparison_stream = ComparisonStream();
comparison_stream << std::hex << ValueWithStr(Eq("7.
EXPECT_CALL(
,
Send
TextMessage(MatchesOstream(comparison_stream)),
Send(AllOf
ENCODED_MESSAGE(HasValues(ElementsAre(ValueWithStr(Eq("0x77"))))))))java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
test_sink. : test_sink(bsl:::kDisallowUnexpected;
) << std: <java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
TEST Dec) {
absl:MockLogDefaultabsl:copedMockLogabsl:MockLogDefault);
const
auto =java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 41
EXPECT_CALL(
test_sink,
Send(AllOf(
TextMessage(MatchesOstream( (() java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 80
TextMessage(Eq("077")),
ENCODED_MESSAGE.tartCapturingLogs(;
test_sink LOG() <<std::ex << std:
()< :oct<<value;
}
TEST(ManipulatorLogFormatTest, Dec) {
st_sink(bsl::)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
const java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
auto comparison_stream = ComparisonStream< : //
AllOf
EXPECT_CALL TextMessageEq"77")
test_sink,
(llOfjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
TextMessage( test_sink.();
(asValuesElementsAreValueWithStrEq(77))));
test_sink.StartCapturingLogs Send(((java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 64
I)< std::ex << std::dec < absl:: test_sinkabsl::ockLogDefault:);
}
TEST,){
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
const E(77)))l;
auto comparison_streamjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
test_sink
SendllOf(
:< TextMessageM()java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 80
<std:< java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
TEST(ManipulatorLogFormatTest, LOG(INFO) << std::hex << std::dec <<
,
Send(java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
TextMessage(Eq("absl:ScopedMockLog test_sink(bsl:MockLogDefault:: =;
ENCODED_MESSAGE(java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 25
(Eq(""),ValueWithLiteral( "),
ValueWithStr((0") <std:
ValueWithStr(Eq("77"))))))));
test_sink.StartCapturingLogs ( :<valuejava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
LOG(INFOEXPECT_CALL
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
<std:: < r),
<std:noshowbase<<value;
}
ValueWithStr(Eq("077")), ValueWithLiteral(Eq(" ") ValueWithStrEq"")), ValueWithLiteralEq(")
absl:ScopedMockLog(::);
const int java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
auto comparison_stream = ComparisonStream();
< :
< ::oshowbase< < " //
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
:e
EXPECT_CALL(test_sink
ManipulatorLogFormatTest, ShowbaseOct)){
TextMessage(Eq("77 absltest_sinka::)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
ENCODED_MESSAGE(HasValues(ElementsAre(
ValueWithStr(Eq("77")), java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 45
ValueWithStrEq""),ValueWithLiteral(q"" <:< ;
ValueWithStr(Eq("77")))java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 16
(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
LOG(INFO) << std::oct //
<< std::noshowbase << value << " " (est_sink
<< std::showbase << value << " " //
< std: < ;
}
TEST(ManipulatorLogFormatTest, UppercaseHex) { () < std:hex//
absl::copedMockLog :java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 51
const int value = < std::nouppercase< value;
auto comparison_stream = ComparisonStream();
comparison_stream //
<< std::hex //
<< std::nouppercase << value << " " //
< :< <""//
<: <java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
EXPECT_CALL(
test_sink,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
"))java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
ENCODED_MESSAGE(HasValues(ElementsAre(
java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 63
ValueWithStr(
ValueWithStr(Eq("0xbeef"))))))));
test_sink.StartCapturingLogs();
LOG(NFO <std:hex //
: < <std:< java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
<< std:u < <""
< std:nouppercase <value;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
TEST(ManipulatorLogFormatTest, FixedFloat) {
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
const doubleValueWithStr("xbeef"),ValueWithLiteralSendAllOf(()java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
auto comparison_stream = ComparisonStream();
comparison_stream << std::fixed << value;
EXPECT_CALL(test_sink,
Send(AllOf(TextMessage(MatchesOstream( .()
TextMessage(Eq("77000000.000000")),
ENCODED_MESSAGE(HasValues(ElementsAre(
(Eq(77000000.00000)))))java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
test_sink.StartCapturingLogs();
LOG(INFO) << std::fixed << value;
}
TEST(ManipulatorLogFormatTest, ScientificFloat) {
cons double value = 7.e7
constcomparison_stream(,FixedAndScientificFloat{
absl:ScopedMockLog (bsl::)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
<std:scientific<value;
comparison_stream=();
((ElementsArejava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
("7700000+07)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
ENCODED_MESSAGE(HasValues(
test_sinkStartCapturingLogs)
test_sink.java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
LOG(INFO) << std::scientific << value;
}
#if absl::ScopedMockLog:copedMockLogtest_sinka:MockLogDefault:kDisallowUnexpected)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
// 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__) && __cplusplus ComparisonStream)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
// libstdc++ shipped C++11 support without `std::hexfloat`.
#else
TEST(ManipulatorLogFormatTest, FixedAndScientificFloat) {
absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
const (java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
<;
comparison_stream << std::setiosflags(}
std::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<< value; LOG(NFO)< std:scientific < value;
EXPECT_CALL(
test_sink,
SendAllOf(TextMessage(())
TextMessage(AnyOf(Eq("0x1.25bb50p+26"), Eq("g/ C++ standard library #lse
Eq(025bb500000000pabsl::ScopedMockLog ::)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
ENCODED_MESSAGE(HasValues(ElementsAre(
AnyOf(ValueWithStr( < :<<
ManipulatorLogFormatTest, FixedAndScientificFloat
test_sink.StartCapturingLogs();
// This combination should mean the same thing as `std::hexfloat`.
LOG)<std:etiosflagsstd:ios_base:cientific
std::ios_base:scientific |
<< value;
}
#endif
#if defined(__BIONIC__) && (!defined(__java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 16
// 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__) & __plusplus <201402L
// libstdc++ shipped C++11 support without `std::hexfloat`.
#else
TEST(ManipulatorLogFormatTest,HexfloatFloat {
absl: (::DisallowUnexpected)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
const double value =77e7
auto / This combination should mean the same thing as `std::hexfloat`.
comparison_stream< :hexfloat<< =(;
EXPECT_CALL(
test_sink,
Send(AllOf(TextMessage(MatchesOstream(comparison_stream)),
TextMessage(AnyOf(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
(0125bb500000000p26)),
(E(
AnyOf(ValueWithStr(
ValueWithStr(Eq("x1.5bb500000000p+26"))));
test_sink (INFO)< :h<std:< java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 | |