source: trunk/external-alma/components/SpectralComponents/test/tLorentzianSpectralElement.cc @ 2980

Last change on this file since 2980 was 2980, checked in by Malte Marquarding, 10 years ago

Add a copy of casacore/components/SpectralComponents to external-alma directory to prepare for its removal from casacore-trunk. DOn;t activate in SConscript yet.

File size: 2.3 KB
Line 
1//# tProfileFit1D.cc: test the ProfileFit1D class
2//# Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2004
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This program is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU General Public License as published by the Free
7//# Software Foundation; either version 2 of the License, or (at your option)
8//# any later version.
9//#
10//# This program is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13//# more details.
14//#
15//# You should have received a copy of the GNU General Public License along
16//# with this program; if not, write to the Free Software Foundation, Inc.,
17//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//#        Internet email: aips2-request@nrao.edu.
21//#        Postal address: AIPS++ Project Office
22//#                        National Radio Astronomy Observatory
23//#                        520 Edgemont Road
24//#                        Charlottesville, VA 22903-2475 USA
25//#
26
27#include <casa/aips.h>
28#include <casa/Arrays/ArrayMath.h>
29#include <casa/Containers/Record.h>
30#include <casa/Utilities/PtrHolder.h>
31#include <components/SpectralComponents/LorentzianSpectralElement.h>
32#include <components/SpectralComponents/SpectralElementFactory.h>
33
34#include <casa/Utilities/Assert.h>
35#include <casa/Arrays/ArrayIO.h>
36
37#include <casa/Arrays/Vector.h>
38
39#include <casa/iostream.h>
40
41#include <casa/namespace.h>
42
43
44int main() {
45        {
46                cout << "Test constructor" << endl;
47                Double amp = 5.5;
48                Double center = 2.2;
49                Double fwhm = 3.3;
50                LorentzianSpectralElement lse(amp, center, fwhm);
51                AlwaysAssert(lse.getAmpl() == amp, AipsError);
52                AlwaysAssert(lse.getCenter() == center, AipsError);
53                AlwaysAssert(lse.getFWHM() == fwhm, AipsError);
54                cout << "Test to/from record" << endl;
55                Record rec;
56                lse.toRecord(rec);
57                PtrHolder<SpectralElement> el(SpectralElementFactory::fromRecord(rec));
58                lse = *dynamic_cast<LorentzianSpectralElement *>(el.ptr());
59                AlwaysAssert(lse.getAmpl() == amp, AipsError);
60                AlwaysAssert(lse.getCenter() == center, AipsError);
61                AlwaysAssert(lse.getFWHM() == fwhm, AipsError);
62        }
63
64        cout << "ok" << endl;
65        return 0;
66
67
68}
Note: See TracBrowser for help on using the repository browser.