File: itkTimerTest.cxx

package info (click to toggle)
elastix 4.7-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 51,444 kB
  • ctags: 11,825
  • sloc: cpp: 35,827; python: 530; sh: 227; makefile: 23
file content (70 lines) | stat: -rw-r--r-- 1,571 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*======================================================================

  This file is part of the elastix software.

  Copyright (c) University Medical Center Utrecht. All rights reserved.
  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
  details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE. See the above copyright notices for more information.

======================================================================*/
#include "elxTimer.h"


int TestStartStop( void )
{
  tmr::Timer::Pointer pTmr = tmr::Timer::New();
  pTmr->StartTimer();

  if ( pTmr->StopTimer() != 0 )
  {
    std::cerr << "StopTimer() failed.\n";
    return 1;
  }

  return 0;
} // end TestStartStop()


int TestZeroTimeOutput( void )
{
  tmr::Timer::Pointer pTmr = tmr::Timer::New();

  pTmr->StartTimer();
  pTmr->StopTimer();

  if ( pTmr->GetElapsedTimeSec() != 0 )
  {
    std::cerr << "GetElapsedTimeSec() != 0\n";
    return 1;
  }

  if ( pTmr->PrintElapsedTimeSec() != "0" )
  {
    std::cerr << "PrintElapsedTimeSec() != 0\n";
    return 1;
  }

  if ( pTmr->PrintElapsedTimeDHMS() != "0 Seconds" )
  {
    std::cerr << "PrintElapsedTimeDHMS() failed.\n";
    return 1;
  }

  return 0;

} // end TestZeroTimeOutput()


int main( int argc, char *argv[] )
{
	int errorCode = TestStartStop() || TestZeroTimeOutput();
	
	std::cerr << "Elastix code was successfully used outside the Elastix tree!" << std::endl;

	return errorCode;
} // end main()