summaryrefslogtreecommitdiff
path: root/test/libapt/compareversion_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/libapt/compareversion_test.cc')
-rw-r--r--test/libapt/compareversion_test.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc
index 1782c61cc..ee469f785 100644
--- a/test/libapt/compareversion_test.cc
+++ b/test/libapt/compareversion_test.cc
@@ -32,17 +32,18 @@
using namespace std;
-static bool callDPKG(const char *val, const char *ref, const char &op) {
+static bool callDPKG(const char * const val, const char * const ref, char const * const op) {
pid_t Process = ExecFork();
if (Process == 0)
{
- const char * args[6];
- args[0] = "/usr/bin/dpkg";
- args[1] = "--compare-versions";
- args[2] = val;
- args[3] = (op == 1) ? ">>" : ( (op == 0) ? "=" : "<<");
- args[4] = ref;
- args[5] = 0;
+ const char * args[] = {
+ BIN_DIR "/dpkg",
+ "--compare-versions",
+ val,
+ op,
+ ref,
+ nullptr
+ };
execv(args[0], (char**) args);
exit(1);
}
@@ -57,7 +58,7 @@ static bool callDPKG(const char *val, const char *ref, const char &op) {
int Res = debVS.CmpVersion(A, B); \
Res = (Res < 0) ? -1 : ( (Res > 0) ? 1 : Res); \
EXPECT_EQ(compare, Res) << "APT: A: »" << A << "« B: »" << B << "«"; \
- EXPECT_PRED3(callDPKG, A, B, compare); \
+ EXPECT_PRED3(callDPKG, A, B, ((compare == 1) ? ">>" : ( (compare == 0) ? "=" : "<<"))); \
}
#define EXPECT_VERSION(A, compare, B) \
EXPECT_VERSION_PART(A, compare, B); \