OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/editing/markers/DocumentMarker.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 class DocumentMarkerTest : public ::testing::Test {}; |
| 12 |
| 13 TEST_F(DocumentMarkerTest, MarkerTypeIteratorEmpty) { |
| 14 DocumentMarker::MarkerTypes types(0); |
| 15 EXPECT_TRUE(types.begin() == types.end()); |
| 16 } |
| 17 |
| 18 TEST_F(DocumentMarkerTest, MarkerTypeIteratorOne) { |
| 19 DocumentMarker::MarkerTypes types(DocumentMarker::Spelling); |
| 20 ASSERT_TRUE(types.begin() != types.end()); |
| 21 auto it = types.begin(); |
| 22 EXPECT_EQ(DocumentMarker::Spelling, *it); |
| 23 ++it; |
| 24 EXPECT_TRUE(it == types.end()); |
| 25 } |
| 26 |
| 27 TEST_F(DocumentMarkerTest, MarkerTypeIteratorConsecutive) { |
| 28 DocumentMarker::MarkerTypes types(0b11); // Spelling | Grammar |
| 29 ASSERT_TRUE(types.begin() != types.end()); |
| 30 auto it = types.begin(); |
| 31 EXPECT_EQ(DocumentMarker::Spelling, *it); |
| 32 ++it; |
| 33 EXPECT_EQ(DocumentMarker::Grammar, *it); |
| 34 ++it; |
| 35 EXPECT_TRUE(it == types.end()); |
| 36 } |
| 37 |
| 38 TEST_F(DocumentMarkerTest, MarkerTypeIteratorDistributed) { |
| 39 DocumentMarker::MarkerTypes types(0b101); // Spelling | TextMatch |
| 40 ASSERT_TRUE(types.begin() != types.end()); |
| 41 auto it = types.begin(); |
| 42 EXPECT_EQ(DocumentMarker::Spelling, *it); |
| 43 ++it; |
| 44 EXPECT_EQ(DocumentMarker::TextMatch, *it); |
| 45 ++it; |
| 46 EXPECT_TRUE(it == types.end()); |
| 47 } |
| 48 } |
OLD | NEW |