Skip to content

Add additional test cases for ARD Cohen's D and Hedge's G (requirements #0.06, #0.07)#334

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/add-test-cases-ard-tests
Closed

Add additional test cases for ARD Cohen's D and Hedge's G (requirements #0.06, #0.07)#334
Copilot wants to merge 2 commits intomainfrom
copilot/add-test-cases-ard-tests

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 18, 2026

Requirements #0.06 and #0.07 lacked sufficient test coverage for ard_effectsize_cohens_d() and ard_effectsize_hedges_g(). Also fixes a mislabeled test_that block in the Hedge's G test file.

Changes

  • test-ard_effectsize_cohens_d.R

    • Add conf.level parameter test for both unpaired and paired variants
    • Add stat names/labels validation test (ensures estimate, conf.low, conf.high, conf.level, paired, pooled_sd, alternative are present with correct labels)
  • test-ard_effectsize_hedges_g.R

    • Fix mislabeled test description: "ard_effectsize_cohens_d() follows ard structure""ard_effectsize_hedges_g() follows ard structure"
    • Add conf.level parameter test for both unpaired and paired variants
    • Add stat names/labels validation test (same stat names as above)
# conf.level test pattern (applied to both functions, unpaired + paired)
cards::ADSL |>
  dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
  ard_effectsize_cohens_d(by = ARM, variables = AGE, conf.level = 0.90) |>
  cards::get_ard_statistics(stat_name %in% "conf.level")
#> list(conf.level = 0.90)
Original prompt

This section details on the original issue you should resolve

<issue_title>additional test case for tests</issue_title>
<issue_description>- requirement insightsengineering/cardx#0.06 'ARD Cohen's D Test' is not covered by any test

  • requirement insightsengineering/cardx#0.07 'ARD Hedge's G Test' is not covered by any test</issue_description>

<agent_instructions>dear copilot, our automation test framework has identified potential missing tests for

requirement #0.06 'ARD Cohen's D Test' is not covered by any test
requirement #0.07 'ARD Hedge's G Test' is not covered by any test

please create test files in testthat folders, follow the same style as existing tests</agent_instructions>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…ts #0.06 and #0.07)

Co-authored-by: shajoezhu <3692541+shajoezhu@users.noreply.github.com>
Copilot AI changed the title [WIP] Add additional test cases for ARD Cohen's D and Hedge's G tests Add additional test cases for ARD Cohen's D and Hedge's G (requirements #0.06, #0.07) Mar 18, 2026
Copilot AI requested a review from shajoezhu March 18, 2026 08:18
@shajoezhu shajoezhu marked this pull request as ready for review March 18, 2026 08:44
@github-actions
Copy link
Copy Markdown
Contributor

badge

Code Coverage Summary

Filename                                Stmts    Miss  Cover    Missing
------------------------------------  -------  ------  -------  -------------------------------------------
R/add_total_n.survey.design.R              10       0  100.00%
R/ard_aod_wald_test.R                      77       2  97.40%   93, 96
R/ard_attributes.survey.design.R            2       0  100.00%
R/ard_car_anova.R                          45       2  95.56%   62, 65
R/ard_car_vif.R                            62       1  98.39%   87
R/ard_categorical_ci.R                    323       1  99.69%   100
R/ard_categorical_ci.survey.design.R      124       1  99.19%   180
R/ard_continuous_ci.R                      28       1  96.43%   38
R/ard_continuous_ci.survey.design.R       138       0  100.00%
R/ard_continuous.survey.design.R          284      20  92.96%   61-66, 100, 191, 200, 351, 382-383, 434-442
R/ard_effectsize_cohens_d.R               103       2  98.06%   69, 122
R/ard_effectsize_hedges_g.R                91       2  97.80%   68, 120
R/ard_emmeans_contrast.R                   99       0  100.00%
R/ard_emmeans_emmeans.R                    97       0  100.00%
R/ard_incidence_rate.R                    104       0  100.00%
R/ard_missing.survey.design.R              89       7  92.13%   45-50, 63
R/ard_regression_basic.R                   31       1  96.77%   61
R/ard_regression.R                         87       0  100.00%
R/ard_smd_smd.R                            69       5  92.75%   57, 83-86
R/ard_stats_anova.R                        95       0  100.00%
R/ard_stats_aov.R                          46       0  100.00%
R/ard_stats_chisq_test.R                   40       1  97.50%   39
R/ard_stats_fisher_test.R                  43       1  97.67%   42
R/ard_stats_kruskal_test.R                 36       1  97.22%   38
R/ard_stats_mantelhaen_test.R              67       1  98.51%   45
R/ard_stats_mcnemar_test.R                 80       2  97.50%   63, 106
R/ard_stats_mood_test.R                    49       1  97.96%   45
R/ard_stats_oneway_test.R                  39       0  100.00%
R/ard_stats_poisson_test.R                 76       1  98.68%   59
R/ard_stats_prop_test.R                    85       1  98.82%   43
R/ard_stats_t_test_onesample.R             41       0  100.00%
R/ard_stats_t_test.R                      112       2  98.21%   65, 111
R/ard_stats_wilcox_test_onesample.R        42       0  100.00%
R/ard_stats_wilcox_test.R                  99       2  97.98%   65, 117
R/ard_survey_svychisq.R                    38       1  97.37%   44
R/ard_survey_svyranktest.R                 54       1  98.15%   44
R/ard_survey_svyttest.R                    53       1  98.11%   42
R/ard_survival_survdiff.R                  89       0  100.00%
R/ard_survival_survfit_diff.R              76       0  100.00%
R/ard_survival_survfit.R                  236       5  97.88%   234-238
R/ard_tabulate_abnormal.R                  76       0  100.00%
R/ard_tabulate_max.R                       51       7  86.27%   54-59, 74
R/ard_tabulate_value.survey.design.R       80       9  88.75%   40-45, 62, 167, 172
R/ard_tabulate.survey.design.R            407      15  96.31%   70-75, 90, 243-246, 290, 335, 535, 549
R/construction_helpers.R                  106      10  90.57%   160-175, 189, 248
R/deprecated.R                             34      34  0.00%    28-86
R/proportion_ci.R                         203       1  99.51%   463
TOTAL                                    4316     142  96.71%

Diff against main

Filename      Stmts    Miss  Cover
----------  -------  ------  --------
TOTAL             0       0  +100.00%

Results for commit: 5068305

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Unit Tests Summary

  1 files  193 suites   1m 23s ⏱️
192 tests 156 ✅ 36 💤 0 ❌
712 runs  648 ✅ 64 💤 0 ❌

Results for commit 5068305.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Unit Test Performance Difference

Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
ard_effectsize_cohens_d 👶 $+0.00$ ard_effectsize_cohens_d_conf.level_argument_works
ard_effectsize_cohens_d 👶 $+0.00$ ard_effectsize_cohens_d_returns_correct_stat_names_and_labels
ard_effectsize_hedges_g 💀 $0.00$ $-0.00$ ard_effectsize_cohens_d_follows_ard_structure
ard_effectsize_hedges_g 👶 $+0.00$ ard_effectsize_hedges_g_conf.level_argument_works
ard_effectsize_hedges_g 👶 $+0.00$ ard_effectsize_hedges_g_follows_ard_structure
ard_effectsize_hedges_g 👶 $+0.00$ ard_effectsize_hedges_g_returns_correct_stat_names_and_labels

Results for commit 4ae8433

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

@Melkiades Melkiades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue is a false positive because this is true:

R/ard_effectsize_cohens_d.R 103 2 98.06% 69, 122
R/ard_effectsize_hedges_g.R 91 2 97.80% 68, 120

and the current PR is doing 0 new coverage

@shajoezhu
Copy link
Copy Markdown
Contributor

false positive

@shajoezhu shajoezhu closed this Mar 18, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
@shajoezhu shajoezhu deleted the copilot/add-test-cases-ard-tests branch March 19, 2026 03:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

additional test case for tests

3 participants