示例#1
0
static void
TestRelativeAltitude()
{
  TCHAR buffer[256];

  // Test FormatRelativeAltitude()
  FormatRelativeAltitude(buffer, 1234, Unit::METER);
  ok1(StringIsEqual(buffer, _T("+1234 m")));

  FormatRelativeAltitude(buffer, Units::ToSysUnit(1234, Unit::FEET),
                         Unit::FEET);
  ok1(StringIsEqual(buffer, _T("+1234 ft")));

  FormatRelativeAltitude(buffer, -1234, Unit::METER);
  ok1(StringIsEqual(buffer, _T("-1234 m")));

  FormatRelativeAltitude(buffer, Units::ToSysUnit(-1234, Unit::FEET),
                         Unit::FEET);
  ok1(StringIsEqual(buffer, _T("-1234 ft")));

  FormatRelativeAltitude(buffer, 1234, Unit::METER, false);
  ok1(StringIsEqual(buffer, _T("+1234")));

  FormatRelativeAltitude(buffer, -1234, Unit::METER, false);
  ok1(StringIsEqual(buffer, _T("-1234")));
}
示例#2
0
void
FormatRelativeUserAltitude(fixed value, TCHAR *buffer, bool include_unit)
{
  FormatRelativeAltitude(buffer, value, Units::GetUserAltitudeUnit(),
                         include_unit);
}