1 // Copyright (c) 2011 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.
5 #include "printing/page_range.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 TEST(PageRangeTest
, RangeMerge
) {
9 printing::PageRanges ranges
;
10 printing::PageRange range
;
13 ranges
.push_back(range
);
16 ranges
.push_back(range
);
19 ranges
.push_back(range
);
20 std::vector
<int> pages(printing::PageRange::GetPages(ranges
));
21 ASSERT_EQ(8U, pages
.size());
22 EXPECT_EQ(1, pages
[0]);
23 EXPECT_EQ(2, pages
[1]);
24 EXPECT_EQ(3, pages
[2]);
25 EXPECT_EQ(4, pages
[3]);
26 EXPECT_EQ(5, pages
[4]);
27 EXPECT_EQ(10, pages
[5]);
28 EXPECT_EQ(11, pages
[6]);
29 EXPECT_EQ(12, pages
[7]);
32 TEST(PageRangeTest
, Empty
) {
33 printing::PageRanges ranges
;
34 std::vector
<int> pages(printing::PageRange::GetPages(ranges
));
35 EXPECT_TRUE(pages
.empty());
38 TEST(PageRangeTest
, Huge
) {
39 printing::PageRanges ranges
;
40 printing::PageRange range
;
42 range
.to
= 2000000000;
43 ranges
.push_back(range
);
44 std::vector
<int> pages(printing::PageRange::GetPages(ranges
));
45 EXPECT_FALSE(pages
.empty());