File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,48 @@ class TimerTestsFixture : public ::testing::TestWithParam<int> {
115115 #endif // CYCLUS_IS_PARALLEL
116116};
117117
118+
119+ TEST_P (TimerTestsFixture, TimeShiftTest) {
120+ cyclus::PyStart ();
121+ cyclus::Recorder rec;
122+ cyclus::Timer ti;
123+ cyclus::Context ctx (&ti, &rec);
124+
125+ ti.Initialize (&ctx, cyclus::SimInfo (5 ));
126+
127+ int obs = ti.timeshift (-1 ,-1 );
128+ int exp = 0 ;
129+ EXPECT_EQ (exp, obs);
130+
131+ obs = ti.timeshift (0 ,0 );
132+ EXPECT_EQ (exp, obs);
133+
134+ obs = ti.timeshift (2010 , 2 );
135+ exp = 1 ;
136+ EXPECT_EQ (exp, obs);
137+
138+ obs = ti.timeshift (2011 ,1 );
139+ exp = 12 ;
140+ EXPECT_EQ (exp, obs);
141+
142+ obs = ti.timeshift (2011 ,5 );
143+ exp = 16 ;
144+ EXPECT_EQ (exp, obs);
145+
146+ obs = ti.timeshift (2009 ,1 );
147+ exp = -12 ;
148+ EXPECT_EQ (exp, obs);
149+
150+ obs = ti.timeshift (2009 ,11 );
151+ exp = -2 ;
152+ EXPECT_EQ (exp, obs);
153+
154+ obs = ti.timeshift (2008 ,6 );
155+ exp = -19 ;
156+ EXPECT_EQ (exp, obs);
157+
158+ }
159+
118160TEST_P (TimerTestsFixture, BareSim) {
119161 cyclus::PyStart ();
120162 cyclus::Recorder rec;
You can’t perform that action at this time.
0 commit comments