コード例 #1
0
static void
TestBasic()
{
  // Test ReadString()
  PolarInfo polar;
  polar.ReadString(_T("318, 100, 80, -0.606, 120, -0.99, 160, -1.918"));
  ok1(equals(fixed(polar.reference_mass), 318));
  ok1(equals(fixed(polar.max_ballast), 100));
  ok1(equals(fixed(polar.v1), 22.2222222));
  ok1(equals(fixed(polar.w1), -0.606));
  ok1(equals(fixed(polar.v2), 33.3333333));
  ok1(equals(fixed(polar.w2), -0.99));
  ok1(equals(fixed(polar.v3), 44.4444444));
  ok1(equals(fixed(polar.w3), -1.918));
  ok1(equals(fixed(polar.wing_area), 0.0));

  polar.ReadString(_T("318, 100, 80, -0.606, 120, -0.99, 160, -1.918, 9.8"));
  ok1(equals(fixed(polar.reference_mass), 318));
  ok1(equals(fixed(polar.max_ballast), 100));
  ok1(equals(fixed(polar.v1), 22.2222222));
  ok1(equals(fixed(polar.w1), -0.606));
  ok1(equals(fixed(polar.v2), 33.3333333));
  ok1(equals(fixed(polar.w2), -0.99));
  ok1(equals(fixed(polar.v3), 44.4444444));
  ok1(equals(fixed(polar.w3), -1.918));
  ok1(equals(fixed(polar.wing_area), 9.8));

  // Test GetString()
  TCHAR polar_string[255];
  polar.GetString(polar_string, 255);
  ok(_tcscmp(_T("318,100,80.000,-0.606,120.000,-0.990,160.000,-1.918,9.800"),
             polar_string) == 0, "GetString()");
}
コード例 #2
0
ファイル: PolarGlue.cpp プロジェクト: davidswelt/XCSoar
bool
PolarGlue::LoadFromProfile(PolarInfo &polar)
{
  const TCHAR *polar_string = Profile::Get(szProfilePolar);
  if (polar_string != NULL && !StringIsEmpty(polar_string) &&
      polar.ReadString(polar_string)) {
    return true;
  }

  return LoadFromOldProfile(polar);
}