Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KiT-RT
KiT-RT
Commits
d4b1f55a
Commit
d4b1f55a
authored
Nov 20, 2020
by
Steffen Schotthöfer
Browse files
logger validation test added fixed
parent
13a79b12
Pipeline
#118823
failed with stage
in 12 minutes and 42 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
code/input/exampleMN.cfg
View file @
d4b1f55a
...
...
@@ -62,7 +62,7 @@ QUAD_ORDER = 8
% ----- Output ----
%
VOLUME_OUTPUT = (ANALYTIC, MINIMAL, MOMENTS, DUAL_MOMENTS)
VOLUME_OUTPUT_FREQUENCY =
3
VOLUME_OUTPUT_FREQUENCY =
0
SCREEN_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
SCREEN_OUTPUT_FREQUENCY = 1
HISTORY_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
...
...
code/tests/input/validate_logger.cfg
0 → 100644
View file @
d4b1f55a
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Validate Screen Output Test %
% Author <Steffen Schotthöfer> %
% Date 20.11.2020 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ---- File specifications ----
OUTPUT_DIR = ../../result
OUTPUT_FILE = validate_screen_output
LOG_DIR = ../../result/logs
LOG_FILE = validate_logger_output
MESH_FILE = linesource.su2
%
% ---- Problem specifications ----
%
PROBLEM = LINESOURCE
SCATTER_COEFF = 1
%
% ---- Solver specifications ----
%
SOLVER = SN_SOLVER
CFL_NUMBER = 0.7
TIME_FINAL = 0.2
%
% ---- Boundary Conditions ----
%
BC_NEUMANN = ( void )
QUAD_TYPE = LEBEDEV
QUAD_ORDER = 15
%
% ----- Output ----
%
VOLUME_OUTPUT = ( MINIMAL)
VOLUME_OUTPUT_FREQUENCY = 0
SCREEN_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
SCREEN_OUTPUT_FREQUENCY = 1
HISTORY_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
HISTORY_OUTPUT_FREQUENCY = 1
code/tests/input/validate_logger_csv_reference
0 → 100644
View file @
d4b1f55a
2020-11-20 11:48:45.266053 , Iter,Mass,RMS_flux,VTK_out,CSV_out
2020-11-20 11:48:45.266297 , 0.000000,1.815994,51.851194,0.000000,1.000000
2020-11-20 11:48:45.266515 , 1.000000,1.815994,23.856349,1.000000,1.000000
code/tests/test_cases.cpp
View file @
d4b1f55a
...
...
@@ -164,19 +164,35 @@ TEST_CASE( "linesource_MN", "[validation_tests]" ) {
}
// --- Validation Tests Output ---
void
tokenize
(
std
::
string
const
&
str
,
const
char
delim
,
std
::
vector
<
std
::
string
>&
out
)
{
size_t
start
;
size_t
end
=
0
;
while
(
(
start
=
str
.
find_first_not_of
(
delim
,
end
)
)
!=
std
::
string
::
npos
)
{
end
=
str
.
find
(
delim
,
start
);
out
.
push_back
(
str
.
substr
(
start
,
end
-
start
)
);
}
}
TEST_CASE
(
"screen_output"
,
"[output]"
)
{
spdlog
::
drop_all
();
// Make sure to write in own logging file
std
::
string
config_file_name
=
std
::
string
(
TESTS_PATH
)
+
"input/validate_logger.cfg"
;
std
::
string
screenLoggerReference
=
std
::
string
(
TESTS_PATH
)
+
"input/validate_
screen_output
_reference"
;
std
::
string
screenLogger
=
std
::
string
(
TESTS_PATH
)
+
"../result/logs/validate_
screen
_output"
;
std
::
string
historyLoggerReference
=
std
::
string
(
TESTS_PATH
)
+
"input/validate_
screen_output
_csv_reference"
;
std
::
string
historyLogger
=
std
::
string
(
TESTS_PATH
)
+
"../result/logs/validate_
screen
_output_csv"
;
std
::
string
screenLoggerReference
=
std
::
string
(
TESTS_PATH
)
+
"input/validate_
logger
_reference"
;
std
::
string
screenLogger
=
std
::
string
(
TESTS_PATH
)
+
"../result/logs/validate_
logger
_output"
;
std
::
string
historyLoggerReference
=
std
::
string
(
TESTS_PATH
)
+
"input/validate_
logger
_csv_reference"
;
std
::
string
historyLogger
=
std
::
string
(
TESTS_PATH
)
+
"../result/logs/validate_
logger
_output_csv"
;
Config
*
config
=
new
Config
(
config_file_name
);
Solver
*
solver
=
Solver
::
Create
(
config
);
solver
->
Solve
();
// Force Logger to flush
auto
log
=
spdlog
::
get
(
"event"
);
auto
logCSV
=
spdlog
::
get
(
"tabular"
);
log
->
flush
();
logCSV
->
flush
();
// --- Read and validate logger ---
std
::
ifstream
screenLoggerReferenceStream
(
screenLoggerReference
);
std
::
ifstream
screenLoggerStream
(
screenLogger
);
...
...
@@ -185,28 +201,56 @@ TEST_CASE( "screen_output", "[output]" ) {
std
::
string
line
,
lineRef
;
bool
lineValid
;
const
char
delimScreen
=
'|'
;
const
char
delimHist
=
','
;
// --- Screen Logger
while
(
!
screenLoggerReferenceStream
.
eof
()
&&
!
screenLoggerStream
.
eof
()
)
{
std
::
getline
(
screenLoggerReferenceStream
,
lineRef
);
std
::
getline
(
screenLoggerStream
,
line
);
lineValid
=
lineRef
.
compare
(
line
)
==
0
;
// ignore date (before first "|")
std
::
vector
<
std
::
string
>
out
;
std
::
vector
<
std
::
string
>
outRef
;
tokenize
(
line
,
delimScreen
,
out
);
tokenize
(
lineRef
,
delimScreen
,
outRef
);
REQUIRE
(
out
.
size
()
==
outRef
.
size
()
);
// Sanity check
for
(
unsigned
idx_token
=
1
;
idx_token
<
out
.
size
();
idx_token
++
)
{
// Skip date ==> start from 1
lineValid
=
outRef
[
idx_token
].
compare
(
out
[
idx_token
]
)
==
0
;
if
(
!
lineValid
)
{
std
::
cout
<<
lineRef
<<
"
\n
"
<<
line
<<
"
\n
"
;
}
REQUIRE
(
lineValid
);
}
}
bool
eqLen
=
screenLoggerReferenceStream
.
eof
()
&&
screenLoggerStream
.
eof
();
if
(
!
eqLen
)
{
std
::
cout
<<
"Files of unequal length!
\n
"
;
}
REQUIRE
(
eqLen
);
// Files must be of same length
// --- History Logger
while
(
!
historyLoggerReferenceStream
.
eof
()
&&
!
historyLoggerStream
.
eof
()
)
{
std
::
getline
(
historyLoggerReferenceStream
,
lineRef
);
std
::
getline
(
historyLoggerStream
,
line
);
lineValid
=
lineRef
.
compare
(
line
)
==
0
;
// ignore date (before first "|")
std
::
vector
<
std
::
string
>
out
;
std
::
vector
<
std
::
string
>
outRef
;
tokenize
(
line
,
delimHist
,
out
);
tokenize
(
lineRef
,
delimHist
,
outRef
);
REQUIRE
(
out
.
size
()
==
outRef
.
size
()
);
// sanity check
for
(
unsigned
idx_token
=
1
;
idx_token
<
out
.
size
();
idx_token
++
)
{
// Skip date ==> start from 1
lineValid
=
outRef
[
idx_token
].
compare
(
out
[
idx_token
]
)
==
0
;
if
(
!
lineValid
)
{
std
::
cout
<<
lineRef
<<
"
\n
"
<<
line
<<
"
\n
"
;
}
REQUIRE
(
lineValid
);
}
}
eqLen
=
historyLoggerReferenceStream
.
eof
()
&&
historyLoggerStream
.
eof
();
if
(
!
eqLen
)
{
std
::
cout
<<
"Files of unequal length!
\n
"
;
...
...
jannick.wolters
@jm2154
mentioned in commit
951955ae
·
Apr 30, 2021
mentioned in commit
951955ae
mentioned in commit 951955aea9ade314347b0594f3563ae43be91d98
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment