Обсуждение: Covering the comparison between date and timestamp, tz, type

Поиск
Список
Период
Сортировка

Covering the comparison between date and timestamp, tz, type

От
Kwangwon Seo
Дата:
Hi,

Using the PostgreSQL code coverage report, I found that tests for comparisons between date and timestamp[tz] are missing. Some of them have only partial coverage.

Attached patch will cover following functions:

date_eq_timestamp
date_ne_timestamp
date_lt_timestamp
date_gt_timestamp // already covered
date_le_timestamp
date_ge_timestamp

date_eq_timestamptz
date_ne_timestamptz
date_lt_timestamptz // already covered
date_gt_timestamptz // already covered
date_le_timestamptz
date_ge_timestamptz

timestamp_eq_date
timestamp_ne_date
timestamp_lt_date
timestamp_gt_date // already covered
timestamp_le_date
timestamp_ge_date

timestamptz_eq_date
timestamptz_ne_date
timestamptz_lt_date
timestamptz_gt_date // already covered
timestamptz_le_date
timestamptz_ge_date // already covered

This is a minor patch, but I’d like to submit it to enhance test coverage.

Best regards,
Kwangwon Seo
Вложения

Re: Covering the comparison between date and timestamp, tz, type

От
Rustam ALLAKOV
Дата:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi Kwangwon,
I have reviewed your patch. 

Funtions you mention are located at src/backend/utils/adt/date.c
I tested and generated coverage report at fb844b9f06568 
lines hit: 888    total: 1209    Coverage: 73.4 %

applied your patch, tested and generated report again
lines hit: 960    total: 1209    Coverage: 79.4 %

all the functions listed are now covered

date_eq_timestamp // covered
date_ne_timestamp // covered 
date_lt_timestamp // covered
date_gt_timestamp // already covered
date_le_timestamp // covered
date_ge_timestamp // covered

date_eq_timestamptz // covered
date_ne_timestamptz // covered
date_lt_timestamptz // already covered
date_gt_timestamptz // already covered
date_le_timestamptz // covered
date_ge_timestamptz // covered

timestamp_eq_date // covered
timestamp_ne_date // covered
timestamp_lt_date // covered
timestamp_gt_date // already covered
timestamp_le_date // covered
timestamp_ge_date // covered

timestamptz_eq_date // covered
timestamptz_ne_date // covered
timestamptz_lt_date // covered
timestamptz_gt_date // already covered
timestamptz_le_date // covered
timestamptz_ge_date // already covered

Thank you for the patch, your patch looks good to me! 
Regards
Rustam

The new status of this patch is: Ready for Committer

Re: Covering the comparison between date and timestamp, tz, type

От
Tom Lane
Дата:
Kwangwon Seo <anchovyseo@gmail.com> writes:
> Using the PostgreSQL code coverage report, I found that tests for
> comparisons between date and timestamp[tz] are missing. Some of them have
> only partial coverage.
> Attached patch will cover following functions:
> ...

I'm really not very excited about adding regression test cycles
forevermore just to make these functions show as covered in the
coverage report.  They are all trivial wrappers around some
"internal" comparison function, and IMO what's important to
cover is that internal function.  We don't necessarily need to
check every one of the wrappers, so long as the internal function
is fully exercised.

There are other functions in these files that'd be more worthy of
dedicated tests, because they are not just trivial wrappers around
something else.  For instance, it doesn't look like date_decrement,
date_increment, date_skipsupport are reached at all.

            regards, tom lane