paysages3d/src/tests/AtmosphereDefinition_Test.cpp

39 lines
854 B
C++
Raw Normal View History

2014-08-28 13:09:47 +00:00
#include "BaseTestCase.h"
#include "AtmosphereDefinition.h"
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);
atmo.setDayTime(0.0);
check_daytime(atmo, 0);
2014-08-28 13:09:47 +00:00
atmo.setDayTime(0.1);
check_daytime(atmo, 2, 24);
2014-08-28 13:09:47 +00:00
atmo.setDayTime(0.25);
check_daytime(atmo, 6);
2014-08-28 13:09:47 +00:00
atmo.setDayTime(0.5);
check_daytime(atmo, 12);
2014-08-28 13:09:47 +00:00
atmo.setDayTime(1.0);
check_daytime(atmo, 0);
2014-08-28 13:09:47 +00:00
atmo.setDayTime(-0.5);
check_daytime(atmo, 12);
2014-08-28 13:09:47 +00:00
atmo.setDayTime(1.5);
check_daytime(atmo, 12);
2014-08-28 13:09:47 +00:00
}