1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-29 21:48:51 -05:00
catima/tests/test_generated.cpp

114 lines
3.0 KiB
C++
Raw Normal View History

2019-10-08 14:49:52 -04:00
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
#include "doctest.h"
2017-07-25 12:19:11 -04:00
#include <math.h>
2019-10-08 14:49:52 -04:00
#include "testutils.h"
2017-07-25 12:19:11 -04:00
#include "catima/catima.h"
//#include "nucdata.h"
using namespace std;
2019-10-08 14:49:52 -04:00
TEST_CASE("LS generated is equal to calculated"){
2017-07-25 12:19:11 -04:00
catima::Projectile p;
double a,b;
p.A = 238;
p.Z = 92;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard(p);
b = catima::precalculated_lindhard(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.001));
2017-07-25 12:19:11 -04:00
}
p.A = 220;
p.Z = 92;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard(p);
b = catima::precalculated_lindhard(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.01));
2017-07-25 12:19:11 -04:00
}
p.A = 250;
p.Z = 92;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard(p);
b = catima::precalculated_lindhard(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.01));
2017-07-25 12:19:11 -04:00
}
p.A = 200;
p.Z = 76;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard(p);
b = catima::precalculated_lindhard(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.01));
2017-07-25 12:19:11 -04:00
}
p.A = 100;
p.Z = 50;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard(p);
b = catima::precalculated_lindhard(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.01));
2017-07-25 12:19:11 -04:00
}
2019-10-08 14:49:52 -04:00
}
2017-07-25 12:19:11 -04:00
2019-10-08 14:49:52 -04:00
TEST_CASE("LS X generated is equal to calculated"){
2017-07-25 12:19:11 -04:00
catima::Projectile p;
double a,b;
p.A = 238;
p.Z = 92;
for(double e:{90.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard_X(p);
b = catima::precalculated_lindhard_X(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.001));
2017-07-25 12:19:11 -04:00
}
p.A = 220;
p.Z = 92;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard_X(p);
b = catima::precalculated_lindhard_X(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.02));
2017-07-25 12:19:11 -04:00
}
p.A = 250;
p.Z = 92;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard_X(p);
b = catima::precalculated_lindhard_X(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.03));
2017-07-25 12:19:11 -04:00
}
p.A = 200;
p.Z = 76;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard_X(p);
b = catima::precalculated_lindhard_X(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.03));
2017-07-25 12:19:11 -04:00
}
p.A = 100;
p.Z = 50;
for(double e:{100.0,1000.0,5000.0,30000.0}){
p.T = e;
a = catima::bethek_lindhard_X(p);
b = catima::precalculated_lindhard_X(p);
2019-10-08 14:49:52 -04:00
CHECK(a==approx(b).epsilon(0.03));
2017-07-25 12:19:11 -04:00
}
}