OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestOpalSinusoidalTimeDependence.cpp
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Paul Scherrer Institute, Villigen PSI, Switzerland
3// All rights reserved
4//
5// This file is part of OPAL.
6//
7// OPAL is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// You should have received a copy of the GNU General License
13// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
14//
15
16#include <sstream>
20#include "gtest/gtest.h"
21
22TEST(TestOpalSinusoidalTimeDependence, UserInterface) {
23 // Make the UI
25 // Set the attributes
30 // Update the object
31 EXPECT_NO_THROW(ui.update());
32 // Check the values
33 auto* myDependency = dynamic_cast<SinusoidalTimeDependence*>(
34 AbstractTimeDependence::getTimeDependence("SINUSOIDAL_TIME_DEPENDENCE").get());
35 EXPECT_TRUE(myDependency);
36 EXPECT_TRUE((myDependency->getFrequencies() == std::vector{1.0, 2.0}));
37 EXPECT_TRUE((myDependency->getPhases() == std::vector{3.0, 4.0}));
38 EXPECT_TRUE((myDependency->getAmplitudes() == std::vector{5.0, 6.0}));
39 EXPECT_TRUE((myDependency->getOffsets() == std::vector{7.0, 8.0}));
40}
41
42TEST(TestOpalSinusoidalTimeDependence, ConstructorTest) {
44 const OpalSinusoidalTimeDependence* dep_clone = dep.clone("new name");
45 EXPECT_EQ(dep_clone->getOpalName(), "new name");
46}
47
48TEST(TestOpalSinusoidalTimeDependence, PrintTest) {
50 std::stringstream _string;
51 dep.print(_string);
52 EXPECT_EQ(_string.str(), "SINUSOIDAL_TIME_DEPENDENCE;\n");
53}
TEST(TestOpalSinusoidalTimeDependence, UserInterface)
static std::shared_ptr< AbstractTimeDependence > getTimeDependence(const std::string &name)
const std::string & getOpalName() const
Return object name.
Definition Object.cpp:267
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:210
OpalSinusoidalTimeDependence * clone(const std::string &name) override
void print(std::ostream &) const override
void setRealArray(Attribute &attr, const std::vector< double > &value)
Set array value.