Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions math/mathcore/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ ROOT_ADD_GTEST(testRootFinder testRootFinder.cxx LIBRARIES ${Libraries})
ROOT_ADD_GTEST(testKahan testKahan.cxx LIBRARIES Core MathCore)
ROOT_ADD_GTEST(testDelaunay2D testDelaunay2D.cxx LIBRARIES Core MathCore)
ROOT_ADD_GTEST(testKNNDensity testKNNDensity.cxx LIBRARIES Core MathCore Hist)
ROOT_ADD_GTEST(test_basic_math test_basic_math.cxx LIBRARIES MathCore)


if(clad)
ROOT_ADD_GTEST(CladDerivatorTests CladDerivatorTests.cxx LIBRARIES Core MathCore)
Expand Down
15 changes: 15 additions & 0 deletions math/mathcore/test/test_basic_math.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "gtest/gtest.h"
#include "TMath.h" // ROOT math utilities

// Basic tests for a couple of TMath functions
TEST(MathCoreTest, SqrtFunction) {
double val = 9.0;
double out = TMath::Sqrt(val);
EXPECT_NEAR(out, 3.0, 1e-12);
}

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