IpAddressTests.cpp 726 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzNetworking/Utilities/IpAddress.h>
  9. #include <AzCore/UnitTest/TestTypes.h>
  10. namespace UnitTest
  11. {
  12. TEST(IpAddressTests, TestIpQuads)
  13. {
  14. const AzNetworking::IpAddress ip = AzNetworking::IpAddress(127, 0, 0, 1, 12345);
  15. EXPECT_EQ(ip.GetQuadA(), 127);
  16. EXPECT_EQ(ip.GetQuadB(), 0);
  17. EXPECT_EQ(ip.GetQuadC(), 0);
  18. EXPECT_EQ(ip.GetQuadD(), 1);
  19. EXPECT_EQ(ip.GetString(), "127.0.0.1:12345");
  20. EXPECT_EQ(ip.GetIpString(), "127.0.0.1");
  21. }
  22. }