Skip to content

Conversation

@Sachet-debug
Copy link

What does this PR do?

This pull request adds a new GoogleTest-based unit test file test_basic_math.cxx inside math/mathcore/test/.

Purpose of the PR

MathCore already contains many statistical and numerical tests, but it did not have a simple beginner-friendly test covering basic TMath functionality.
This PR introduces very small but meaningful tests for:

  • TMath::Sqrt
  • TMath::Log

These tests validate correctness for simple inputs (e.g., Sqrt(9) → 3, Log(e) → 1).

Why this is useful

  • Helps expand MathCore test coverage.
  • Provides a simple reference test for newcomers who want to understand the GoogleTest structure in ROOT.
  • Ensures basic TMath behavior is validated in CI across compilers/platforms.

What is included

  • New file: test_basic_math.cxx
  • CMake registration using ROOT_ADD_GTEST

Tests included

TEST(MathCoreTest, SqrtFunction) {
    double out = TMath::Sqrt(9.0);
    EXPECT_NEAR(out, 3.0, 1e-12);
}

TEST(MathCoreTest, LogFunction) {
    double out = TMath::Log(2.71828182845904523536);
    EXPECT_NEAR(out, 1.0, 1e-12);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant