Skip to content
Merged
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
6 changes: 1 addition & 5 deletions hist/hbook/src/THbookFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ static Int_t gLastEntry = -1;

// As recommended in
// https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html
#if __GNUC__ > 7
typedef size_t fortran_charlen_t;
#else
typedef int fortran_charlen_t;
#endif
using fortran_charlen_t = size_t;

#else
# define hlimit HLIMIT
Expand Down
3 changes: 3 additions & 0 deletions roottest/root/hist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ if(fortran AND CMAKE_Fortran_COMPILER AND NOT CMAKE_Fortran_COMPILER_ID STREQUAL
COMMAND h2root mb4i1.hbook
COPY_TO_BUILDDIR mb4i1.hbook
OUTREF h2root.ref)
ROOT_ADD_GTEST(THbookFile THbookFile.cxx LIBRARIES Hbook)
set_tests_properties(roottest-root-hist-h2root PROPERTIES FIXTURES_SETUP hbookFile)
set_tests_properties(gtest-roottest-root-hist-THbookFile PROPERTIES FIXTURES_REQUIRED hbookFile)
endif()

ROOTTEST_ADD_TESTDIRS()
16 changes: 16 additions & 0 deletions roottest/root/hist/THbookFile.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <THbookFile.h>
#include <TH1F.h>

#include "gtest/gtest.h"

TEST(THbookFile, ReadTH1)
{
THbookFile file("mb4i1.hbook");
EXPECT_STREQ(file.GetCurDir(), "//lun10");
EXPECT_EQ(file.GetListOfKeys()->size(), 9);

TObject *histo = file.Get(1);
auto th1 = dynamic_cast<TH1F *>(histo);
ASSERT_NE(th1, nullptr);
EXPECT_EQ(th1->GetEntries(), 500);
}
Loading