Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
8d5e79d3
Commit
8d5e79d3
authored
1 year ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Set up a testing folder
parent
6ba7dd3e
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
build/testing/.gitkeep
+0
-0
0 additions, 0 deletions
build/testing/.gitkeep
src/testing/test_TEDF.cpp
+63
-0
63 additions, 0 deletions
src/testing/test_TEDF.cpp
src/testing/test_TTMS.cpp
+44
-0
44 additions, 0 deletions
src/testing/test_TTMS.cpp
with
108 additions
and
0 deletions
.gitignore
+
1
−
0
View file @
8d5e79d3
build/include
build/cluster/*
build/sphere/*
build/testing/*
build/trapping/*
doc/build/*
src/objects/*
\ No newline at end of file
This diff is collapsed.
Click to expand it.
build/testing/.gitkeep
0 → 100644
+
0
−
0
View file @
8d5e79d3
This diff is collapsed.
Click to expand it.
src/testing/test_TEDF.cpp
0 → 100644
+
63
−
0
View file @
8d5e79d3
//! \file test_TEDF.cpp
#include
<complex>
#include
<cstdio>
#include
<hdf5.h>
#include
<string>
#include
"../include/List.h"
#include
"../include/file_io.h"
#include
"../include/Configuration.h"
using
namespace
std
;
/*! \brief Main program execution body.
*
* This program executes a test to compare whether three configuration
* instances, loaded respectively from an EDFB configuration file, a
* legacy binary, or a HDF5 binary are actually equivalent. The test
* writes a result message to `stdout` then it returns 0 (OS flag for
* a successful process) or some kind of error code, depending on
* whether the test files were found all equal or not. The test accepts
* three command line arguments: the name of the EDFB configuration
* file, the name of the legacy binary file and the name of the HDF5
* binary configuration file.
*
* \param argc: `int` Number of command line arguments
* \param argv: `char **` Array of command argument character strings.
* \return result: `int` Can be: 0 (all files equal); 1 (EDFB and
* legacy binary are different); 10 (EDFB and HDF5 are different);
* 100 (legacy and HDF5 are different). In case more differences are
* found, the error codes sum up together (e.g. 111 means all files
* are different).
*/
int
main
(
int
argc
,
char
**
argv
)
{
int
result
=
0
;
string
dedfb_file
=
"DEDFB"
;
string
legacy_file
=
"c_TEDF"
;
string
hdf5_file
=
"c_TEDF.hd5"
;
if
(
argc
==
4
)
{
dedfb_file
=
string
(
argv
[
1
]);
legacy_file
=
string
(
argv
[
2
]);
hdf5_file
=
string
(
argv
[
3
]);
}
ScattererConfiguration
*
a
,
*
b
,
*
c
;
a
=
ScattererConfiguration
::
from_dedfb
(
dedfb_file
);
b
=
ScattererConfiguration
::
from_binary
(
legacy_file
);
c
=
ScattererConfiguration
::
from_binary
(
hdf5_file
,
"HDF5"
);
if
(
*
a
==
*
b
)
printf
(
"Configuration objects a and b are equal.
\n
"
);
else
{
printf
(
"Configuration objects a and b are different.
\n
"
);
result
+=
1
;
}
if
(
*
a
==
*
c
)
printf
(
"Configuration objects a and c are equal.
\n
"
);
else
{
printf
(
"Configuration objects a and c are different.
\n
"
);
result
+=
10
;
}
if
(
*
c
==
*
b
)
printf
(
"Configuration objects c and b are equal.
\n
"
);
else
{
printf
(
"Configuration objects c and b are different.
\n
"
);
result
+=
100
;
}
return
0
;
}
This diff is collapsed.
Click to expand it.
src/testing/test_TTMS.cpp
0 → 100644
+
44
−
0
View file @
8d5e79d3
//! \file test_TTMS.cpp
#include
<complex>
#include
<cstdio>
#include
<hdf5.h>
#include
<string>
#include
"../include/List.h"
#include
"../include/file_io.h"
#include
"../include/TransitionMatrix.h"
using
namespace
std
;
/*! \brief Main program execution body.
*
* This program executes a test to compare whether two transition
* matrix instances, loaded respectively from a legacy and a HDF5
* binary file are actually equivalent. The test writes a result
* message to `stdout` then it returns 0 (OS flag for a successful
* process) or 1 (OS flag for failing process) depending on whether
* the two instances were considered equivalent or not.
*
* \param argc: `int` Number of command line arguments
* \param argv: `char **` Array of command argument character strings.
* \return result: `int` Can be 0 (files are equal) or 1 (files are
* different).
*/
int
main
(
int
argc
,
char
**
argv
)
{
int
result
=
0
;
TransitionMatrix
*
a
,
*
b
;
string
legacy_file
=
"c_TTMS"
;
string
hdf5_file
=
"c_TTMS.hd5"
;
if
(
argc
==
3
)
{
legacy_file
=
string
(
argv
[
1
]);
hdf5_file
=
string
(
argv
[
2
]);
}
a
=
TransitionMatrix
::
from_binary
(
legacy_file
);
b
=
TransitionMatrix
::
from_binary
(
hdf5_file
,
"HDF5"
);
if
(
*
a
==
*
b
)
printf
(
"Transition matrixes a and b are equal.
\n
"
);
else
{
printf
(
"Transition matrixes a and b are different.
\n
"
);
result
=
1
;
}
return
result
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment