summaryrefslogtreecommitdiff
path: root/qa/qt/qmc_format
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qt/qmc_format')
-rw-r--r--qa/qt/qmc_format/GNUmakefile27
-rw-r--r--qa/qt/qmc_format/GNUmakefile.install18
-rw-r--r--qa/qt/qmc_format/qmc_format.cpp37
-rw-r--r--qa/qt/qmc_format/qmc_format.pro13
4 files changed, 95 insertions, 0 deletions
diff --git a/qa/qt/qmc_format/GNUmakefile b/qa/qt/qmc_format/GNUmakefile
new file mode 100644
index 0000000..2350f48
--- /dev/null
+++ b/qa/qt/qmc_format/GNUmakefile
@@ -0,0 +1,27 @@
+TOPDIR = ../../..
+include $(TOPDIR)/src/include/builddefs
+
+COMMAND = qmc_format
+PROJECT = $(COMMAND).pro
+SOURCES = $(COMMAND).cpp
+TESTDIR = $(PCP_VAR_DIR)/testsuite/qt/$(COMMAND)
+
+LSRCFILES = $(PROJECT) $(SOURCES)
+LDIRDIRT = build $(COMMAND).xcodeproj
+LDIRT = $(COMMAND) *.o Makefile
+
+default default_pcp:
+ifeq "$(ENABLE_QT)" "true"
+ $(QTMAKE)
+ $(LNMAKE)
+endif
+
+install install_pcp: default
+ $(INSTALL) -m 755 -d $(TESTDIR)
+ $(INSTALL) -m 644 GNUmakefile.install $(TESTDIR)/GNUmakefile
+ $(INSTALL) -m 644 $(PROJECT) $(SOURCES) $(TESTDIR)
+ifeq "$(ENABLE_QT)" "true"
+ $(INSTALL) -m 755 $(BINARY) $(TESTDIR)/$(COMMAND)
+endif
+
+include $(BUILDRULES)
diff --git a/qa/qt/qmc_format/GNUmakefile.install b/qa/qt/qmc_format/GNUmakefile.install
new file mode 100644
index 0000000..1e53804
--- /dev/null
+++ b/qa/qt/qmc_format/GNUmakefile.install
@@ -0,0 +1,18 @@
+ifdef PCP_CONF
+include $(PCP_CONF)
+else
+include $(PCP_DIR)/etc/pcp.conf
+endif
+PATH = $(shell . $(PCP_DIR)/etc/pcp.env; echo $$PATH)
+include $(PCP_INC_DIR)/builddefs
+
+COMMAND = qmc_format
+PROJECT = $(COMMAND).pro
+
+default setup install:
+ifeq "$(ENABLE_QT)" "true"
+ $(QTMAKE)
+ $(LNMAKE)
+endif
+
+include $(BUILDRULES)
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;
+}
diff --git a/qa/qt/qmc_format/qmc_format.pro b/qa/qt/qmc_format/qmc_format.pro
new file mode 100644
index 0000000..5cf4561
--- /dev/null
+++ b/qa/qt/qmc_format/qmc_format.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+LANGUAGE = C++
+SOURCES = qmc_format.cpp
+CONFIG += qt warn_on
+INCLUDEPATH += ../../../src/include
+INCLUDEPATH += ../../../src/libpcp_qmc/src
+release:DESTDIR = build/debug
+debug:DESTDIR = build/release
+LIBS += -L../../../src/libpcp/src
+LIBS += -L../../../src/libpcp_qmc/src
+LIBS += -L../../../src/libpcp_qmc/src/build/Default
+LIBS += -lpcp_qmc -lpcp
+QT -= gui