Greg Steiert / pegasus_dev

Dependents:   blinky_max32630fthr

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers randlibtest.cpp Source File

randlibtest.cpp

00001 /*
00002  * Copyright (c) 2016 ARM. All rights reserved.
00003  */
00004 #include "CppUTest/TestHarness.h"
00005 #include "../randlib/test_randlib.h"
00006 #include "randLIB.h"
00007 
00008 TEST_GROUP(randLIB_linux)
00009 {
00010     void setup()
00011     {
00012     }
00013 
00014     void teardown()
00015     {
00016     }
00017 };
00018 
00019 extern bool allow_open;
00020 
00021 TEST(randLIB_linux, test_randLIB_seed_random)
00022 {
00023     allow_open = true;
00024     CHECK(test_randLIB_seed_random());
00025 }
00026 
00027 TEST(randLIB_linux, test_randLIB_get_8bit)
00028 {
00029     allow_open = true;
00030     CHECK(test_randLIB_get_8bit());
00031 }
00032 
00033 TEST(randLIB_linux, test_randLIB_get_16bit)
00034 {
00035     allow_open = true;
00036     CHECK(test_randLIB_get_16bit());
00037 }
00038 
00039 TEST(randLIB_linux, test_randLIB_get_32bit)
00040 {
00041     allow_open = true;
00042     CHECK(test_randLIB_get_32bit());
00043 }
00044 
00045 TEST(randLIB_linux, test_randLIB_get_n_bytes_random)
00046 {
00047     allow_open = true;
00048     CHECK(test_randLIB_get_n_bytes_random());
00049 }
00050 
00051 TEST(randLIB_linux, test_randLIB_get_random_in_range)
00052 {
00053     allow_open = true;
00054     CHECK(test_randLIB_get_random_in_range());
00055 }
00056 
00057 TEST(randLIB_linux, test_randLIB_randomise_base)
00058 {
00059     allow_open = true;
00060     CHECK(test_randLIB_randomise_base());
00061 }
00062 
00063 TEST(randLIB_linux, test_fail_to_open)
00064 {
00065     uint8_t buf[4];
00066     allow_open = false;
00067     CHECK(-1 == randLIB_get_n_bytes_random(buf, 4));
00068     allow_open = true;
00069 }