blob: 2ae340afebf661af6b9744cebe7bbebcd6a503de [file] [log] [blame]
Brandon Kimdab96f12021-02-18 11:21:37 -08001// Copyright 2021 Google LLC
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
William A. Kennington III7d6fa422021-02-08 17:04:02 -080015#include "net_iface_mock.h"
16
Willy Tuadb8ffe2023-07-17 13:44:22 -070017#include <memory>
18
19#include "gtest/gtest.h"
William A. Kennington III7d6fa422021-02-08 17:04:02 -080020#include <gtest/gtest.h>
21
22TEST(TestIFace, TestGetIndex)
23{
24 mock::IFace iface_mock;
25
26 constexpr int test_index = 5;
27 iface_mock.index = test_index;
28
29 EXPECT_EQ(test_index, iface_mock.get_index());
30}
31
32TEST(TestIFace, TestSetClearFlags)
33{
34 mock::IFace iface_mock;
35
36 const short new_flags = 0xab;
37 iface_mock.set_sock_flags(0, new_flags);
38 EXPECT_EQ(new_flags, new_flags & iface_mock.flags);
39 iface_mock.clear_sock_flags(0, 0xa0);
40 EXPECT_EQ(0xb, new_flags & iface_mock.flags);
41}