randomTests.cpp 768 B

123456789101112131415161718192021222324252627
  1. /*******************************************************************************
  2. * Copyright (c) 2015, Rockwell Automation, Inc.
  3. * All rights reserved.
  4. *
  5. ******************************************************************************/
  6. #include <CppUTest/TestHarness.h>
  7. #include <stdint.h>
  8. extern "C" {
  9. #include "utils/random.h"
  10. #include "utils/xorshiftrandom.h"
  11. }
  12. TEST_GROUP(RandomClass){
  13. };
  14. TEST(RandomClass, CreateXOrShiftObject) {
  15. Random* random = NULL;
  16. random =
  17. RandomNew(XorShiftSetSeed, XorShiftGetNextUInt16, XorShiftGetNextUInt32);
  18. POINTERS_EQUAL(XorShiftSetSeed, random->set_seed);
  19. POINTERS_EQUAL(XorShiftGetNextUInt16, random->get_next_uint16);
  20. POINTERS_EQUAL(XorShiftGetNextUInt32, random->get_next_uint32);
  21. RandomDelete(&random);
  22. }