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 "gpu/config/gpu_util.h"
6 #include "testing/gtest/include/gtest/gtest.h"
10 TEST(GpuUtilTest
, MergeFeatureSets
) {
12 // Merge two empty sets.
15 EXPECT_TRUE(dst
.empty());
16 MergeFeatureSets(&dst
, src
);
17 EXPECT_TRUE(dst
.empty());
20 // Merge an empty set into a set with elements.
24 EXPECT_EQ(1u, dst
.size());
25 MergeFeatureSets(&dst
, src
);
26 EXPECT_EQ(1u, dst
.size());
29 // Merge two sets where the source elements are already in the target set.
34 EXPECT_EQ(1u, dst
.size());
35 MergeFeatureSets(&dst
, src
);
36 EXPECT_EQ(1u, dst
.size());
39 // Merge two sets with different elements.
44 EXPECT_EQ(1u, dst
.size());
45 MergeFeatureSets(&dst
, src
);
46 EXPECT_EQ(2u, dst
.size());
50 TEST(GpuUtilTest
, StringToFeatureSet
) {
53 std::set
<int> features
;
54 StringToFeatureSet("", &features
);
55 EXPECT_EQ(0u, features
.size());
59 std::set
<int> features
;
60 StringToFeatureSet("4", &features
);
61 EXPECT_EQ(1u, features
.size());
65 std::set
<int> features
;
66 StringToFeatureSet("1,9", &features
);
67 EXPECT_EQ(2u, features
.size());