Brandon Kim | dab96f1 | 2021-02-18 11:21:37 -0800 | [diff] [blame] | 1 | // 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 III | 7d6fa42 | 2021-02-08 17:04:02 -0800 | [diff] [blame] | 15 | #include "net_iface_mock.h" |
| 16 | |
Willy Tu | adb8ffe | 2023-07-17 13:44:22 -0700 | [diff] [blame] | 17 | #include <memory> |
| 18 | |
| 19 | #include "gtest/gtest.h" |
William A. Kennington III | 7d6fa42 | 2021-02-08 17:04:02 -0800 | [diff] [blame] | 20 | #include <gtest/gtest.h> |
| 21 | |
| 22 | TEST(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 | |
| 32 | TEST(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 | } |