AdaptInfoTest.cpp 792 Bytes
Newer Older
Müller, Felix's avatar
Müller, Felix committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <amdis/AdaptInfo.cpp>
#include <amdis/AMDiS.hpp>

#include <amdis/common/Literals.hpp>

#include <amdis/utility/TreePath.hpp>

#include "Tests.hpp"

using namespace AMDiS;

int main()
{
  AdaptInfo adaptInfo("adapt");

  auto root_tp = treepath();
  auto tp = treepath(0_c);
  std::string str = "0";

  adaptInfo.setEstSum(0.1, tp);
  AMDIS_TEST_EQ(adaptInfo.getEstSum(tp), 0.1);

  adaptInfo.setEstSum(0.2, root_tp);
  AMDIS_TEST_EQ(adaptInfo.getEstSum(root_tp), 0.2);

  AMDIS_TEST_EQ(adaptInfo.getSize(), 2);

  adaptInfo.setEstSum(0.3, "0");
  AMDIS_TEST_EQ(adaptInfo.getEstSum(tp), 0.3);

  adaptInfo.setEstSum(0.4, 0_c);
  AMDIS_TEST_EQ(adaptInfo.getEstSum(tp), 0.4);

  adaptInfo.setEstSum(0.5, str);
  AMDIS_TEST_EQ(adaptInfo.getEstSum(tp), 0.5);

  return report_errors();
}