Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixMath
Commits
41bb7841
Commit
41bb7841
authored
Dec 20, 2020
by
Pierre Aubert
Browse files
Add test
parent
ef2c811b
Pipeline
#96654
passed with stages
in 1 minute and 8 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
4 deletions
+55
-4
TESTS/CMakeLists.txt
TESTS/CMakeLists.txt
+1
-0
TESTS/TEST_MIN_MAX/CMakeLists.txt
TESTS/TEST_MIN_MAX/CMakeLists.txt
+7
-0
TESTS/TEST_MIN_MAX/main.cpp
TESTS/TEST_MIN_MAX/main.cpp
+43
-0
TESTS/TEST_PHISTOGRAM/main.cpp
TESTS/TEST_PHISTOGRAM/main.cpp
+3
-3
src/pMinMax_impl.h
src/pMinMax_impl.h
+1
-1
No files found.
TESTS/CMakeLists.txt
View file @
41bb7841
...
...
@@ -2,4 +2,5 @@ project(Phoenix)
cmake_minimum_required
(
VERSION 2.8
)
add_subdirectory
(
TEST_PHISTOGRAM
)
add_subdirectory
(
TEST_MIN_MAX
)
TESTS/TEST_MIN_MAX/CMakeLists.txt
0 → 100644
View file @
41bb7841
project
(
Phoenix
)
add_executable
(
test_pmin_max main.cpp
)
add_test
(
NAME TestPMinMax
COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/test_pmin_max
)
TESTS/TEST_MIN_MAX/main.cpp
0 → 100644
View file @
41bb7841
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include "pMinMax.h"
///Test the graph conversion to dot
/** @return true on success, false otherwise
*/
bool
testPMinMax
(){
bool
b
(
true
);
int
tabSingle
[]
=
{
1
};
b
&=
pminTab
(
tabSingle
,
1lu
)
==
1
;
b
&=
pminTabPos
(
tabSingle
,
1lu
)
==
0lu
;
b
&=
pmaxTab
(
tabSingle
,
1lu
)
==
1
;
b
&=
pmaxTabPos
(
tabSingle
,
1lu
)
==
0lu
;
size_t
nbValue
(
15lu
);
int
tabValue
[]
=
{
1
,
4
,
6
,
3
,
6
,
6
,
7
,
0
,
4
,
3
,
7
,
5
,
3
,
5
,
6
};
b
&=
pminTab
(
tabValue
,
nbValue
)
==
0
;
b
&=
pminTabPos
(
tabValue
,
nbValue
)
==
7lu
;
b
&=
pmaxTab
(
tabValue
,
nbValue
)
==
7
;
b
&=
pmaxTabPos
(
tabValue
,
nbValue
)
==
6lu
;
return
b
;
}
int
main
(
int
argc
,
char
**
argv
){
bool
b
(
testPMinMax
());
return
b
-
1
;
}
TESTS/TEST_PHISTOGRAM/main.cpp
View file @
41bb7841
...
...
@@ -15,8 +15,8 @@ bool testPHistogram(){
PHistogram
<
float
>
hist
(
-
1.0
f
,
1.0
f
,
10lu
);
hist
.
reset
();
for
(
size_t
i
(
0lu
);
i
<
100lu
;
++
i
){
hist
.
addValue
((((
float
)(
i
*
27lu
%
19
))
-
9.0
)
/
5
.0
f
);
for
(
size_t
i
(
0lu
);
i
<
100
0
lu
;
++
i
){
hist
.
addValue
((((
float
)(
i
*
27lu
%
19
))
-
9.0
)
/
2
.0
f
);
}
std
::
cout
<<
"testPHistogram : min = "
<<
hist
.
getMin
()
<<
", max = "
<<
hist
.
getMax
()
<<
", range = "
<<
hist
.
getRange
()
<<
", nbValueUnderMin = "
<<
hist
.
getUnderXMin
()
<<
", nbValueUpperMax = "
<<
hist
.
getOverXMax
()
<<
std
::
endl
;
std
::
cout
<<
hist
<<
std
::
endl
;
...
...
@@ -56,7 +56,7 @@ bool testPHistogram2(){
std
::
cout
<<
hist
<<
std
::
endl
;
PHistogram
<
float
>
hist4
;
PHistogram
<
float
>
hist4
(
10lu
)
;
hist4
.
setRange
(
-
1.0
f
,
1.0
f
);
hist4
.
resize
(
20lu
);
for
(
size_t
i
(
0lu
);
i
<
200lu
;
++
i
){
...
...
src/pMinMax_impl.h
View file @
41bb7841
...
...
@@ -219,7 +219,7 @@ void pminmaxTab(T & xmin, T & xmax, const T* tab, size_t size){
for
(
i
=
1
;
i
<
size
;
++
i
){
tmp
=
tab
[
i
];
if
(
tmp
>
xmax
)
xmax
=
tmp
;
else
if
(
tmp
<
xmin
)
xmin
=
tmp
;
else
{
xmin
=
tmp
;
}
}
}
...
...
Write
Preview
Markdown
is supported
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