DGtal 1.4.0
Loading...
Searching...
No Matches
testSignal.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/math/Signal.h"
Include dependency graph for testSignal.cpp:

Go to the source code of this file.

Functions

bool testSignal ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5807), University of Savoie, France
Date
2011/07/06

Functions for testing class Signal.

This file is part of the DGtal library.

Definition in file testSignal.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 78 of file testSignal.cpp.

79{
80 trace.beginBlock ( "Testing class Signal" );
81 trace.info() << "Args:";
82 for ( int i = 0; i < argc; ++i )
83 trace.info() << " " << argv[ i ];
84 trace.info() << endl;
85
86 bool res = testSignal();
87 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
89 return res ? 0 : 1;
90}
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Trace trace
Definition Common.h:153
bool testSignal()

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testSignal(), and DGtal::trace.

◆ testSignal()

bool testSignal ( )

Example of a test. To be completed.

Definition at line 46 of file testSignal.cpp.

47{
48 trace.beginBlock ( "Testing block ..." );
49 //double values[ 8 ] = { 1.0, 5.0, 3.0, 4.3, 6.2, 7.1, 5.7, 8.4 };
50 double values[ ] = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
51 Signal<double> signal( values, 8, 2, false, 0.0 );
52 trace.info() << "Unperiodic signal" << endl;
53 trace.info() << signal << endl;
54 for ( unsigned int n = 1; n < 10; ++n )
55 {
57 Signal<double> conv_signal = signal * Gauss;
58 trace.info() << conv_signal << endl;
59 }
60 Signal<double> signal2( values, 8, 2, true, 0.0 );
61 trace.info() << "Periodic signal" << endl;
62 trace.info() << signal2 << endl;
63 for ( unsigned int n = 1; n < 10; ++n )
64 {
66 Signal<double> conv_signal = signal2 * Gauss;
67 trace.info() << conv_signal << endl;
68 }
70
71 return true;
72}
Aim: Represents a discrete signal, periodic or not. The signal can be passed by value since it is onl...
Definition Signal.h:162
static Signal< TValue > G2n(unsigned int n)

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Signal< TValue >::G2n(), DGtal::Trace::info(), and DGtal::trace.

Referenced by main().