F´ Flight Software - C/C++ Documentation
NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
Utils.cpp
Go to the documentation of this file.
1
// ======================================================================
2
// \title Utils.cpp
3
// \author T. Chieu
4
// \brief cpp file for Utils class
5
//
6
// \copyright
7
// Copyright (C) 2009-2022 California Institute of Technology.
8
// ALL RIGHTS RESERVED. United States Government Sponsorship
9
// acknowledged.
10
//
11
// ======================================================================
12
13
#include "STest/Pick/Pick.hpp"
14
15
#include <string>
16
#include <limits>
17
#include <iostream>
18
19
namespace
FppTest
{
20
21
namespace
Utils
{
22
23
U8
getNonzeroU8
() {
24
return
static_cast<
U8
>
(STest::Pick::lowerUpper(
25
1,
26
std::numeric_limits<U8>::max()
27
));
28
}
29
30
U32
getNonzeroU32
() {
31
return
STest::Pick::lowerUpper(
32
1,
33
std::numeric_limits<U32>::max()
34
);
35
}
36
37
char
getChar
() {
38
return
static_cast<
char
>
(STest::Pick::lowerUpper(32, 127));
39
}
40
41
void
setString
(
char
* buf, U32 size) {
42
U32 length = STest::Pick::lowerUpper(1, size);
43
44
if
(length == 0) {
45
buf[0] = 0;
46
return
;
47
}
48
49
for
(U32 i = 0; i < length - 1; i++) {
50
buf[i] =
getChar
();
51
}
52
53
buf[length-1] = 0;
54
}
55
56
}
// namespace Utils
57
58
}
// namespace FppTest
U8
uint8_t U8
8-bit unsigned integer
Definition
BasicTypes.h:26
FppTest::Utils::setString
void setString(char *buf, U32 size)
Definition
Utils.cpp:41
FppTest::Utils::getNonzeroU32
U32 getNonzeroU32()
Definition
Utils.cpp:30
FppTest::Utils::getChar
char getChar()
Definition
Utils.cpp:37
FppTest::Utils::getNonzeroU8
U8 getNonzeroU8()
Definition
Utils.cpp:23
FppTest
Definition
FormalParamTypes.cpp:18
Utils
Definition
CRCChecker.cpp:20
FppTest
utils
Utils.cpp
Generated by
1.10.0