Cockatrice/tests
Lukas Brübach a438be8bda [Analytics] Return zero instead of NaN for impossible draw probabilities
The draw-probability widget computes a hypergeometric probability as a sum of
qLn terms. Two argument combinations reach a non-positive term and return NaN,
which the results table prints as "nan":

- k > K, asking for more copies than the deck holds. A deck with one Forest,
  draw 7, "exactly 3" gives K=1, k=3.
- n - k > N - K, where drawing k targets would need more non-target cards than
  exist. An 8-card deck with 6 targets, draw 5, "exactly 0" gives N-K=2, n-k=5.

Both are reachable: the quantity and drawn spinboxes allow 1-60, and the
"at least" branch caps k at copies while the "exactly" branch passes the spinbox
value straight through.

Extract the function so it can be tested on its own, and guard both cases.
Restoring the old guard fails 3 of the 7 new tests.
2026-10-10 19:57:18 +02:00
..
card_zone_algorithms [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
carddatabase [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
deck_list_model [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
deck_list_zones [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
loading_from_clipboard [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
movecard_tests [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
oracle [Build] Add an ENABLE_SANITIZERS option for ASan and UBSan 2026-10-10 19:51:07 +02:00
picture_loader_benchmark [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
settings [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
theme_migration [Tests] Register each test case with CTest instead of each test binary 2026-10-10 19:48:21 +02:00
card_update_progress_test.cpp [Client] Improve card database update visibility (#7458) 2026-10-09 11:07:48 +02:00
clamped_arithmetic_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
CMakeLists.txt [Analytics] Return zero instead of NaN for impossible draw probabilities 2026-10-10 19:57:18 +02:00
deck_filter_string_test.cpp [Tests] Cover DeckFilterString parse-error reporting (#7402) 2026-10-10 19:53:26 +02:00
deck_hash_performance_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
expression_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
hypergeometric_probability_test.cpp [Analytics] Return zero instead of NaN for impossible draw probabilities 2026-10-10 19:57:18 +02:00
lag_monitor_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
latency_tracker_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
loader_local_matching_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
metrics_registry_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
password_hash_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
playmat_resolver_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
report_categories_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
server_card_counter_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
server_counter_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
server_developer_role_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
server_dump_zone_test.cpp [Tests] Format the zone dump helper and its tests to clang-format 2026-10-10 19:53:26 +02:00
server_game_join_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
server_rate_limiter_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
single_instance_manager_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
test_age_formatting.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
translation_loader_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
translation_loader_test.ts [Translations] Load Qt's own translations and build ours with the binary (#7384) 2026-10-03 15:04:30 +02:00
warning_categories_test.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00