2014-08-28 13:09:47 +00:00
|
|
|
#include "BaseTestCase.h"
|
|
|
|
|
|
|
|
#include "AtmosphereDefinition.h"
|
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
static void check_daytime(const AtmosphereDefinition &atmo, int expected_hour, int expected_minute=0, int expected_second=0)
|
|
|
|
{
|
|
|
|
int hour, minute, second;
|
|
|
|
atmo.getHMS(&hour, &minute, &second);
|
|
|
|
EXPECT_EQ(expected_hour, hour);
|
|
|
|
EXPECT_EQ(expected_minute, minute);
|
|
|
|
EXPECT_EQ(expected_second, second);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(AtmosphereDefinition, setDayTime)
|
2014-08-28 13:09:47 +00:00
|
|
|
{
|
|
|
|
AtmosphereDefinition atmo(NULL);
|
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
atmo.setDayTime(0.0);
|
|
|
|
check_daytime(atmo, 0);
|
2014-08-28 13:09:47 +00:00
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
atmo.setDayTime(0.1);
|
|
|
|
check_daytime(atmo, 2, 24);
|
2014-08-28 13:09:47 +00:00
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
atmo.setDayTime(0.25);
|
|
|
|
check_daytime(atmo, 6);
|
2014-08-28 13:09:47 +00:00
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
atmo.setDayTime(0.5);
|
|
|
|
check_daytime(atmo, 12);
|
2014-08-28 13:09:47 +00:00
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
atmo.setDayTime(1.0);
|
|
|
|
check_daytime(atmo, 0);
|
2014-08-28 13:09:47 +00:00
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
atmo.setDayTime(-0.5);
|
|
|
|
check_daytime(atmo, 12);
|
2014-08-28 13:09:47 +00:00
|
|
|
|
2015-08-18 18:31:11 +00:00
|
|
|
atmo.setDayTime(1.5);
|
|
|
|
check_daytime(atmo, 12);
|
2014-08-28 13:09:47 +00:00
|
|
|
}
|