test_net.cpp 580 B

123456789101112131415161718192021
  1. #include <unity.h>
  2. #include "kbf/net.h"
  3. using namespace kbf;
  4. TEST_CASE("MAC address functions", "[kbf_net]") {
  5. uint8_t addr[] = {0, 0, 11, 128, 176, 255};
  6. auto mac = net::MAC(addr);
  7. TEST_ASSERT_EQUAL_STRING_MESSAGE("00:00:0B:80:B0:FF", mac.str().c_str(), "ctor / str()");
  8. net::setMac(mac);
  9. TEST_ASSERT_EQUAL_STRING_MESSAGE(mac.str().c_str(), net::getMac().str().c_str(), "getMac");
  10. }
  11. TEST_CASE("IP address functions", "[kbf_net]") {
  12. auto ip = net::IP({2952898752});
  13. TEST_ASSERT_EQUAL_STRING_MESSAGE("192.168.1.176", ip.str().c_str(), "str()");
  14. }