1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 20:18:51 -05:00
catima/tests/test_abundances.cpp

65 lines
2.5 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"
2018-04-22 19:39:10 -04:00
#include <math.h>
#include "catima/abundance_database.h"
#include "testutils.h"
using namespace std;
using namespace abundance;
2019-10-08 14:49:52 -04:00
TEST_CASE("isotope abundaces"){
CHECK(get_isotopes_num(1) == 2);
CHECK(get_isotopes_num(27) == 1);
CHECK(get_isotopes_num(0) == 0);
CHECK(get_isotopes_num(111) == 0);
2018-04-22 19:39:10 -04:00
2019-10-08 14:49:52 -04:00
CHECK(get_isotope_a(0,0) == 0);
CHECK(get_isotope_a(0,1) == 0);
CHECK(get_isotope_a(1,0) == 1);
CHECK(get_isotope_a(1,1) == 2);
CHECK(get_isotope_a(1,2) == 0);
CHECK(get_isotope_a(14,0) == 28);
CHECK(get_isotope_a(14,1) == 29);
CHECK(get_isotope_a(14,2) == 30);
CHECK(get_isotope_a(14,3) == 0);
CHECK(get_isotope_a(68,0) == 166);
CHECK(get_isotope_a(68,1) == 168);
CHECK(get_isotope_a(120,0) == 0);
2018-04-22 19:39:10 -04:00
2019-10-08 14:49:52 -04:00
CHECK(get_abundance(1,0) == approx(0.999,0.01));
CHECK(get_abundance(1,2) == 0.0);
CHECK(get_abundance(14,0) == approx(0.922,0.01));
CHECK(get_abundance(14,1) == approx(0.046,0.01));
CHECK(get_abundance(14,2) == approx(0.0308,0.01));
CHECK(get_abundance(14,3) == 0.0);
CHECK(get_abundance(68,0) == approx(0.336,0.01));
CHECK(get_abundance(68,1) == approx(0.267,0.01));
CHECK(get_abundance(120,0) == 0);
2018-04-22 19:39:10 -04:00
2019-10-08 14:49:52 -04:00
CHECK(get_isotope(0,0).first == 0);
CHECK(get_isotope(0,1).first == 0);
CHECK(get_isotope(1,0).first == 1);
CHECK(get_isotope(1,1).first == 2);
CHECK(get_isotope(1,2).first == 0);
CHECK(get_isotope(14,0).first == 28);
CHECK(get_isotope(14,1).first == 29);
CHECK(get_isotope(14,2).first == 30);
CHECK(get_isotope(14,3).first == 0);
CHECK(get_isotope(68,0).first == 166);
CHECK(get_isotope(68,1).first == 168);
CHECK(get_isotope(120,0).first == 0);
2018-04-22 19:39:10 -04:00
2019-10-08 14:49:52 -04:00
CHECK(get_isotope(1,0).second == approx(0.999,0.01));
CHECK(get_isotope(1,2).second == 0.0);
CHECK(get_isotope(14,0).second == approx(0.922,0.01));
CHECK(get_isotope(14,1).second == approx(0.046,0.01));
CHECK(get_isotope(14,2).second == approx(0.0308,0.01));
CHECK(get_isotope(14,3).second == 0.0);
CHECK(get_isotope(68,0).second == approx(0.336,0.01));
CHECK(get_isotope(68,1).second == approx(0.267,0.01));
CHECK(get_isotope(120,0).second == 0);
2018-04-22 19:39:10 -04:00
}