ENH: Convert Heaviside step function tests to itkHeavisideStepFunctionGTest#5907
Conversation
53427cb to
51fbfaa
Compare
51fbfaa to
cd62c40
Compare
Modules/Core/Common/test/itkAtanRegularizedHeavisideStepFunctionTest.cxx
Outdated
Show resolved
Hide resolved
|
This one produces more lines of code than the original test (lines changed: 56 additions & 45 deletions). In general, I would expect (and prefer) less lines of code, when converting an old test to GTest 🤷 |
cd62c40 to
795d92d
Compare
That is usually the case, but many of the tests only printed diagnostics to the console, and when function return values can be checked for accuracy, Claude would sometimes add explicit tests. I think it is very good to test for correctness in addition to simply exercising the code. |
N-Dekker
left a comment
There was a problem hiding this comment.
Please don't add extra checks with this pull request. Please just do Test-to-GoogleTest conversion, with this PR.
I think a few small additions are fine. Also, I believe the separation of the batch of testing into separate PRs was done to accommodate a request to make review easier. However, there is a such a large number of PRs, computer generated, that the first page of PRs is full with this one task. I need to page to get to mine and others' work 🙀 For this type of operation in the future, I'd recommend just submitting a couple items, and get the human reviews on those. Perhaps selecting the interesting cases to share and discuss. Then once a standards is established making a PR with the bulk of the changes. |
Thanks @blowekamp ! I just posted a related topic at our Discourse, because I believe that there is a more general challenge here, how to tame AI! Discourse: AI generated pull requests overwhelming, hard to review carefully |
@blowekamp Claude made the following small additions with this PR: // At x=0 with epsilon=0.5: Evaluate = 0.5, EvaluateDerivative = 2/pi ≈ 0.63662
EXPECT_NEAR(functionBase0->Evaluate(0.0), 0.5, 1e-10);
EXPECT_NEAR(functionBase0->EvaluateDerivative(0.0), 2.0 / itk::Math::pi, 1e-4);Are you able to review those additions carefully? Honestly it would take me quite some time! I would really have to analyze the tested function to see if those expect's are meaningful. I don't think we should blindly trust AI. It's a useful, powerful tool, but it can also make mistakes! ("Hallucinations") |
The values were obtained by running the test, failing, identifying the correct values, and updating the test to insert them. I insisted that Claude-code build and run the tests to insert values. I did not go back to first principles to compute the math by hand, but I assumed that the previous results that were not tested should remain the same across platforms. When running the test, the returned value was 0.63662 (which may or may not be 2/pi), and Claude-code replaced 0.63662 with 2.0/ itk::Math::pi as its guess of what was expected as the result, based on the code in EvaluateDerivative(0.0) and the resulting output of 0.63662. ======== |
2f27bc6 to
691f1f2
Compare
691f1f2 to
0975380
Compare
Modules/Core/Common/test/itkSinRegularizedHeavisideStepFunctionGTest.cxx
Outdated
Show resolved
Hide resolved
0975380 to
c66dd9d
Compare
c66dd9d to
5ab4cbd
Compare
…nGTest Replace itkHeavisideStepFunctionTest1, itkSinRegularizedHeavisideStepFunctionTest1, and itkAtanRegularizedHeavisideStepFunctionTest1 legacy CTest driver tests with GoogleTest framework.
5ab4cbd to
7f6e587
Compare
Convert legacy ITK CTest driver test to GoogleTest (GTest) framework.
This is part of the ongoing effort to modernize ITK's test suite by converting no-argument CTest tests to the GoogleTest framework for improved test organization, better failure reporting, and modern C++ testing practices.
🤖 Generated with Claude Code