Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Merge requests
!433
Add start of test for Material, and complete test for Element
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add start of test for Material, and complete test for Element
testMaterial
into
main
Overview
3
Commits
2
Pipelines
3
Changes
3
All threads resolved!
Hide all comments
Merged
Shaun Roe
requested to merge
testMaterial
into
main
1 month ago
Overview
3
Commits
2
Pipelines
3
Changes
3
All threads resolved!
Hide all comments
Expand
0
0
Merge request reports
Compare
main
version 1
eda75656
1 month ago
main (base)
and
latest version
latest version
c4b29ef7
2 commits,
1 month ago
version 1
eda75656
1 commit,
1 month ago
3 files
+
117
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
GeoModelCore/GeoModelKernel/tests/testGeoElement.cxx
0 → 100644
+
94
−
0
Options
/*
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
*/
#include
"GeoModelKernel/GeoElement.h"
#include
<gtest/gtest.h>
class
SampleElement
{
private:
const
std
::
string
m_name
{
"Rhodium"
};
const
std
::
string
m_symbol
{
"Rh"
};
const
double
m_Z
{
45.
};
const
double
m_A
{
102.90549
*
GeoModelKernelUnits
::
gram
/
GeoModelKernelUnits
::
mole
};
GeoElement
*
m_ptr
{};
public
:
GeoElement
*
ptr
()
const
{
return
m_ptr
;}
SampleElement
()
:
m_ptr
(
new
GeoElement
(
m_name
,
m_symbol
,
m_Z
,
m_A
)){
m_ptr
->
ref
();
}
~
SampleElement
(){
m_ptr
->
unref
();}
};
TEST
(
GeoElement
,
CanBeConstructedOnHeap
)
{
GeoElement
*
pG
{};
const
std
::
string
name
{
"Rhodium"
};
const
std
::
string
symbol
{
"Rh"
};
const
double
Z
{
45.
};
const
double
A
{
102.90549
};
EXPECT_NO_THROW
(
pG
=
new
GeoElement
(
name
,
symbol
,
Z
,
A
));
pG
->
ref
();
pG
->
unref
();
//should be destroyed here
}
TEST
(
GeoElement
,
CalculatesNCorrectly
){
SampleElement
rhodium
;
const
auto
p
=
rhodium
.
ptr
();
EXPECT_EQ
(
p
->
getN
(),
102.90549
);
}
TEST
(
GeoElement
,
GivesCorrectName
){
SampleElement
rhodium
;
const
auto
p
=
rhodium
.
ptr
();
EXPECT_EQ
(
p
->
getName
(),
"Rhodium"
);
}
TEST
(
GeoElement
,
GivesCorrectSymbol
){
SampleElement
rhodium
;
const
auto
p
=
rhodium
.
ptr
();
EXPECT_EQ
(
p
->
getSymbol
(),
"Rh"
);
}
TEST
(
GeoElement
,
GivesCorrectZValue
){
SampleElement
rhodium
;
const
auto
p
=
rhodium
.
ptr
();
EXPECT_EQ
(
p
->
getZ
(),
45
);
}
TEST
(
GeoElement
,
GivesCorrectAverageAtomicMass
){
SampleElement
rhodium
;
const
auto
p
=
rhodium
.
ptr
();
EXPECT_EQ
(
p
->
getA
(),
102.90549
*
GeoModelKernelUnits
::
gram
/
GeoModelKernelUnits
::
mole
);
}
TEST
(
GeoElement
,
GivesCorrectRadiationLength
){
SampleElement
rhodium
;
const
auto
p
=
rhodium
.
ptr
();
EXPECT_EQ
(
p
->
getRadTsai
(),
1.8442455962801794e-21
);
}
TEST
(
GeoElement
,
EqualityOperator
){
const
std
::
string
name
{
"Rhodium"
};
const
std
::
string
symbol
{
"Rh"
};
const
double
Z
{
45.
};
const
double
A
{
102.90549
*
GeoModelKernelUnits
::
gram
/
GeoModelKernelUnits
::
mole
};
auto
pG
=
new
GeoElement
(
name
,
symbol
,
Z
,
A
);
SampleElement
rhodium
;
ASSERT_TRUE
(
*
pG
==
*
(
rhodium
.
ptr
()));
}
TEST
(
GeoElement
,
InequalityOperator
){
const
std
::
string
name
{
"Rhodium"
};
const
std
::
string
symbol
{
"Rh"
};
const
double
Z
{
45.
};
//alter A value _slightly_
const
double
A
{
102.91
*
GeoModelKernelUnits
::
gram
/
GeoModelKernelUnits
::
mole
};
auto
pG
=
new
GeoElement
(
name
,
symbol
,
Z
,
A
);
SampleElement
rhodium
;
ASSERT_TRUE
(
*
pG
!=
*
(
rhodium
.
ptr
()));
pG
->
ref
();
pG
->
unref
();
//should be destroyed here
}
Loading