LCOV - code coverage report
Current view: top level - stdcasa/test - tVersionInfo.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 34 40 85.0 %
Date: 2024-11-06 17:42:47 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //# Copyright (C) 2018
       2             : //# Associated Universities, Inc. Washington DC, USA.
       3             : //#
       4             : //# This program is free software; you can redistribute it and/or modify it
       5             : //# under the terms of the GNU General Public License as published by the Free
       6             : //# Software Foundation; either version 2 of the License, or(at your option)
       7             : //# any later version.
       8             : //#
       9             : //# This program is distributed in the hope that it will be useful, but WITHOUT
      10             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      11             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
      12             : //# more details.
      13             : //#
      14             : //# You should have received a copy of the GNU General Public License along
      15             : //# with this program; if not, write to the Free Software Foundation, Inc.,
      16             : //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      17             : //#
      18             : //# Correspondence concerning AIPS++ should be addressed as follows:
      19             : //#        Internet email: casa-feedback@nrao.edu.
      20             : //#        Postal address: AIPS++ Project Office
      21             : //#                        National Radio Astronomy Observatory
      22             : //#                        520 Edgemont Road
      23             : //#                        Charlottesville, VA 22903-2475 USA
      24             : //#
      25             : //# $Id: $
      26             : #include <casacore/casa/Utilities/Assert.h>
      27             : #include <stdcasa/version.h>
      28             : 
      29             : using casa::VersionInfo;
      30             : using casacore::AipsError;
      31             : using std::vector;
      32             : using std::endl;
      33             : using std::cout;
      34             : using std::cerr;
      35             : 
      36           1 : int main( int, char *[] ) {
      37             :     try {
      38           1 :         vector<int> cur { VersionInfo::major( ),
      39           2 :                      VersionInfo::minor( ),
      40           2 :                      VersionInfo::patch( ),
      41           1 :                      VersionInfo::feature( ) };
      42             : 
      43           1 :         AlwaysAssert(VersionInfo::compare("==",cur), AipsError);
      44           1 :         AlwaysAssert(VersionInfo::compare("<=",cur), AipsError);
      45           1 :         AlwaysAssert(VersionInfo::compare(">=",cur), AipsError);
      46           1 :         AlwaysAssert(VersionInfo::compare("<",cur) == false, AipsError);
      47           1 :         AlwaysAssert(VersionInfo::compare(">",cur) == false, AipsError);
      48           1 :         AlwaysAssert(VersionInfo::compare(">",vector<int>{ cur[0] }), AipsError);
      49             : 
      50           1 :         AlwaysAssert(VersionInfo::compare("<",vector<int>{ cur[0], cur[1], cur[2], cur[3]+1 }), AipsError);
      51           1 :         AlwaysAssert(VersionInfo::compare("<",vector<int>{ cur[0], cur[1], cur[2]+1, cur[3] }), AipsError);
      52           1 :         AlwaysAssert(VersionInfo::compare("<",vector<int>{ cur[0], cur[1]+1, cur[2], cur[3] }), AipsError);
      53           1 :         AlwaysAssert(VersionInfo::compare("<",vector<int>{ cur[0]+1, cur[1], cur[2], cur[3] }), AipsError);
      54             :         
      55           1 :         AlwaysAssert(VersionInfo::compare(">",vector<int>{ cur[0], cur[1], cur[2], cur[3]+1 }) == false, AipsError);
      56           1 :         AlwaysAssert(VersionInfo::compare(">",vector<int>{ cur[0], cur[1], cur[2]+1, cur[3] }) == false, AipsError);
      57           1 :         AlwaysAssert(VersionInfo::compare(">",vector<int>{ cur[0], cur[1]+1, cur[2], cur[3] }) == false, AipsError);
      58           1 :         AlwaysAssert(VersionInfo::compare(">",vector<int>{ cur[0]+1, cur[1], cur[2], cur[3] }) == false, AipsError);
      59             : 
      60           1 :         AlwaysAssert(VersionInfo::compare("<=",vector<int>{ cur[0], cur[1], cur[2], cur[3]+1 }), AipsError);
      61           1 :         AlwaysAssert(VersionInfo::compare("<=",vector<int>{ cur[0], cur[1], cur[2]+1, cur[3] }), AipsError);
      62           1 :         AlwaysAssert(VersionInfo::compare("<=",vector<int>{ cur[0], cur[1]+1, cur[2], cur[3] }), AipsError);
      63           1 :         AlwaysAssert(VersionInfo::compare("<=",vector<int>{ cur[0]+1, cur[1], cur[2], cur[3] }), AipsError);
      64             :         
      65           1 :         AlwaysAssert(VersionInfo::compare(">=",vector<int>{ cur[0], cur[1], cur[2], cur[3]+1 }) == false, AipsError);
      66           1 :         AlwaysAssert(VersionInfo::compare(">=",vector<int>{ cur[0], cur[1], cur[2]+1, cur[3] }) == false, AipsError);
      67           1 :         AlwaysAssert(VersionInfo::compare(">=",vector<int>{ cur[0], cur[1]+1, cur[2], cur[3] }) == false, AipsError);
      68           1 :         AlwaysAssert(VersionInfo::compare(">=",vector<int>{ cur[0]+1, cur[1], cur[2], cur[3] }) == false, AipsError);
      69             : 
      70           1 :         AlwaysAssert(VersionInfo::compare("!=",vector<int>{ cur[0], cur[1], cur[2], cur[3]+1 }), AipsError);
      71           1 :         AlwaysAssert(VersionInfo::compare("!=",vector<int>{ cur[0], cur[1], cur[2]+1, cur[3] }), AipsError);
      72           1 :         AlwaysAssert(VersionInfo::compare("!=",vector<int>{ cur[0], cur[1]+1, cur[2], cur[3] }), AipsError);
      73           1 :         AlwaysAssert(VersionInfo::compare("!=",vector<int>{ cur[0]+1, cur[1], cur[2], cur[3] }), AipsError);
      74             : 
      75             : 
      76           1 :     } catch (const AipsError& x) {
      77           0 :         cerr << "Exception caught: " << x.getMesg() << endl;
      78           0 :         return 1;
      79           0 :     } catch (...) {
      80           0 :         cerr << "Exception caught..." << endl;
      81           0 :         return 1;
      82           0 :     }
      83           1 :     cout << "ok" << endl;
      84           1 :     return 0;
      85             : }

Generated by: LCOV version 1.16