1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-23 10:48:50 -05:00
catima/tests/test_generated.cpp
2019-10-08 20:49:52 +02:00

114 lines
3.0 KiB
C++

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
#include "doctest.h"
#include <math.h>
#include "testutils.h"
#include "catima/catima.h"
//#include "nucdata.h"
using namespace std;
TEST_CASE("LS generated is equal to calculated"){
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);
CHECK(a==approx(b).epsilon(0.001));
}
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);
CHECK(a==approx(b).epsilon(0.01));
}
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);
CHECK(a==approx(b).epsilon(0.01));
}
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);
CHECK(a==approx(b).epsilon(0.01));
}
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);
CHECK(a==approx(b).epsilon(0.01));
}
}
TEST_CASE("LS X generated is equal to calculated"){
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);
CHECK(a==approx(b).epsilon(0.001));
}
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);
CHECK(a==approx(b).epsilon(0.02));
}
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);
CHECK(a==approx(b).epsilon(0.03));
}
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);
CHECK(a==approx(b).epsilon(0.03));
}
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);
CHECK(a==approx(b).epsilon(0.03));
}
}