| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 EXPECT_TRUE(writer.string().empty()); | 355 EXPECT_TRUE(writer.string().empty()); |
| 356 | 356 |
| 357 static_assert(SEEK_SET != 3 && SEEK_CUR != 3 && SEEK_END != 3, | 357 static_assert(SEEK_SET != 3 && SEEK_CUR != 3 && SEEK_END != 3, |
| 358 "3 must be invalid for whence"); | 358 "3 must be invalid for whence"); |
| 359 EXPECT_LT(writer.Seek(0, 3), 0); | 359 EXPECT_LT(writer.Seek(0, 3), 0); |
| 360 | 360 |
| 361 writer.Reset(); | 361 writer.Reset(); |
| 362 EXPECT_EQ(0, writer.Seek(0, SEEK_CUR)); | 362 EXPECT_EQ(0, writer.Seek(0, SEEK_CUR)); |
| 363 EXPECT_TRUE(writer.string().empty()); | 363 EXPECT_TRUE(writer.string().empty()); |
| 364 | 364 |
| 365 const off_t kMaxOffset = | 365 const off_t kMaxOffset = static_cast<off_t>( |
| 366 std::min(implicit_cast<uint64_t>(std::numeric_limits<off_t>::max()), | 366 std::min(implicit_cast<uint64_t>(std::numeric_limits<off_t>::max()), |
| 367 implicit_cast<uint64_t>(std::numeric_limits<size_t>::max())); | 367 implicit_cast<uint64_t>(std::numeric_limits<size_t>::max()))); |
| 368 | 368 |
| 369 EXPECT_EQ(kMaxOffset, writer.Seek(kMaxOffset, SEEK_SET)); | 369 EXPECT_EQ(kMaxOffset, writer.Seek(kMaxOffset, SEEK_SET)); |
| 370 EXPECT_EQ(kMaxOffset, writer.Seek(0, SEEK_CUR)); | 370 EXPECT_EQ(kMaxOffset, writer.Seek(0, SEEK_CUR)); |
| 371 EXPECT_LT(writer.Seek(1, SEEK_CUR), 0); | 371 EXPECT_LT(writer.Seek(1, SEEK_CUR), 0); |
| 372 | 372 |
| 373 EXPECT_EQ(1, writer.Seek(1, SEEK_SET)); | 373 EXPECT_EQ(1, writer.Seek(1, SEEK_SET)); |
| 374 EXPECT_EQ(1, writer.Seek(0, SEEK_CUR)); | 374 EXPECT_EQ(1, writer.Seek(0, SEEK_CUR)); |
| 375 EXPECT_LT(writer.Seek(kMaxOffset, SEEK_CUR), 0); | 375 EXPECT_LT(writer.Seek(kMaxOffset, SEEK_CUR), 0); |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace | 378 } // namespace |
| 379 } // namespace test | 379 } // namespace test |
| 380 } // namespace crashpad | 380 } // namespace crashpad |
| OLD | NEW |