socket_timer_tests.cpp 750 B

12345678910111213141516171819202122232425262728293031
  1. /*******************************************************************************
  2. * Copyright (c) 2016, Rockwell Automation, Inc.
  3. * All rights reserved.
  4. *
  5. ******************************************************************************/
  6. #include <CppUTest/TestHarness.h>
  7. #include <stdint.h>
  8. #include <string.h>
  9. extern "C" {
  10. #include "socket_timer.h"
  11. }
  12. TEST_GROUP(SocketTimer) {
  13. };
  14. TEST(SocketTimer, GetAvailableEmptySocketTimer) {
  15. SocketTimer timers[10];
  16. SocketTimerArrayInitialize(timers, 10);
  17. POINTERS_EQUAL( &timers[0], GetEmptySocketTimer(timers, 10) );
  18. }
  19. TEST(SocketTimer, NoEmptySocketTimerAvailable) {
  20. SocketTimer timers[10];
  21. memset( timers, 0, sizeof(timers) );
  22. POINTERS_EQUAL( NULL, GetEmptySocketTimer(timers, 10) );
  23. }