-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Russell Smith
committed
Dec 22, 2015
1 parent
47adef5
commit 6d20009
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//author : Russell Smith | ||
//date : December 2015 | ||
//adapted from Code from Nils Krumnack | ||
|
||
#include <RJigsawTools/RJigsawCalculator_lvlv.h> | ||
|
||
#include <RootCoreUtils/Assert.h> | ||
#include <TSystem.h> | ||
#include <cstdlib> | ||
#include <fstream> | ||
#include <gtest/gtest.h> | ||
|
||
#include <unordered_map> | ||
#include <xAODMissingET/MissingET.h> | ||
#include <xAODJet/JetContainer.h> | ||
|
||
struct RJigsawCalculator_lvlv_Test : testing::Test | ||
{ | ||
static const std::string root; | ||
|
||
static void SetUpTestCase () | ||
{ | ||
// gSystem->MakeDirectory ((root + "").c_str()); | ||
// std::ofstream ((root + "/file.root_17").c_str()); | ||
// std::ofstream ((root + "/ignore").c_str()); | ||
// gSystem->MakeDirectory ((root + "/sample").c_str()); | ||
// std::ofstream ((root + "/sample/samplefile.root").c_str()); | ||
// gSystem->MakeDirectory ((root + "/deepsample").c_str()); | ||
// gSystem->MakeDirectory ((root + "/deepsample/subdir").c_str()); | ||
// std::ofstream ((root + "/deepsample/subdir/deepfile.root").c_str()); | ||
} | ||
}; | ||
const std::string RJigsawCalculator_lvlv_Test::root = "test1"; | ||
|
||
TEST (RJigsawCalculator_lvlv_Test, clearEventTest) | ||
{ | ||
RJigsawCalculator_lvlv calc; | ||
calc.initialize(); | ||
|
||
std::unordered_map<std::string, double> mymap; | ||
xAOD::JetContainer jets; | ||
xAOD::MissingET met; | ||
|
||
|
||
EXPECT_TRUE( calc.calculate(mymap, jets, met) == EL::StatusCode::SUCCESS ) ;//the first event is fine no matter what | ||
EXPECT_TRUE( calc.clearEvent() == EL::StatusCode::SUCCESS );//clear event should work | ||
EXPECT_TRUE( calc.calculate(mymap, jets, met) == EL::StatusCode::SUCCESS ) ;//after clearing everything works fine | ||
EXPECT_TRUE( calc.calculate(mymap, jets, met) == EL::StatusCode::FAILURE ) ;//calling calculate twice fails! | ||
} | ||
|
||
int main (int argc, char **argv) | ||
{ | ||
::testing::InitGoogleTest (&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |