Skip to content

Commit 6e065b7

Browse files
committed
lib: fix test-event-filter for systems with 32-bit long
On systems such as i686 with 32-bit long integers, expressions such as 60L * 60 * 1000 * 1000 (3600000000) overflow the maximum value of 2147483647, causing the test to fail. This can be fixed by using a "long long" (which is used for intmax_t) instead, e.g. 60LL * 60 * 1000 * 1000
1 parent d0e9338 commit 6e065b7

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/lib/test-event-filter.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,32 +1003,32 @@ static void test_event_filter_interval_values(void)
10031003
{ "field > 1mins", 60 * 1000 * 1000, FALSE },
10041004
{ "field < 1mins", 60 * 1000 * 1000, FALSE },
10051005

1006-
{ "field = 1hours", 60L * 60 * 1000 * 1000, TRUE },
1007-
{ "field = 1h", 60L * 60 * 1000 * 1000, TRUE },
1008-
{ "field = 3600000000", 60L * 60 * 1000 * 1000, TRUE },
1009-
{ "field >= 1hours", 60L * 60 * 1000 * 1000, TRUE },
1010-
{ "field <= 1hours", 60L * 60 * 1000 * 1000, TRUE },
1011-
{ "field > 1mins", 60L * 60 * 1000 * 1000, TRUE },
1012-
{ "field > 1hours", 60L * 60 * 1000 * 1000, FALSE },
1013-
{ "field < 1hours", 60L * 60 * 1000 * 1000, FALSE },
1014-
1015-
{ "field = 1days", 24L * 60 * 60 * 1000 * 1000, TRUE },
1016-
{ "field = 1d", 24L * 60 * 60 * 1000 * 1000, TRUE },
1017-
{ "field = 86400000000", 24L * 60 * 60 * 1000 * 1000, TRUE },
1018-
{ "field >= 1days", 24L * 60 * 60 * 1000 * 1000, TRUE },
1019-
{ "field <= 1days", 24L * 60 * 60 * 1000 * 1000, TRUE },
1020-
{ "field > 1hours", 24L * 60 * 60 * 1000 * 1000, TRUE },
1021-
{ "field > 1days", 24L * 60 * 60 * 1000 * 1000, FALSE },
1022-
{ "field < 1days", 24L * 60 * 60 * 1000 * 1000, FALSE },
1023-
1024-
{ "field = 1weeks", 7L * 24 * 60 * 60 * 1000 * 1000, TRUE },
1025-
{ "field = 1w", 7L * 24 * 60 * 60 * 1000 * 1000, TRUE },
1026-
{ "field = 604800000000", 7L * 24 * 60 * 60 * 1000 * 1000, TRUE },
1027-
{ "field >= 1weeks", 7L * 24 * 60 * 60 * 1000 * 1000, TRUE },
1028-
{ "field <= 1weeks", 7L * 24 * 60 * 60 * 1000 * 1000, TRUE },
1029-
{ "field > 1days", 7L * 24 * 60 * 60 * 1000 * 1000, TRUE },
1030-
{ "field > 1weeks", 7L * 24 * 60 * 60 * 1000 * 1000, FALSE },
1031-
{ "field < 1weeks", 7L * 24 * 60 * 60 * 1000 * 1000, FALSE },
1006+
{ "field = 1hours", 60LL * 60 * 1000 * 1000, TRUE },
1007+
{ "field = 1h", 60LL * 60 * 1000 * 1000, TRUE },
1008+
{ "field = 3600000000", 60LL * 60 * 1000 * 1000, TRUE },
1009+
{ "field >= 1hours", 60LL * 60 * 1000 * 1000, TRUE },
1010+
{ "field <= 1hours", 60LL * 60 * 1000 * 1000, TRUE },
1011+
{ "field > 1mins", 60LL * 60 * 1000 * 1000, TRUE },
1012+
{ "field > 1hours", 60LL * 60 * 1000 * 1000, FALSE },
1013+
{ "field < 1hours", 60LL * 60 * 1000 * 1000, FALSE },
1014+
1015+
{ "field = 1days", 24LL * 60 * 60 * 1000 * 1000, TRUE },
1016+
{ "field = 1d", 24LL * 60 * 60 * 1000 * 1000, TRUE },
1017+
{ "field = 86400000000", 24LL * 60 * 60 * 1000 * 1000, TRUE },
1018+
{ "field >= 1days", 24LL * 60 * 60 * 1000 * 1000, TRUE },
1019+
{ "field <= 1days", 24LL * 60 * 60 * 1000 * 1000, TRUE },
1020+
{ "field > 1hours", 24LL * 60 * 60 * 1000 * 1000, TRUE },
1021+
{ "field > 1days", 24LL * 60 * 60 * 1000 * 1000, FALSE },
1022+
{ "field < 1days", 24LL * 60 * 60 * 1000 * 1000, FALSE },
1023+
1024+
{ "field = 1weeks", 7LL * 24 * 60 * 60 * 1000 * 1000, TRUE },
1025+
{ "field = 1w", 7LL * 24 * 60 * 60 * 1000 * 1000, TRUE },
1026+
{ "field = 604800000000", 7LL * 24 * 60 * 60 * 1000 * 1000, TRUE },
1027+
{ "field >= 1weeks", 7LL * 24 * 60 * 60 * 1000 * 1000, TRUE },
1028+
{ "field <= 1weeks", 7LL * 24 * 60 * 60 * 1000 * 1000, TRUE },
1029+
{ "field > 1days", 7LL * 24 * 60 * 60 * 1000 * 1000, TRUE },
1030+
{ "field > 1weeks", 7LL * 24 * 60 * 60 * 1000 * 1000, FALSE },
1031+
{ "field < 1weeks", 7LL * 24 * 60 * 60 * 1000 * 1000, FALSE },
10321032
};
10331033

10341034
struct event_filter *filter;

0 commit comments

Comments
 (0)