??????????β????????
???????????? ???????[ 2015/5/5 14:02:03 ] ???????????????
???????????
????????????????C++???????????????????????????gtest???е???????????????????????????????????????????
???????????????????????е????????????????????м???????????????????????н??в????????????????y??в????
??????????????????????????費??????е???????????????д?????????????????????????????????????????????????????б?????в?????
??????????β?????????????
????????????????????ζ?????????????в????
???????????????
// ???t?????????????????
template <typename E>
class Queue
{
public:
Queue() {}
void Enqueue(const E& element) {}
E* Dequeue() {}
size_t size() const
{
return (size_t)123;
}
};
??????????gtest????ζ??????в??????
????1???????????????????????????
????code
????// ???????
????template <class T>
????Queue<T>* CreateQueue();
????// ?????汾1
????template <>
????Queue<int>* CreateQueue<int>()
????{
????return new Queue<int>;
????}
????// ?????汾2
????template <>
????Queue<char>* CreateQueue<char>()
????{
????return new Queue<char>;
????}
????2????д??????
????code
????template <class T>
????class QueueTest : public testing::Test
????{
????protected:
????QueueTest() : queue(CreateQueue<T>())
????{}
????virtual ~QueueTest()
????{
????delete queue;
????}
????Queue<T>* const queue;
????};
????3??????????????????
????code
????typedef testing::Types<int?? char> Impls;
????4????д????????
????code
????TYPED_TEST_CASE(QueueTest?? Impls);
????TYPED_TEST(QueueTest?? DefaultCons)
????{
????EXPECT_EQ(123?? this->queue->size());
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11