Scarab
v2.4.9
Project 8 C++ Utility Library
library
test
test_param_value.cc
Go to the documentation of this file.
1
/*
2
* test_param_value.cc
3
*
4
* Created on: Jul 13, 2018
5
* Author: N.S. Oblath
6
*
7
* Output should be something like this:
8
*
9
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(18): Bool Value Tests
10
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(21): Bool value via string: true
11
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(23): Int Value Tests
12
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(27): Int value via int: 5
13
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(28): Int value via string: 5
14
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(30): String Value Tests
15
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(32): String value: hello world
16
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(35): String containing a number via as_int: 10
17
2018-07-13 15:25:14 [ INFO] (tid 0x7fff9c9dc380) t_param_value.cc(38): String containing a bool via as_bool: 1
18
*
19
*/
20
21
#include "
param_value.hh
"
22
23
#include "
logger.hh
"
24
25
LOGGER
( testlog,
"test_param_value"
)
26
27
using namespace
scarab
;
28
29
int
main
()
30
{
31
LINFO
( testlog,
"Bool Value Tests"
);
32
param_value
bool_val(
true
);
33
34
LINFO
( testlog,
"Bool value via string: "
<< bool_val );
35
36
LINFO
( testlog,
"Int Value Tests"
);
37
param_value
int_val( 5 );
38
int
val_out = int_val.
as_int
();
39
40
LINFO
( testlog,
"Int value via int: "
<< val_out );
41
LINFO
( testlog,
"Int value via string: "
<< int_val );
42
43
LINFO
( testlog,
"String Value Tests"
);
44
param_value
string_val(
"hello world"
);
45
LINFO
( testlog,
"String value: "
<< string_val );
46
47
string_val.
set
(
"10"
);
48
LINFO
( testlog,
"String containing a number via as_int: "
<< string_val.
as_int
() );
49
50
string_val.
set
(
"true"
);
51
LINFO
( testlog,
"String containing a bool via as_bool: "
<< string_val.
as_bool
() );
52
53
return
0;
54
}
scarab::param_value::as_int
int64_t as_int() const
Definition:
param_value.hh:468
main
int main()
Definition:
test_param_value.cc:29
LOGGER
#define LOGGER(I, K)
Definition:
logger.hh:355
scarab
Definition:
authentication.cc:18
logger.hh
Contains the logger class and macros, based on Kasper's KLogger class.
scarab::param_value::as_bool
bool as_bool() const
Definition:
param_value.hh:458
param_value.hh
LINFO
#define LINFO(...)
Definition:
logger.hh:367
scarab::param_value::set
void set(XValType a_value)
Definition:
param_value.hh:489
scarab::param_value
Definition:
param_value.hh:27
Generated by
1.8.13