2014-08-01 12:48:28 -04:00
|
|
|
// Copyright 2014 The Crashpad Authors. All rights reserved.
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
|
|
|
// http://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.
|
|
|
|
|
|
|
|
#include "minidump/minidump_writable.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-01-06 12:22:50 -05:00
|
|
|
#include "base/macros.h"
|
2014-08-01 12:48:28 -04:00
|
|
|
#include "gtest/gtest.h"
|
2015-02-18 14:15:38 -05:00
|
|
|
#include "util/file/string_file.h"
|
2014-08-01 12:48:28 -04:00
|
|
|
|
2014-10-07 17:28:50 -04:00
|
|
|
namespace crashpad {
|
|
|
|
namespace test {
|
2014-08-01 12:48:28 -04:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
class BaseTestMinidumpWritable : public crashpad::internal::MinidumpWritable {
|
|
|
|
public:
|
|
|
|
BaseTestMinidumpWritable()
|
|
|
|
: MinidumpWritable(),
|
|
|
|
children_(),
|
|
|
|
expected_offset_(-1),
|
|
|
|
alignment_(0),
|
|
|
|
phase_(kPhaseEarly),
|
|
|
|
has_alignment_(false),
|
|
|
|
has_phase_(false),
|
|
|
|
verified_(false) {}
|
|
|
|
|
|
|
|
~BaseTestMinidumpWritable() { EXPECT_TRUE(verified_); }
|
|
|
|
|
|
|
|
void SetAlignment(size_t alignment) {
|
|
|
|
alignment_ = alignment;
|
|
|
|
has_alignment_ = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddChild(BaseTestMinidumpWritable* child) { children_.push_back(child); }
|
|
|
|
|
|
|
|
void SetPhaseLate() {
|
|
|
|
phase_ = kPhaseLate;
|
|
|
|
has_phase_ = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Verify() {
|
|
|
|
verified_ = true;
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(state(), kStateWritten);
|
2014-08-01 12:48:28 -04:00
|
|
|
for (BaseTestMinidumpWritable* child : children_) {
|
|
|
|
child->Verify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2014-10-14 11:11:57 -04:00
|
|
|
bool Freeze() override {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(state(), kStateMutable);
|
2014-08-01 12:48:28 -04:00
|
|
|
bool rv = MinidumpWritable::Freeze();
|
|
|
|
EXPECT_TRUE(rv);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(state(), kStateFrozen);
|
2014-08-01 12:48:28 -04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2014-10-14 11:11:57 -04:00
|
|
|
size_t Alignment() override {
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_GE(state(), kStateFrozen);
|
|
|
|
return has_alignment_ ? alignment_ : MinidumpWritable::Alignment();
|
|
|
|
}
|
|
|
|
|
2014-10-14 11:11:57 -04:00
|
|
|
std::vector<MinidumpWritable*> Children() override {
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_GE(state(), kStateFrozen);
|
|
|
|
if (!children_.empty()) {
|
|
|
|
std::vector<MinidumpWritable*> children;
|
|
|
|
for (BaseTestMinidumpWritable* child : children_) {
|
|
|
|
children.push_back(child);
|
|
|
|
}
|
|
|
|
return children;
|
|
|
|
}
|
|
|
|
return MinidumpWritable::Children();
|
|
|
|
}
|
|
|
|
|
2014-10-14 11:11:57 -04:00
|
|
|
Phase WritePhase() override {
|
2014-08-01 12:48:28 -04:00
|
|
|
return has_phase_ ? phase_ : MinidumpWritable::Phase();
|
|
|
|
}
|
|
|
|
|
2015-03-06 16:05:34 -08:00
|
|
|
bool WillWriteAtOffsetImpl(FileOffset offset) override {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(kStateFrozen, state());
|
2014-08-01 12:48:28 -04:00
|
|
|
expected_offset_ = offset;
|
|
|
|
bool rv = MinidumpWritable::WillWriteAtOffsetImpl(offset);
|
|
|
|
EXPECT_TRUE(rv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2014-10-14 11:11:57 -04:00
|
|
|
bool WriteObject(FileWriterInterface* file_writer) override {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(kStateWritable, state());
|
|
|
|
EXPECT_EQ(file_writer->Seek(0, SEEK_CUR), expected_offset_);
|
2014-08-01 12:48:28 -04:00
|
|
|
|
|
|
|
// Subclasses must override this.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<BaseTestMinidumpWritable*> children_;
|
2015-03-06 16:05:34 -08:00
|
|
|
FileOffset expected_offset_;
|
2014-08-01 12:48:28 -04:00
|
|
|
size_t alignment_;
|
|
|
|
Phase phase_;
|
|
|
|
bool has_alignment_;
|
|
|
|
bool has_phase_;
|
|
|
|
bool verified_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(BaseTestMinidumpWritable);
|
|
|
|
};
|
|
|
|
|
|
|
|
class TestStringMinidumpWritable final : public BaseTestMinidumpWritable {
|
|
|
|
public:
|
|
|
|
TestStringMinidumpWritable() : BaseTestMinidumpWritable(), data_() {}
|
|
|
|
|
|
|
|
~TestStringMinidumpWritable() {}
|
|
|
|
|
|
|
|
void SetData(const std::string& string) { data_ = string; }
|
|
|
|
|
|
|
|
protected:
|
2014-10-14 11:11:57 -04:00
|
|
|
size_t SizeOfObject() override {
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_GE(state(), kStateFrozen);
|
|
|
|
return data_.size();
|
|
|
|
}
|
|
|
|
|
2014-10-14 11:11:57 -04:00
|
|
|
bool WriteObject(FileWriterInterface* file_writer) override {
|
2014-08-01 12:48:28 -04:00
|
|
|
BaseTestMinidumpWritable::WriteObject(file_writer);
|
2014-08-12 10:26:40 -07:00
|
|
|
bool rv = file_writer->Write(&data_[0], data_.size());
|
|
|
|
EXPECT_TRUE(rv);
|
|
|
|
return rv;
|
2014-08-01 12:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string data_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TestStringMinidumpWritable);
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST(MinidumpWritable, MinidumpWritable) {
|
2015-02-18 14:15:38 -05:00
|
|
|
StringFile string_file;
|
2014-08-01 12:48:28 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("empty");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable string_writable;
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(string_writable.WriteEverything(&string_file));
|
|
|
|
EXPECT_TRUE(string_file.string().empty());
|
2014-08-01 12:48:28 -04:00
|
|
|
string_writable.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("childless");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable string_writable;
|
|
|
|
string_writable.SetData("a");
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(string_writable.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 1u);
|
|
|
|
EXPECT_EQ(string_file.string(), "a");
|
2014-08-01 12:48:28 -04:00
|
|
|
string_writable.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("parent-child");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("b");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("c");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 5u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("b\0\0\0c", 5));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("base alignment 2");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("de");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("f");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 5u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("de\0\0f", 5));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("base alignment 3");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("ghi");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("j");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 5u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("ghi\0j", 5));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("base alignment 4");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("klmn");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("o");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 5u);
|
|
|
|
EXPECT_EQ(string_file.string(), "klmno");
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("base alignment 5");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("pqrst");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("u");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 9u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("pqrst\0\0\0u", 9));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("two children");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("parent");
|
|
|
|
TestStringMinidumpWritable child_0;
|
|
|
|
child_0.SetData("child_0");
|
|
|
|
parent.AddChild(&child_0);
|
|
|
|
TestStringMinidumpWritable child_1;
|
|
|
|
child_1.SetData("child_1");
|
|
|
|
parent.AddChild(&child_1);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 23u);
|
|
|
|
EXPECT_EQ(string_file.string(),
|
|
|
|
std::string("parent\0\0child_0\0child_1", 23));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchild");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("parent");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("child");
|
|
|
|
parent.AddChild(&child);
|
|
|
|
TestStringMinidumpWritable grandchild;
|
|
|
|
grandchild.SetData("grandchild");
|
|
|
|
child.AddChild(&grandchild);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 26u);
|
|
|
|
EXPECT_EQ(string_file.string(),
|
|
|
|
std::string("parent\0\0child\0\0\0grandchild", 26));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchild with empty parent");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("child");
|
|
|
|
parent.AddChild(&child);
|
|
|
|
TestStringMinidumpWritable grandchild;
|
|
|
|
grandchild.SetData("grandchild");
|
|
|
|
child.AddChild(&grandchild);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 18u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("child\0\0\0grandchild", 18));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchild with empty child");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("parent");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
parent.AddChild(&child);
|
|
|
|
TestStringMinidumpWritable grandchild;
|
|
|
|
grandchild.SetData("grandchild");
|
|
|
|
child.AddChild(&grandchild);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 18u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("parent\0\0grandchild", 18));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchild with empty grandchild");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("parent");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("child");
|
|
|
|
parent.AddChild(&child);
|
|
|
|
TestStringMinidumpWritable grandchild;
|
|
|
|
child.AddChild(&grandchild);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 13u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("parent\0\0child", 13));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchild with late-phase grandchild");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("parent");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("child");
|
|
|
|
parent.AddChild(&child);
|
|
|
|
TestStringMinidumpWritable grandchild;
|
|
|
|
grandchild.SetData("grandchild");
|
|
|
|
grandchild.SetPhaseLate();
|
|
|
|
child.AddChild(&grandchild);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 26u);
|
|
|
|
EXPECT_EQ(string_file.string(),
|
|
|
|
std::string("parent\0\0child\0\0\0grandchild", 26));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchild with late-phase child");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("parent");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("child");
|
|
|
|
child.SetPhaseLate();
|
|
|
|
parent.AddChild(&child);
|
|
|
|
TestStringMinidumpWritable grandchild;
|
|
|
|
grandchild.SetData("grandchild");
|
|
|
|
child.AddChild(&grandchild);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 25u);
|
|
|
|
EXPECT_EQ(string_file.string(),
|
|
|
|
std::string("parent\0\0grandchild\0\0child", 25));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("family tree");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("P..");
|
|
|
|
TestStringMinidumpWritable child_0;
|
|
|
|
child_0.SetData("C0.");
|
|
|
|
parent.AddChild(&child_0);
|
|
|
|
TestStringMinidumpWritable child_1;
|
|
|
|
child_1.SetData("C1.");
|
|
|
|
parent.AddChild(&child_1);
|
|
|
|
TestStringMinidumpWritable grandchild_00;
|
|
|
|
grandchild_00.SetData("G00");
|
|
|
|
child_0.AddChild(&grandchild_00);
|
|
|
|
TestStringMinidumpWritable grandchild_01;
|
|
|
|
grandchild_01.SetData("G01");
|
|
|
|
child_0.AddChild(&grandchild_01);
|
|
|
|
TestStringMinidumpWritable grandchild_10;
|
|
|
|
grandchild_10.SetData("G10");
|
|
|
|
child_1.AddChild(&grandchild_10);
|
|
|
|
TestStringMinidumpWritable grandchild_11;
|
|
|
|
grandchild_11.SetData("G11");
|
|
|
|
child_1.AddChild(&grandchild_11);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 27u);
|
|
|
|
EXPECT_EQ(string_file.string(),
|
|
|
|
std::string("P..\0C0.\0G00\0G01\0C1.\0G10\0G11", 27));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("family tree with C0 late");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("P..");
|
|
|
|
TestStringMinidumpWritable child_0;
|
|
|
|
child_0.SetData("C0.");
|
|
|
|
child_0.SetPhaseLate();
|
|
|
|
parent.AddChild(&child_0);
|
|
|
|
TestStringMinidumpWritable child_1;
|
|
|
|
child_1.SetData("C1.");
|
|
|
|
parent.AddChild(&child_1);
|
|
|
|
TestStringMinidumpWritable grandchild_00;
|
|
|
|
grandchild_00.SetData("G00");
|
|
|
|
child_0.AddChild(&grandchild_00);
|
|
|
|
TestStringMinidumpWritable grandchild_01;
|
|
|
|
grandchild_01.SetData("G01");
|
|
|
|
child_0.AddChild(&grandchild_01);
|
|
|
|
TestStringMinidumpWritable grandchild_10;
|
|
|
|
grandchild_10.SetData("G10");
|
|
|
|
child_1.AddChild(&grandchild_10);
|
|
|
|
TestStringMinidumpWritable grandchild_11;
|
|
|
|
grandchild_11.SetData("G11");
|
|
|
|
child_1.AddChild(&grandchild_11);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 27u);
|
|
|
|
EXPECT_EQ(string_file.string(),
|
|
|
|
std::string("P..\0G00\0G01\0C1.\0G10\0G11\0C0.", 27));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("family tree with G0 late");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("P..");
|
|
|
|
TestStringMinidumpWritable child_0;
|
|
|
|
child_0.SetData("C0.");
|
|
|
|
parent.AddChild(&child_0);
|
|
|
|
TestStringMinidumpWritable child_1;
|
|
|
|
child_1.SetData("C1.");
|
|
|
|
parent.AddChild(&child_1);
|
|
|
|
TestStringMinidumpWritable grandchild_00;
|
|
|
|
grandchild_00.SetData("G00");
|
|
|
|
grandchild_00.SetPhaseLate();
|
|
|
|
child_0.AddChild(&grandchild_00);
|
|
|
|
TestStringMinidumpWritable grandchild_01;
|
|
|
|
grandchild_01.SetData("G01");
|
|
|
|
grandchild_01.SetPhaseLate();
|
|
|
|
child_0.AddChild(&grandchild_01);
|
|
|
|
TestStringMinidumpWritable grandchild_10;
|
|
|
|
grandchild_10.SetData("G10");
|
|
|
|
child_1.AddChild(&grandchild_10);
|
|
|
|
TestStringMinidumpWritable grandchild_11;
|
|
|
|
grandchild_11.SetData("G11");
|
|
|
|
child_1.AddChild(&grandchild_11);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 27u);
|
|
|
|
EXPECT_EQ(string_file.string(),
|
|
|
|
std::string("P..\0C0.\0C1.\0G10\0G11\0G00\0G01", 27));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("align 1");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("p");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("c");
|
|
|
|
child.SetAlignment(1);
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 2u);
|
|
|
|
EXPECT_EQ(string_file.string(), "pc");
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("align 2");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestStringMinidumpWritable parent;
|
|
|
|
parent.SetData("p");
|
|
|
|
TestStringMinidumpWritable child;
|
|
|
|
child.SetData("c");
|
|
|
|
child.SetAlignment(2);
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(string_file.string().size(), 3u);
|
|
|
|
EXPECT_EQ(string_file.string(), std::string("p\0c", 3));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class TestRVAMinidumpWritable final : public BaseTestMinidumpWritable {
|
|
|
|
public:
|
|
|
|
TestRVAMinidumpWritable() : BaseTestMinidumpWritable(), rva_() {}
|
|
|
|
|
|
|
|
~TestRVAMinidumpWritable() {}
|
|
|
|
|
|
|
|
void SetRVA(MinidumpWritable* other) { other->RegisterRVA(&rva_); }
|
|
|
|
|
|
|
|
protected:
|
2014-10-14 11:11:57 -04:00
|
|
|
size_t SizeOfObject() override {
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_GE(state(), kStateFrozen);
|
|
|
|
return sizeof(rva_);
|
|
|
|
}
|
|
|
|
|
2014-10-14 11:11:57 -04:00
|
|
|
bool WriteObject(FileWriterInterface* file_writer) override {
|
2014-08-01 12:48:28 -04:00
|
|
|
BaseTestMinidumpWritable::WriteObject(file_writer);
|
|
|
|
EXPECT_TRUE(file_writer->Write(&rva_, sizeof(rva_)));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
RVA rva_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TestRVAMinidumpWritable);
|
|
|
|
};
|
|
|
|
|
|
|
|
RVA RVAAtIndex(const std::string& string, size_t index) {
|
|
|
|
return *reinterpret_cast<const RVA*>(&string[index * sizeof(RVA)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(MinidumpWritable, RVA) {
|
2015-02-18 14:15:38 -05:00
|
|
|
StringFile string_file;
|
2014-08-01 12:48:28 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("unset");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestRVAMinidumpWritable rva_writable;
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(rva_writable.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 0), 0 * sizeof(RVA));
|
2014-08-01 12:48:28 -04:00
|
|
|
rva_writable.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("self");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestRVAMinidumpWritable rva_writable;
|
|
|
|
rva_writable.SetRVA(&rva_writable);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(rva_writable.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 0), 0 * sizeof(RVA));
|
2014-08-01 12:48:28 -04:00
|
|
|
rva_writable.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("parent-child self");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestRVAMinidumpWritable parent;
|
|
|
|
parent.SetRVA(&parent);
|
|
|
|
TestRVAMinidumpWritable child;
|
|
|
|
child.SetRVA(&child);
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 2 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 0), 0 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 1), 1 * sizeof(RVA));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("parent-child only");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestRVAMinidumpWritable parent;
|
|
|
|
TestRVAMinidumpWritable child;
|
|
|
|
parent.SetRVA(&child);
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 2 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 0), 1 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 1), 0 * sizeof(RVA));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("parent-child circular");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestRVAMinidumpWritable parent;
|
|
|
|
TestRVAMinidumpWritable child;
|
|
|
|
parent.SetRVA(&child);
|
|
|
|
child.SetRVA(&parent);
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 2 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 0), 1 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 1), 0 * sizeof(RVA));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchildren");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestRVAMinidumpWritable parent;
|
|
|
|
TestRVAMinidumpWritable child;
|
|
|
|
parent.SetRVA(&child);
|
|
|
|
parent.AddChild(&child);
|
|
|
|
TestRVAMinidumpWritable grandchild_0;
|
|
|
|
grandchild_0.SetRVA(&child);
|
|
|
|
child.AddChild(&grandchild_0);
|
|
|
|
TestRVAMinidumpWritable grandchild_1;
|
|
|
|
grandchild_1.SetRVA(&child);
|
|
|
|
child.AddChild(&grandchild_1);
|
|
|
|
TestRVAMinidumpWritable grandchild_2;
|
|
|
|
grandchild_2.SetRVA(&child);
|
|
|
|
child.AddChild(&grandchild_2);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 5 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 0), 1 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 1), 0 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 2), 1 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 3), 1 * sizeof(RVA));
|
|
|
|
EXPECT_EQ(RVAAtIndex(string_file.string(), 4), 1 * sizeof(RVA));
|
2014-08-01 12:48:28 -04:00
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class TestLocationDescriptorMinidumpWritable final
|
|
|
|
: public BaseTestMinidumpWritable {
|
|
|
|
public:
|
|
|
|
TestLocationDescriptorMinidumpWritable()
|
|
|
|
: BaseTestMinidumpWritable(), location_descriptor_(), string_() {}
|
|
|
|
|
|
|
|
~TestLocationDescriptorMinidumpWritable() {}
|
|
|
|
|
|
|
|
void SetLocationDescriptor(MinidumpWritable* other) {
|
|
|
|
other->RegisterLocationDescriptor(&location_descriptor_);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetString(const std::string& string) { string_ = string; }
|
|
|
|
|
|
|
|
protected:
|
2014-10-14 11:11:57 -04:00
|
|
|
size_t SizeOfObject() override {
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_GE(state(), kStateFrozen);
|
|
|
|
// NUL-terminate.
|
|
|
|
return sizeof(location_descriptor_) + string_.size() + 1;
|
|
|
|
}
|
|
|
|
|
2014-10-14 11:11:57 -04:00
|
|
|
bool WriteObject(FileWriterInterface* file_writer) override {
|
2014-08-01 12:48:28 -04:00
|
|
|
BaseTestMinidumpWritable::WriteObject(file_writer);
|
|
|
|
WritableIoVec iov;
|
|
|
|
iov.iov_base = &location_descriptor_;
|
|
|
|
iov.iov_len = sizeof(location_descriptor_);
|
|
|
|
std::vector<WritableIoVec> iovecs(1, iov);
|
|
|
|
// NUL-terminate.
|
|
|
|
iov.iov_base = &string_[0];
|
|
|
|
iov.iov_len = string_.size() + 1;
|
|
|
|
iovecs.push_back(iov);
|
|
|
|
EXPECT_TRUE(file_writer->WriteIoVec(&iovecs));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
MINIDUMP_LOCATION_DESCRIPTOR location_descriptor_;
|
|
|
|
std::string string_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TestLocationDescriptorMinidumpWritable);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LocationDescriptorAndData {
|
|
|
|
MINIDUMP_LOCATION_DESCRIPTOR location_descriptor;
|
|
|
|
char string[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
const LocationDescriptorAndData* LDDAtIndex(const std::string& string,
|
|
|
|
size_t index) {
|
|
|
|
return reinterpret_cast<const LocationDescriptorAndData*>(&string[index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(MinidumpWritable, LocationDescriptor) {
|
2015-02-18 14:15:38 -05:00
|
|
|
StringFile string_file;
|
2014-08-01 12:48:28 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("unset");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestLocationDescriptorMinidumpWritable location_descriptor_writable;
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(location_descriptor_writable.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 9u);
|
2015-02-18 14:15:38 -05:00
|
|
|
const LocationDescriptorAndData* ldd = LDDAtIndex(string_file.string(), 0);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 0u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 0u);
|
2014-08-01 12:48:28 -04:00
|
|
|
location_descriptor_writable.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("self");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestLocationDescriptorMinidumpWritable location_descriptor_writable;
|
|
|
|
location_descriptor_writable.SetLocationDescriptor(
|
|
|
|
&location_descriptor_writable);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(location_descriptor_writable.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 9u);
|
2015-02-18 14:15:38 -05:00
|
|
|
const LocationDescriptorAndData* ldd = LDDAtIndex(string_file.string(), 0);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 9u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 0u);
|
2014-08-01 12:48:28 -04:00
|
|
|
location_descriptor_writable.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("self with data");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestLocationDescriptorMinidumpWritable location_descriptor_writable;
|
|
|
|
location_descriptor_writable.SetLocationDescriptor(
|
|
|
|
&location_descriptor_writable);
|
|
|
|
location_descriptor_writable.SetString("zz");
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(location_descriptor_writable.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 11u);
|
2015-02-18 14:15:38 -05:00
|
|
|
const LocationDescriptorAndData* ldd = LDDAtIndex(string_file.string(), 0);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 11u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 0u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("zz", ldd->string);
|
|
|
|
location_descriptor_writable.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("parent-child self");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestLocationDescriptorMinidumpWritable parent;
|
|
|
|
parent.SetLocationDescriptor(&parent);
|
|
|
|
parent.SetString("yy");
|
|
|
|
TestLocationDescriptorMinidumpWritable child;
|
|
|
|
child.SetLocationDescriptor(&child);
|
|
|
|
child.SetString("x");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 22u);
|
2015-02-18 14:15:38 -05:00
|
|
|
const LocationDescriptorAndData* ldd = LDDAtIndex(string_file.string(), 0);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 11u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 0u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("yy", ldd->string);
|
2015-02-18 14:15:38 -05:00
|
|
|
ldd = LDDAtIndex(string_file.string(), 12);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 10u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 12u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("x", ldd->string);
|
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("parent-child only");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestLocationDescriptorMinidumpWritable parent;
|
|
|
|
TestLocationDescriptorMinidumpWritable child;
|
|
|
|
parent.SetLocationDescriptor(&child);
|
|
|
|
parent.SetString("www");
|
|
|
|
child.SetString("vv");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 23u);
|
2015-02-18 14:15:38 -05:00
|
|
|
const LocationDescriptorAndData* ldd = LDDAtIndex(string_file.string(), 0);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 11u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 12u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("www", ldd->string);
|
2015-02-18 14:15:38 -05:00
|
|
|
ldd = LDDAtIndex(string_file.string(), 12);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 0u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 0u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("vv", ldd->string);
|
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("parent-child circular");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestLocationDescriptorMinidumpWritable parent;
|
|
|
|
TestLocationDescriptorMinidumpWritable child;
|
|
|
|
parent.SetLocationDescriptor(&child);
|
|
|
|
parent.SetString("uuuu");
|
|
|
|
child.SetLocationDescriptor(&parent);
|
|
|
|
child.SetString("tttt");
|
|
|
|
parent.AddChild(&child);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 29u);
|
2015-02-18 14:15:38 -05:00
|
|
|
const LocationDescriptorAndData* ldd = LDDAtIndex(string_file.string(), 0);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 13u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 16u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("uuuu", ldd->string);
|
2015-02-18 14:15:38 -05:00
|
|
|
ldd = LDDAtIndex(string_file.string(), 16);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 13u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 0u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("tttt", ldd->string);
|
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_TRACE("grandchildren");
|
2015-02-18 14:15:38 -05:00
|
|
|
string_file.Reset();
|
2014-08-01 12:48:28 -04:00
|
|
|
TestLocationDescriptorMinidumpWritable parent;
|
|
|
|
TestLocationDescriptorMinidumpWritable child;
|
|
|
|
parent.SetLocationDescriptor(&child);
|
|
|
|
parent.SetString("s");
|
|
|
|
parent.AddChild(&child);
|
|
|
|
child.SetString("r");
|
|
|
|
TestLocationDescriptorMinidumpWritable grandchild_0;
|
|
|
|
grandchild_0.SetLocationDescriptor(&child);
|
|
|
|
grandchild_0.SetString("q");
|
|
|
|
child.AddChild(&grandchild_0);
|
|
|
|
TestLocationDescriptorMinidumpWritable grandchild_1;
|
|
|
|
grandchild_1.SetLocationDescriptor(&child);
|
|
|
|
grandchild_1.SetString("p");
|
|
|
|
child.AddChild(&grandchild_1);
|
|
|
|
TestLocationDescriptorMinidumpWritable grandchild_2;
|
|
|
|
grandchild_2.SetLocationDescriptor(&child);
|
|
|
|
grandchild_2.SetString("o");
|
|
|
|
child.AddChild(&grandchild_2);
|
2015-02-18 14:15:38 -05:00
|
|
|
EXPECT_TRUE(parent.WriteEverything(&string_file));
|
2014-08-01 12:48:28 -04:00
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
ASSERT_EQ(string_file.string().size(), 58u);
|
2015-02-18 14:15:38 -05:00
|
|
|
const LocationDescriptorAndData* ldd = LDDAtIndex(string_file.string(), 0);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 10u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 12u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("s", ldd->string);
|
2015-02-18 14:15:38 -05:00
|
|
|
ldd = LDDAtIndex(string_file.string(), 12);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 0u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 0u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("r", ldd->string);
|
2015-02-18 14:15:38 -05:00
|
|
|
ldd = LDDAtIndex(string_file.string(), 24);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 10u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 12u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("q", ldd->string);
|
2015-02-18 14:15:38 -05:00
|
|
|
ldd = LDDAtIndex(string_file.string(), 36);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 10u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 12u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("p", ldd->string);
|
2015-02-18 14:15:38 -05:00
|
|
|
ldd = LDDAtIndex(string_file.string(), 48);
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
EXPECT_EQ(ldd->location_descriptor.DataSize, 10u);
|
|
|
|
EXPECT_EQ(ldd->location_descriptor.Rva, 12u);
|
2014-08-01 12:48:28 -04:00
|
|
|
EXPECT_STREQ("o", ldd->string);
|
|
|
|
parent.Verify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
2014-10-07 17:28:50 -04:00
|
|
|
} // namespace test
|
|
|
|
} // namespace crashpad
|