18 BOOST_TEST(storage.nTimes() == 0);
19 storage.setSampleAtTime(0,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
20 BOOST_TEST(storage.nDofs() == nValues);
21 BOOST_TEST(storage.nTimes() == 1);
22 for (
int i = 0; i < nValues; i++) {
23 BOOST_TEST(storage.getSampleAtOrAfter(0).values(i) == 1);
24 BOOST_TEST(storage.getSampleAtOrAfter(0.5).values(i) == 1);
25 BOOST_TEST(storage.getSampleAtOrAfter(1).values(i) == 1);
35 BOOST_TEST(storage.nTimes() == 0);
36 storage.setSampleAtTime(0,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
37 BOOST_TEST(storage.nDofs() == nValues);
38 BOOST_TEST(storage.nTimes() == 1);
39 BOOST_TEST(storage.maxStoredTime() == 0.0);
40 storage.setSampleAtTime(1,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
41 BOOST_TEST(storage.nDofs() == nValues);
42 BOOST_TEST(storage.nTimes() == 2);
43 BOOST_TEST(storage.maxStoredTime() == 1.0);
45 BOOST_TEST(storage.nDofs() == nValues);
46 BOOST_TEST(storage.nTimes() == 1);
47 BOOST_TEST(storage.maxStoredTime() == 0.0);
56 BOOST_TEST(storage.nTimes() == 0);
57 storage.setSampleAtTime(0,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
58 BOOST_TEST(storage.nDofs() == nValues);
59 BOOST_TEST(storage.nTimes() == 1);
60 BOOST_TEST(storage.maxStoredTime() == 0.0);
61 storage.setSampleAtTime(0.5,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
62 BOOST_TEST(storage.nTimes() == 2);
63 BOOST_TEST(storage.maxStoredTime() == 0.5);
64 storage.setSampleAtTime(1.0,
time::Sample{1, Eigen::VectorXd::Zero(nValues)});
65 BOOST_TEST(storage.nTimes() == 3);
66 BOOST_TEST(storage.maxStoredTime() == 1.0);
67 for (
int i = 0; i < nValues; i++) {
68 BOOST_TEST(storage.getSampleAtOrAfter(0).values(i) == 1);
69 BOOST_TEST(storage.getSampleAtOrAfter(0.5).values(i) == 1);
70 BOOST_TEST(storage.getSampleAtOrAfter(1).values(i) == 0);
73 BOOST_TEST(storage.nDofs() == nValues);
74 BOOST_TEST(storage.nTimes() == 1);
75 BOOST_TEST(storage.maxStoredTime() == 1.0);
76 for (
int i = 0; i < nValues; i++) {
77 BOOST_TEST(storage.getSampleAtOrAfter(0).values(i) == 0);
78 BOOST_TEST(storage.getSampleAtOrAfter(1).values(i) == 0);
88 storage.setSampleAtTime(0,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
89 storage.setSampleAtTime(0.5,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
90 storage.setSampleAtTime(1.0,
time::Sample{1, Eigen::VectorXd::Zero(nValues)});
91 auto times = storage.getTimes();
92 BOOST_TEST(times[0] == 0.0);
93 BOOST_TEST(times[1] == 0.5);
94 BOOST_TEST(times[2] == 1.00);
95 auto timesAndValues = storage.getTimesAndValues();
96 BOOST_TEST(timesAndValues.first[0] == 0.0);
97 BOOST_TEST(timesAndValues.first[1] == 0.5);
98 BOOST_TEST(timesAndValues.first[2] == 1.00);
99 for (
int i = 0; i < nValues; i++) {
100 BOOST_TEST(timesAndValues.second.col(0)(i) == 1);
101 BOOST_TEST(timesAndValues.second.col(1)(i) == 1);
102 BOOST_TEST(timesAndValues.second.col(2)(i) == 0);
112 const int nValues = 1;
114 storage.setSampleAtTime(0.0,
time::Sample{1, Eigen::VectorXd::Zero(nValues)});
115 auto times = storage.getTimes();
116 BOOST_TEST(times[0] == 0.0);
117 auto timesAndValues = storage.getTimesAndValues();
118 BOOST_TEST(timesAndValues.second.col(0)(0) == 0.0);
120 storage.setSampleAtTime(1.0,
time::Sample{1, Eigen::VectorXd::Ones(nValues)});
121 times = storage.getTimes();
122 BOOST_TEST(times[0] == 0.0);
123 BOOST_TEST(times[1] == 1.0);
124 timesAndValues = storage.getTimesAndValues();
125 BOOST_TEST(timesAndValues.second.col(0)(0) == 0.0);
126 BOOST_TEST(timesAndValues.second.col(1)(0) == 1.0);
130 times = storage.getTimes();
131 BOOST_TEST(times[0] == 1.0);
132 timesAndValues = storage.getTimesAndValues();
133 BOOST_TEST(timesAndValues.second.col(0)(0) == 1.0);
137 storage.setSampleAtTime(1.5,
time::Sample{1, 2 * Eigen::VectorXd::Ones(nValues)});
138 storage.setSampleAtTime(2.0,
time::Sample{1, 3 * Eigen::VectorXd::Ones(nValues)});
140 times = storage.getTimes();
141 BOOST_TEST(times[0] == 1.0);
142 BOOST_TEST(times[1] == 1.5);
143 BOOST_TEST(times[2] == 2.0);
147 times = storage.getTimes();
148 BOOST_TEST(times[0] == 2.0);
149 timesAndValues = storage.getTimesAndValues();
150 BOOST_TEST(timesAndValues.second.col(0)(0) == 3.0);