Commit e4066a0f authored by Lynn Garren's avatar Lynn Garren
Browse files

run test as executable instead of shell script

parent 0f3a09e6
2011-07-20 Lynn Garren <garren@fnal.gov>
* testUnits: convert from shell script to executable
==============================
11.11.10 Release CLHEP-2.1.0.1
==============================
......
......@@ -74,9 +74,6 @@ AC_CONFIG_FILES([Units/copy-header.pl], [chmod +x Units/copy-header.pl])
# Configuration inquiry program/script:
AC_CONFIG_FILES([Units-config], [chmod +x Units-config])
# Test driver program/script:
AC_CONFIG_FILES([test/testUnits.sh], [chmod +x test/testUnits.sh])
# ----------------------------------------------------------------------
# Capture post-install information:
# ----------------------------------------------------------------------
......
clhep_test( testUnits NOLIB )
clhep_test( testUnits SIMPLE NOLIB )
......@@ -21,12 +21,11 @@ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
check_PROGRAMS = \
testUnits
check_SCRIPTS = \
testUnits.sh
check_SCRIPTS =
# Identify test(s) to run when 'make check' is requested:
TESTS = \
testUnits.sh
testUnits
# Identify the test(s) for which failure is the intended outcome:
XFAIL_TESTS =
......@@ -35,8 +34,7 @@ XFAIL_TESTS =
testUnits_SOURCES = testUnits.cc
# Identify input data file(s) and prototype output file(s):
EXTRA_DIST = \
testUnits.input testUnits.output
EXTRA_DIST =
# Identify generated file(s) to be removed when 'make clean' is requested:
CLEANFILES =
......
// -*- C++ -*-
// $Id: testUnits.cc,v 1.3 2003/08/13 20:00:13 garren Exp $
// $Id: testUnits.cc,v 1.4 2011/07/20 23:00:04 garren Exp $
// ---------------------------------------------------------------------------
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
......@@ -12,6 +12,7 @@
#include "CLHEP/Units/PhysicalConstants.h"
#include <iostream>
#include <iomanip>
#include <sstream>
int main() {
......@@ -21,7 +22,17 @@ int main() {
for (int i=0; i<7; i++, m++) { assert(m == double(i)); }
assert(m != CLHEP::meter);
std::cout << "Speed of light is " << std::setw(10) << std::setprecision(8)
<< CLHEP::c_light << std::endl;
return 0;
//std::cout << "Speed of light is " << std::setw(10) << std::setprecision(8)
// << CLHEP::c_light << std::endl;
//output: Speed of light is 299.79246
std::ostringstream os1, os2;
os1 << std::setprecision(8) << CLHEP::c_light;
os2 << "299.79246";
if( os1.str() == os2.str() ) {
return 0;
} else {
std::cout << "compare --" << os1.str() << "-- to --" << os2.str() << "--" << std::endl;
return 1;
}
}
Speed of light is 299.79246
#! /bin/sh
# @configure_input@
@builddir@/testUnits@EXEEXT@ \
| @DIFF_Q@ - @srcdir@/testUnits.output > /dev/null
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment