Re: Email to hackers for test coverage - Mailing list pgsql-hackers

From Ahsan Hadi
Subject Re: Email to hackers for test coverage
Date
Msg-id CA+9bhCKstL735McysasePHftun=NbwKrfTMWCVhtX4DHRA4diw@mail.gmail.com
Whole thread Raw
In response to Re: Email to hackers for test coverage  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers


On Wed, Aug 28, 2019 at 9:43 PM Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
On 2019-08-22 11:46, movead.li@highgo.ca wrote:
> *1. src/include/utils/float.h:140*
>
> Analyze: 
> This is an error report line when converting a big float8 value
> which a float4 can not storage to float4.
>
> Test case:
> Add a test case as below in file float4.sql:
> select float4(1234567890123456789012345678901234567890::float8);

> +-- Add test case for float4() type fonversion function

Check spelling

> *2. src/include/utils/float.h:145*
>
> Analyze:
> This is an error report line when converting a small float8 value
> which a float4 can not storage to float4.
>
> Test case:
> Add a test case as below in file float4.sql:
> select float4(0.0000000000000000000000000000000000000000000001::float8);
>
> *3.src/include/utils/sortsupport.h:264*
>
> Analyze:
> It is reverse sorting for the data type that has abbreviated for
> sort, for example macaddr, uuid, numeric, network and I choose
> numeric to do it.
>
> Test cast:
> Add a test case as below in file numeric.sql:
> INSERT INTO num_input_test(n1) values('99999999999999999999999999.998');
> INSERT INTO num_input_test(n1) values('99999999999999999999999999.997');
> SELECT * FROM num_input_test ORDER BY n1 DESC;

>  INSERT INTO num_input_test(n1) VALUES ('        nan');
> +INSERT INTO num_input_test(n1) values('99999999999999999999999999.998');
> +INSERT INTO num_input_test(n1) values('99999999999999999999999999.997');

Make spaces and capitalization match surrounding code.

> Result and patch
>
> By adding the test cases, the test coverage of  float.h increased from
> 97.7% to 100% and sortsupport.h increased from 76.7% to 80.0%.

That's fine, but I suggest that if you really want to make an impact in
test coverage, look to increase function coverage rather than line
coverage.  Or look for files that are not covered at all.


+1 
 
--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Ashutosh Sharma
Date:
Subject: Re: Zedstore - compressed in-core columnar storage
Next
From: Heikki Linnakangas
Date:
Subject: Re: Zedstore - compressed in-core columnar storage