This source file includes following definitions.
- TEST
- TEST
#include "gpu/config/gpu_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gpu {
TEST(GpuUtilTest, MergeFeatureSets) {
{
std::set<int> src;
std::set<int> dst;
EXPECT_TRUE(dst.empty());
MergeFeatureSets(&dst, src);
EXPECT_TRUE(dst.empty());
}
{
std::set<int> src;
std::set<int> dst;
dst.insert(1);
EXPECT_EQ(1u, dst.size());
MergeFeatureSets(&dst, src);
EXPECT_EQ(1u, dst.size());
}
{
std::set<int> src;
std::set<int> dst;
src.insert(1);
dst.insert(1);
EXPECT_EQ(1u, dst.size());
MergeFeatureSets(&dst, src);
EXPECT_EQ(1u, dst.size());
}
{
std::set<int> src;
std::set<int> dst;
src.insert(1);
dst.insert(2);
EXPECT_EQ(1u, dst.size());
MergeFeatureSets(&dst, src);
EXPECT_EQ(2u, dst.size());
}
}
TEST(GpuUtilTest, StringToFeatureSet) {
{
std::set<int> features;
StringToFeatureSet("", &features);
EXPECT_EQ(0u, features.size());
}
{
std::set<int> features;
StringToFeatureSet("4", &features);
EXPECT_EQ(1u, features.size());
}
{
std::set<int> features;
StringToFeatureSet("1,9", &features);
EXPECT_EQ(2u, features.size());
}
}
}