1 : // Copyright 2013 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #include "syzygy/agent/common/dlist.h"
16 :
17 : #include "gtest/gtest.h"
18 :
19 E : TEST(DListTest, IsNodeOnList) {
20 : LIST_ENTRY list;
21 E : InitializeListHead(&list);
22 :
23 : LIST_ENTRY node;
24 E : EXPECT_FALSE(IsNodeOnList(&list, &node));
25 :
26 : LIST_ENTRY tail_node;
27 E : InsertHeadList(&list, &tail_node);
28 E : EXPECT_FALSE(IsNodeOnList(&list, &node));
29 :
30 E : InsertHeadList(&list, &node);
31 E : EXPECT_TRUE(IsNodeOnList(&list, &node));
32 :
33 : LIST_ENTRY head_node;
34 E : InsertHeadList(&list, &head_node);
35 E : EXPECT_TRUE(IsNodeOnList(&list, &node));
36 :
37 E : RemoveEntryList(&node);
38 E : EXPECT_FALSE(IsNodeOnList(&list, &node));
39 E : }
|