11285115cSWilliam A. Kennington III // Copyright 2021 Google LLC 21285115cSWilliam A. Kennington III // 31285115cSWilliam A. Kennington III // Licensed under the Apache License, Version 2.0 (the "License"); 41285115cSWilliam A. Kennington III // you may not use this file except in compliance with the License. 51285115cSWilliam A. Kennington III // You may obtain a copy of the License at 61285115cSWilliam A. Kennington III // 71285115cSWilliam A. Kennington III // http://www.apache.org/licenses/LICENSE-2.0 81285115cSWilliam A. Kennington III // 91285115cSWilliam A. Kennington III // Unless required by applicable law or agreed to in writing, software 101285115cSWilliam A. Kennington III // distributed under the License is distributed on an "AS IS" BASIS, 111285115cSWilliam A. Kennington III // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 121285115cSWilliam A. Kennington III // See the License for the specific language governing permissions and 131285115cSWilliam A. Kennington III // limitations under the License. 141285115cSWilliam A. Kennington III 151285115cSWilliam A. Kennington III #include "net_iface_mock.h" 161285115cSWilliam A. Kennington III 17*adb8ffe4SWilly Tu #include <memory> 18*adb8ffe4SWilly Tu 19*adb8ffe4SWilly Tu #include "gtest/gtest.h" 201285115cSWilliam A. Kennington III #include <gtest/gtest.h> 211285115cSWilliam A. Kennington III 221285115cSWilliam A. Kennington III TEST(TestIFace, TestGetIndex) 231285115cSWilliam A. Kennington III { 241285115cSWilliam A. Kennington III mock::IFace iface_mock; 251285115cSWilliam A. Kennington III 261285115cSWilliam A. Kennington III constexpr int test_index = 5; 271285115cSWilliam A. Kennington III iface_mock.index = test_index; 281285115cSWilliam A. Kennington III 291285115cSWilliam A. Kennington III EXPECT_EQ(test_index, iface_mock.get_index()); 301285115cSWilliam A. Kennington III } 311285115cSWilliam A. Kennington III 321285115cSWilliam A. Kennington III TEST(TestIFace, TestSetClearFlags) 331285115cSWilliam A. Kennington III { 341285115cSWilliam A. Kennington III mock::IFace iface_mock; 351285115cSWilliam A. Kennington III 361285115cSWilliam A. Kennington III const short new_flags = 0xab; 371285115cSWilliam A. Kennington III iface_mock.set_sock_flags(0, new_flags); 381285115cSWilliam A. Kennington III EXPECT_EQ(new_flags, new_flags & iface_mock.flags); 391285115cSWilliam A. Kennington III iface_mock.clear_sock_flags(0, 0xa0); 401285115cSWilliam A. Kennington III EXPECT_EQ(0xb, new_flags & iface_mock.flags); 411285115cSWilliam A. Kennington III } 42