Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test coverage for the math module #102837

Closed
skirpichev opened this issue Mar 20, 2023 · 2 comments
Closed

Improve test coverage for the math module #102837

skirpichev opened this issue Mar 20, 2023 · 2 comments
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@skirpichev
Copy link
Member

skirpichev commented Mar 20, 2023

Sometimes input checks are missing (e.g. L989 of math_1 or L1023 of math_1a), sometimes exceptional cases are not tested (e.g. in fsum), some code is just inaccessible (like L3519 in the perm_comb_small() helper). See attached coverage report (for ./python -m test test_math).

I believe, everything should be tested (except for memory errors and similar special cases).

lcov-report.zip

Linked PRs

@skirpichev skirpichev added the type-feature A feature request or enhancement label Mar 20, 2023
@AlexWaygood AlexWaygood added the tests Tests in the Lib/test dir label Mar 20, 2023
skirpichev added a commit to skirpichev/cpython that referenced this issue Mar 20, 2023
- input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071),
  hypot(L2682), log(L2307), ldexp(L2168) and dist(L2587,L2588,L2628).
- rewrite math_floor like math_ceil (cover L1239)
- drop inaccessible "if" branch (L3518) in perm_comb_small()
- improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497),
  ditto fmod(L2378)
- rewrite modf to fix inaccessible case(L2229), ditto for pow(L2988)

(all line numbers wrt the main branch at 5e6661b)
hauntsaninja pushed a commit that referenced this issue Sep 3, 2023
- input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071), hypot(L2682), log(L2307), ldexp(L2168), ceil(L1165), floor(L1236,L1239) and dist(L2587,L2588,L2628).
- drop inaccessible "if" branch (L3518) in perm_comb_small()
- improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497), ditto fmod(L2378)
- rewrite modf to fix inaccessible case(L2229), ditto for pow(L2988)
    
(all line numbers are wrt the main branch at 5e6661b)
@skirpichev
Copy link
Member Author

@hauntsaninja, wait. As I said in the PR thread - there are still some uncovered lines/branches. I think it's worth to keep this issue open until it's fixed completely.

@hauntsaninja hauntsaninja reopened this Sep 3, 2023
@hauntsaninja
Copy link
Contributor

Ah, missed that since it was early on. Re-opened!

skirpichev added a commit to skirpichev/cpython that referenced this issue Sep 28, 2023
* fsum: L1367, L1377, L1381, L1410

// line numbers wrt to 54fbfa8
skirpichev added a commit to skirpichev/cpython that referenced this issue Sep 28, 2023
* fsum: L1367, L1377, L1381, L1410

// line numbers wrt to 54fbfa8
skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 10, 2023
* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8
encukou pushed a commit that referenced this issue Nov 13, 2023
Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8
skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 13, 2023
Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8
(cherry picked from commit c61de45)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
encukou pushed a commit to encukou/cpython that referenced this issue Nov 13, 2023
Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8

(cherry picked from commit c61de45)
encukou pushed a commit to encukou/cpython that referenced this issue Nov 13, 2023
pythonGH-102523)

(Only the test changes from pythonGH-102523 are cherry-picked)

- input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071), hypot(L2682), log(L2307), ldexp(L2168), ceil(L1165), floor(L1236,L1239) and dist(L2587,L2588,L2628).
- improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497), ditto fmod(L2378)

(all line numbers are wrt the main branch at 5e6661b)
encukou pushed a commit to encukou/cpython that referenced this issue Nov 13, 2023
Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8

(cherry picked from commit c61de45)
encukou added a commit that referenced this issue Nov 13, 2023
… (GH-112030)

* gh-102837: improve test coverage for math module (GH-102523)

(Only the test changes from GH-102523 are cherry-picked)

- input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071), hypot(L2682), log(L2307), ldexp(L2168), ceil(L1165), floor(L1236,L1239) and dist(L2587,L2588,L2628).
- improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497), ditto fmod(L2378)

(all line numbers are wrt the main branch at 5e6661b)

* gh-102837: more tests for the math module (GH-111930)

Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8

(cherry picked from commit c61de45)

---------

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
encukou added a commit that referenced this issue Nov 16, 2023
… (GH-112030) (GH-112041)

[3.12] gh-102837: more tests for the math module (GH-111930)(GH-102523) (GH-112030)

* gh-102837: improve test coverage for math module (GH-102523)

(Only the test changes from GH-102523 are cherry-picked)

- input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071), hypot(L2682), log(L2307), ldexp(L2168), ceil(L1165), floor(L1236,L1239) and dist(L2587,L2588,L2628).
- improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497), ditto fmod(L2378)

(all line numbers are wrt the main branch at 5e6661b)

* gh-102837: more tests for the math module (GH-111930)

Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* (not cherry-picked for 3.11: sumprod)
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8

(cherry picked from commit c61de45)

---------

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
(cherry picked from commit c6aea46)
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8
@skirpichev skirpichev closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants