File: TestFormfactorItems.cpp

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (22 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "Base/Const/Units.h"
#include "Base/Math/Numeric.h"
#include "GUI/Model/Sample/FormfactorItems.h"
#include "Sample/HardParticle/Polyhedra.h"
#include "Tests/GTestWrapper/google_test.h"

TEST(FormfactorItems, Pyramid2Item)
{
    // to domain
    Pyramid2Item item;
    item.setLength(20.0);
    item.setWidth(16.0);
    item.setHeight(13.0);
    item.setAlpha(60.0);
    auto P_ff = item.createFormfactor();
    auto* p_ff = dynamic_cast<Pyramid2*>(P_ff.get());
    EXPECT_TRUE(p_ff);
    EXPECT_EQ(p_ff->length(), 20.0);
    EXPECT_EQ(p_ff->width(), 16.0);
    EXPECT_EQ(p_ff->height(), 13.0);
    EXPECT_TRUE(Numeric::almostEqual(p_ff->alpha(), Units::deg2rad(60.0), 2));
}