1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-23 02:38:51 -05:00
catima/tests/test_reaction.cpp

39 lines
1005 B
C++
Raw Normal View History

2018-05-01 20:18:50 -04:00
#include "lest.hpp"
#include <math.h>
#include "catima/catima.h"
#include "catima/reactions.h"
#include "testutils.h"
using namespace std;
using catima::approx;
using catima::reaction_rate;
using catima::nonreaction_rate;
const lest::test specification[] =
{
CASE("reaction"){
2018-07-30 19:41:44 -04:00
catima::Projectile proj{12,6,6,870};
2018-05-01 20:18:50 -04:00
auto c = catima::get_material(6);
c.thickness(4.0);
2018-07-30 19:41:44 -04:00
double r = reaction_rate(846,c.number_density_cm2());
2018-05-01 20:18:50 -04:00
std::cout<<r<<"\n";
EXPECT(reaction_rate(0,10.0) == 0.0);
2018-07-30 19:41:44 -04:00
EXPECT(reaction_rate(860,0.0) == 0.0);
2018-05-01 20:18:50 -04:00
EXPECT(nonreaction_rate(0,10.0) == 1.0);
EXPECT(nonreaction_rate(1000,0.0) == 1.0);
2018-07-30 19:41:44 -04:00
auto fcc = [](double x){return 846.0;};
2018-05-01 20:18:50 -04:00
r = reaction_rate(fcc, c.number_density_cm2());
std::cout<<r<<"\n";
2018-05-02 19:23:47 -04:00
2018-07-30 19:41:44 -04:00
r= 1-catima::nonreaction_rate1(proj, c);
std::cout<<r<<std::endl;
2018-05-01 20:18:50 -04:00
}
};
int main( int argc, char * argv[] )
{
return lest::run( specification, argc, argv );
}