From 8f5716eaa95955c7a179a947e714fad6ca51a4ae Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Mon, 27 Jan 2020 17:37:41 -0500 Subject: [PATCH] 2020-01-27 Fred Gleason * Fixed a bug in 'datdecode_test' that made it impossible to test empty strings. --- ChangeLog | 3 +++ tests/datedecode_test.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b52723d6..3a548e19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19426,3 +19426,6 @@ 2020-01-27 Fred Gleason * Fixed a bug in 'RDCmdSwitch' that caused empty argument values to be returned as a null QString. +2020-01-27 Fred Gleason + * Fixed a bug in 'datdecode_test' that made it impossible to + test empty strings. diff --git a/tests/datedecode_test.cpp b/tests/datedecode_test.cpp index 97d94f70..58bfcbee 100644 --- a/tests/datedecode_test.cpp +++ b/tests/datedecode_test.cpp @@ -33,8 +33,8 @@ MainObject::MainObject(QObject *parent) :QObject(parent) { - QString date=""; - QString datetime=""; + QString date; + QString datetime; QString service=""; int schema=0; @@ -63,12 +63,12 @@ MainObject::MainObject(QObject *parent) exit(256); } } - if((!date.isEmpty())&&(!datetime.isEmpty())) { + if((!date.isNull())&&(!datetime.isNull())) { fprintf(stderr, "datedecode_test: --date and --datetime are mutually exclusive\n"); exit(256); } - if(date.isEmpty()&&datetime.isEmpty()) { + if(date.isNull()&&datetime.isNull()) { fprintf(stderr, "datedecode_test: you must specify either --date or --datetime\n"); exit(256); @@ -94,12 +94,12 @@ MainObject::MainObject(QObject *parent) // // Process Code // - if(!date.isEmpty()) { + if(!date.isNull()) { printf("%s\n", (const char *)RDDateDecode(date,QDate::currentDate(),station,config, service)); } - if(!datetime.isEmpty()) { + if(!datetime.isNull()) { printf("%s\n",(const char *)RDDateTimeDecode(datetime, QDateTime(QDate::currentDate(),QTime::currentTime()),station, config,service));