diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/qt/qmc_format/qmc_format.cpp | |
download | pcp-debian/3.9.10.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/qt/qmc_format/qmc_format.cpp')
-rw-r--r-- | qa/qt/qmc_format/qmc_format.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/qa/qt/qmc_format/qmc_format.cpp b/qa/qt/qmc_format/qmc_format.cpp new file mode 100644 index 0000000..1387e31 --- /dev/null +++ b/qa/qt/qmc_format/qmc_format.cpp @@ -0,0 +1,37 @@ +// +// Test QmcMetric::formatValue routines +// + +#include <QTextStream> +#include <qmc.h> +#include <qmc_context.h> +#include <qmc_metric.h> + +QTextStream cerr(stderr); +QTextStream cout(stdout); + +int +main(int argc, char *argv[]) +{ + double d; + char *endptr; + + pmProgname = basename(argv[0]); + if (argc != 2) { + cerr << "Usage: " << pmProgname << " double" << endl; + exit(1); + /*NOTREACHED*/ + } + + d = strtod(argv[1], &endptr); + if (endptr != NULL && endptr[0] != '\0') { + cerr << pmProgname << ": argument \"" << argv[1] + << "\" must be a double (\"" << endptr << "\")" << endl; + exit(1); + /*NOTREACHED*/ + } + + cout << QmcMetric::formatNumber(d) << endl; + + return 0; +} |