ARTS 2.5.4 (git: bcd8c674)
test_isotope.cc
Go to the documentation of this file.
1#include "isotopologues.h"
2
3int main() {
4 std::cout << "Test correctness of Species fails here:\n";
5 for (std::size_t i=0; i<Species::Isotopologues.size(); i++) {
6 auto& x = Species::Isotopologues[i];
7 if (not good_enum(x.spec)) {
8 std::cout << "Position: " << i << " has bad values\n";
9 }
10 }
11
12 std::cout << "\n\nTest correctness of Species short-name conversion fails here:\n";
13 for (Index i=0; i<Index(Species::Species::FINAL); i++) {
14 auto a = Species::Species(i);
15 auto b = Species::toShortName(a);
16 auto c = Species::fromShortName(b);
17 if (not good_enum(c) or c not_eq a) {
18 std::cout << i << ' ' << a << ' ' << b << ' ' << c << '\n';
19 }
20 }
21
22 std::cout << "\n\nTest of order of Species fails for these pairs:\n";
23 for (std::size_t i=0; i<Species::Isotopologues.size()-1; i++) {
24 auto& a = Species::Isotopologues[i];
25 auto& b = Species::Isotopologues[i+1];
26 if (std::size_t(a.spec) > std::size_t(b.spec)) {
27 std::cout << a.FullName() << ' ' << b.FullName() << '\n';
28 }
29 }
30
31 std::cout << "\n\nTest of order of Isotopologues fails for these pairs:\n";
32 for (std::size_t i=0; i<Species::Isotopologues.size()-1; i++) {
33 auto& a = Species::Isotopologues[i];
34 auto& b = Species::Isotopologues[i+1];
35 if (a.spec == b.spec) {
36 if (a.isotname.compare(b.isotname) >= 0) {
37 std::cout << a.FullName() << ' ' << b.FullName() << '\n';
38 }
39 }
40 }
41
42 std::cout << "\n\nTest that all Isotopologues (that are explicit isotopes) has a ratio in the builtin IsotopologueRatios fails here:\n";
44 for (Index i=0; i<iso_rat.maxsize; i++) {
45 if (not is_predefined_model(Species::Isotopologues[i]) and not Species::Isotopologues[i].joker() and nonstd::isnan(iso_rat.data[i])) {
46 std::cout << Species::Isotopologues[i].FullName() << " has no isotopologue ratio by default: " << iso_rat.data[i] << '\n';
47 }
48 }
49}
constexpr bool good_enum(EnumType x) noexcept
Checks if the enum number is good.
Definition: enums.h:22
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
const Joker joker
constexpr bool is_predefined_model(const IsotopeRecord &ir) noexcept
constexpr std::array Isotopologues
A list of all ARTS isotopologues, note how the species enum class input HAS to be sorted.
Definition: isotopologues.h:57
constexpr IsotopologueRatios isotopologue_ratiosInitFromBuiltin()
constexpr bool isnan(double d) noexcept
Definition: nonstd.h:53
#define a
#define c
#define b
int main()
Definition: test_isotope.cc:3