diff options
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; +} |