1*1285115cSWilliam A. Kennington III // Copyright 2021 Google LLC
2*1285115cSWilliam A. Kennington III //
3*1285115cSWilliam A. Kennington III // Licensed under the Apache License, Version 2.0 (the "License");
4*1285115cSWilliam A. Kennington III // you may not use this file except in compliance with the License.
5*1285115cSWilliam A. Kennington III // You may obtain a copy of the License at
6*1285115cSWilliam A. Kennington III //
7*1285115cSWilliam A. Kennington III //      http://www.apache.org/licenses/LICENSE-2.0
8*1285115cSWilliam A. Kennington III //
9*1285115cSWilliam A. Kennington III // Unless required by applicable law or agreed to in writing, software
10*1285115cSWilliam A. Kennington III // distributed under the License is distributed on an "AS IS" BASIS,
11*1285115cSWilliam A. Kennington III // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*1285115cSWilliam A. Kennington III // See the License for the specific language governing permissions and
13*1285115cSWilliam A. Kennington III // limitations under the License.
14*1285115cSWilliam A. Kennington III 
15*1285115cSWilliam A. Kennington III #include "net_iface_mock.h"
16*1285115cSWilliam A. Kennington III 
17*1285115cSWilliam A. Kennington III #include <gtest/gtest.h>
18*1285115cSWilliam A. Kennington III 
19*1285115cSWilliam A. Kennington III TEST(TestIFace, TestGetIndex)
20*1285115cSWilliam A. Kennington III {
21*1285115cSWilliam A. Kennington III     mock::IFace iface_mock;
22*1285115cSWilliam A. Kennington III 
23*1285115cSWilliam A. Kennington III     constexpr int test_index = 5;
24*1285115cSWilliam A. Kennington III     iface_mock.index = test_index;
25*1285115cSWilliam A. Kennington III 
26*1285115cSWilliam A. Kennington III     EXPECT_EQ(test_index, iface_mock.get_index());
27*1285115cSWilliam A. Kennington III }
28*1285115cSWilliam A. Kennington III 
29*1285115cSWilliam A. Kennington III TEST(TestIFace, TestSetClearFlags)
30*1285115cSWilliam A. Kennington III {
31*1285115cSWilliam A. Kennington III     mock::IFace iface_mock;
32*1285115cSWilliam A. Kennington III 
33*1285115cSWilliam A. Kennington III     const short new_flags = 0xab;
34*1285115cSWilliam A. Kennington III     iface_mock.set_sock_flags(0, new_flags);
35*1285115cSWilliam A. Kennington III     EXPECT_EQ(new_flags, new_flags & iface_mock.flags);
36*1285115cSWilliam A. Kennington III     iface_mock.clear_sock_flags(0, 0xa0);
37*1285115cSWilliam A. Kennington III     EXPECT_EQ(0xb, new_flags & iface_mock.flags);
38*1285115cSWilliam A. Kennington III }
39