1 // Copyright (c) 2013 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 "gpu/config/gpu_control_list.h"
6 #include "testing/gtest/include/gtest/gtest.h"
10 class StringInfoTest
: public testing::Test
{
13 virtual ~StringInfoTest() { }
15 typedef GpuControlList::StringInfo StringInfo
;
18 TEST_F(StringInfoTest
, ValidStringInfo
) {
19 const std::string op
[] = {
25 for (size_t i
= 0; i
< arraysize(op
); ++i
) {
27 StringInfo
info(op
[i
], std::string());
28 EXPECT_TRUE(info
.IsValid());
31 StringInfo
info(op
[i
], "hello");
32 EXPECT_TRUE(info
.IsValid());
37 TEST_F(StringInfoTest
, InvalidStringInfo
) {
38 const std::string op
[] = {
45 for (size_t i
= 0; i
< arraysize(op
); ++i
) {
46 StringInfo
info(op
[i
], "hello");
47 EXPECT_FALSE(info
.IsValid());
51 TEST_F(StringInfoTest
, StringComparison
) {
53 StringInfo
info("contains", "happy");
54 EXPECT_TRUE(info
.Contains("unhappy"));
55 EXPECT_TRUE(info
.Contains("happy1"));
56 EXPECT_TRUE(info
.Contains("happy"));
57 EXPECT_TRUE(info
.Contains("a happy dog"));
58 EXPECT_TRUE(info
.Contains("Happy"));
59 EXPECT_TRUE(info
.Contains("HAPPY"));
60 EXPECT_FALSE(info
.Contains("ha-ppy"));
63 StringInfo
info("beginwith", "happy");
64 EXPECT_FALSE(info
.Contains("unhappy"));
65 EXPECT_TRUE(info
.Contains("happy1"));
66 EXPECT_TRUE(info
.Contains("happy"));
67 EXPECT_FALSE(info
.Contains("a happy dog"));
68 EXPECT_TRUE(info
.Contains("Happy"));
69 EXPECT_TRUE(info
.Contains("HAPPY"));
70 EXPECT_FALSE(info
.Contains("ha-ppy"));
73 StringInfo
info("endwith", "happy");
74 EXPECT_TRUE(info
.Contains("unhappy"));
75 EXPECT_FALSE(info
.Contains("happy1"));
76 EXPECT_TRUE(info
.Contains("happy"));
77 EXPECT_FALSE(info
.Contains("a happy dog"));
78 EXPECT_TRUE(info
.Contains("Happy"));
79 EXPECT_TRUE(info
.Contains("HAPPY"));
80 EXPECT_FALSE(info
.Contains("ha-ppy"));
83 StringInfo
info("=", "happy");
84 EXPECT_FALSE(info
.Contains("unhappy"));
85 EXPECT_FALSE(info
.Contains("happy1"));
86 EXPECT_TRUE(info
.Contains("happy"));
87 EXPECT_FALSE(info
.Contains("a happy dog"));
88 EXPECT_TRUE(info
.Contains("Happy"));
89 EXPECT_TRUE(info
.Contains("HAPPY"));
90 EXPECT_FALSE(info
.Contains("ha-ppy"));
91 EXPECT_FALSE(info
.Contains("ha ppy"));
92 EXPECT_FALSE(info
.Contains(" happy"));
93 EXPECT_FALSE(info
.Contains("happy "));