Skip to content

Commit fd175a0

Browse files
committed
Add further tests for Calendar
1 parent df23829 commit fd175a0

File tree

3 files changed

+305
-25
lines changed

3 files changed

+305
-25
lines changed

libs/core/src/ecflow/core/Calendar.cpp

-24
Original file line numberDiff line numberDiff line change
@@ -216,45 +216,21 @@ bool Calendar::operator==(const Calendar& rhs) const {
216216
// Otherwise For migration testing, it will fail
217217

218218
if (ctype_ != rhs.ctype_) {
219-
#ifdef DEBUG
220-
if (Ecf::debug_equality())
221-
std::cout << "Calendar::operator== ctypes don't match\n";
222-
#endif
223219
return false;
224220
}
225221
if (initTime_ != rhs.initTime_) {
226-
#ifdef DEBUG
227-
if (Ecf::debug_equality())
228-
std::cout << "Calendar::operator== initTime_ don't match\n";
229-
#endif
230222
return false;
231223
}
232224
if (suiteTime_ != rhs.suiteTime_) {
233-
#ifdef DEBUG
234-
if (Ecf::debug_equality())
235-
std::cout << "Calendar::operator== suiteTime_ don't match\n";
236-
#endif
237225
return false;
238226
}
239227
if (duration_ != rhs.duration_) {
240-
#ifdef DEBUG
241-
if (Ecf::debug_equality())
242-
std::cout << "Calendar::operator== duration_ don't match\n";
243-
#endif
244228
return false;
245229
}
246230
if (dayChanged_ != rhs.dayChanged_) {
247-
#ifdef DEBUG
248-
if (Ecf::debug_equality())
249-
std::cout << "Calendar::operator== dayChanged_ don't match\n";
250-
#endif
251231
return false;
252232
}
253233
if (increment_ != rhs.increment_) {
254-
#ifdef DEBUG
255-
if (Ecf::debug_equality())
256-
std::cout << "Calendar::operator== increment_ don't match\n";
257-
#endif
258234
return false;
259235
}
260236

libs/core/src/ecflow/core/Calendar.hpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ class CalendarDate {
112112
std::ostream& operator<<(std::ostream& os, const CalendarDate&);
113113

114114
bool operator==(const CalendarDate&, const CalendarDate&);
115+
inline bool operator!=(const CalendarDate& lhs, const CalendarDate& rhs) {
116+
return !(lhs == rhs);
117+
}
115118

116119
bool operator<(const CalendarDate&, const CalendarDate&);
117120
bool operator<=(const CalendarDate&, const CalendarDate&);
@@ -145,6 +148,9 @@ class JulianDay {
145148
std::ostream& operator<<(std::ostream& os, const JulianDay&);
146149

147150
bool operator==(const JulianDay&, const JulianDay&);
151+
inline bool operator!=(const JulianDay& lhs, const JulianDay& rhs) {
152+
return !(lhs == rhs);
153+
}
148154

149155
bool operator<(const JulianDay&, const JulianDay&);
150156
bool operator<=(const JulianDay&, const JulianDay&);
@@ -159,6 +165,12 @@ JulianDay& operator-=(JulianDay&, JulianDay::value_t);
159165

160166
bool operator==(const CalendarDate&, const JulianDay&);
161167
bool operator==(const JulianDay&, const CalendarDate&);
168+
inline bool operator!=(const CalendarDate& lhs, const JulianDay& rhs) {
169+
return !(lhs == rhs);
170+
}
171+
inline bool operator!=(const JulianDay& lhs, const CalendarDate& rhs) {
172+
return !(lhs == rhs);
173+
}
162174

163175
class CalendarUpdateParams; // forward declare
164176

@@ -229,7 +241,7 @@ class Calendar {
229241
boost::gregorian::date date() const;
230242

231243
/// The calendar type. For hybrid clocks the date does not update.
232-
bool hybrid() const { return (ctype_ == Calendar::HYBRID) ? true : false; }
244+
bool hybrid() const { return ctype_ == Calendar::HYBRID; }
233245

234246
/// for debug, must link with boost date and time library
235247
void dump(const std::string& title) const;
@@ -295,6 +307,7 @@ class Calendar {
295307
template <class Archive>
296308
void serialize(Archive& ar, std::uint32_t const /*version*/);
297309
};
310+
298311
} // namespace ecf
299312

300313
#endif /* ecflow_core_Calendar_HPP */

0 commit comments

Comments
 (0)