Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
9f63f413
Commit
9f63f413
authored
Jan 12, 2019
by
thomas.forbriger
Browse files
libpsdxx [WP]: provide test for LogIndex
parent
7ea94bac
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/libpsdxx/Makefile
View file @
9f63f413
...
...
@@ -70,13 +70,14 @@ $(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)
# ======================================================================
#
LIBHEADERS
=
debug.h error.h function_template_log_sampling.h psd.h
LIBHEADERS
=
debug.h error.h function_template_log_sampling.h psd.h
helper.h
LIBCCSRC
=
dpsdcomputer_coherency.cc dpsdcomputer_cross_psd.cc
\
dpsdcomputer_parameters.cc dpsdcomputer_processor.cc
\
dpsdcomputer_psd.cc error.cc function_abs.cc function_arg.cc
\
function_lin_frequency.cc function_log_frequency.cc
\
function_log_sampling_c.cc function_log_sampling_r.cc
function_log_sampling_c.cc function_log_sampling_r.cc
\
log_index.cc log_taper.cc
INCINSTALLPATH
=
$(LOCINCLUDEDIR)
/psdxx
LIBINSTALLPATH
=
$(LOCLIBDIR)
...
...
src/libs/libpsdxx/testpsdxx.cc
View file @
9f63f413
...
...
@@ -21,6 +21,7 @@
#include
<iostream>
#include
<tfxx/commandline.h>
#include
<psdxx/psd.h>
#include
<psdxx/helper.h>
#include
<aff/dump.h>
using
std
::
cout
;
...
...
@@ -29,9 +30,22 @@ using std::endl;
struct
Options
{
bool
verbose
,
logfrequency
;
bool
verbose
,
logfrequency
,
logindex
;
};
// Options
/* ====================================================================== */
void
testlogindex
(
const
psd
::
TDseries
::
Tcoc
&
f
,
const
int
&
i
)
{
CODE
(
psd
::
helper
::
LogIndex
li
(
f
(
i
),
f
(
i
+
1
),
f
(
i
+
2
))
);
for
(
int
i
=
f
.
f
();
i
<=
f
.
l
();
++
i
)
{
cout
<<
"i= "
<<
i
<<
" index(f(i))="
<<
li
(
f
(
i
))
<<
endl
;
}
}
/* ====================================================================== */
int
main
(
int
iargc
,
char
*
argv
[])
{
...
...
@@ -39,7 +53,7 @@ int main(int iargc, char* argv[])
char
usage_text
[]
=
{
TESTPSDXX_VERSION
"
\n
"
"usage: testpsdxx [-lf]"
"
\n
"
"usage: testpsdxx [-lf]
[-li]
"
"
\n
"
" or: testpsdxx --help|-h"
"
\n
"
};
...
...
@@ -57,8 +71,10 @@ int main(int iargc, char* argv[])
{
"help"
,
arg_no
,
"-"
},
// 1: verbose mode
{
"v"
,
arg_no
,
"-"
},
// 2:
verbose mode
// 2:
log frequency
{
"lf"
,
arg_no
,
"-"
},
// 3: log index
{
"li"
,
arg_no
,
"-"
},
{
NULL
}
};
...
...
@@ -83,6 +99,7 @@ int main(int iargc, char* argv[])
Options
opt
;
opt
.
verbose
=
cmdline
.
optset
(
1
);
opt
.
logfrequency
=
cmdline
.
optset
(
2
);
opt
.
logindex
=
cmdline
.
optset
(
3
);
if
(
opt
.
logfrequency
)
{
...
...
@@ -110,6 +127,15 @@ int main(int iargc, char* argv[])
std
::
log
((
ls1
(
i
)
-
fref
)
/
(
fref1
-
fref
))
/
std
::
log
(
10.
)
<<
endl
;
}
}
// if (opt.logfrequency)
if
(
opt
.
logindex
)
{
cout
<<
"test class LogIndex"
<<
endl
;
CODE
(
psd
::
TDseries
ls1
=
psd
::
log_frequency
(
0.1
,
1000
,
6
)
);
DUMP
(
ls1
);
testlogindex
(
ls1
,
0
);
testlogindex
(
ls1
,
3
);
}
// if (opt.logindex)
}
/* ----- END OF testpsdxx.cc ----- */
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment