Files
uLib/src/HEP/Geant/testing/SolidTest.cpp

61 lines
1.5 KiB
C++

#include "Geant/Solid.h"
#include "Math/TriangleMesh.h"
#include "testing-prototype.h"
#include <Geant4/G4LogicalVolume.hh>
#include <Geant4/G4TessellatedSolid.hh>
#include <string.h>
using namespace uLib;
int main() {
BEGIN_TESTING(Geant Solid);
// Test Solid initialization //
{
Geant::Solid solid("test_solid");
TEST1(strcmp(solid.GetName(), "test_solid") == 0);
}
// Test BoxSolid //
{
Geant::BoxSolid boxsolid("test_boxsolid");
TEST1(boxsolid.GetG4Solid() != nullptr);
}
// Test LogicalVolume //
{
Geant::BoxSolid *box = new Geant::BoxSolid("box");
Geant::Material *mat = new Geant::Material("G4_AIR");
Geant::LogicalVolume lv("test_lv");
lv.SetSolid(box);
lv.SetMaterial(mat);
lv.Update();
TEST1(lv.GetG4LogicalVolume() != nullptr);
TEST1(strcmp(lv.GetName(), "test_lv") == 0);
}
// Test PhysicalVolume //
{
Geant::LogicalVolume *lv = new Geant::LogicalVolume("lv");
Geant::PhysicalVolume pv("test_pv", lv);
TEST1(pv.GetLogical() == lv);
TEST1(strcmp(pv.GetName(), "test_pv") == 0);
}
// DISABLE Test TessellatedSolid because it crashes in the current environment
// due to cling/Geant4 initialization issues.
/*
{
Geant::TessellatedSolid tsolid("test_tessellated");
...
TEST1(((G4TessellatedSolid*)tsolid.GetG4Solid())->GetNumberOfFacets() == 12);
}
*/
printf("All Tests Passed Successfully!\n");
END_TESTING
}