当前位置: 首页>>代码示例>>C++>>正文


C++ Test函数代码示例

本文整理汇总了C++中Test函数的典型用法代码示例。如果您正苦于以下问题:C++ Test函数的具体用法?C++ Test怎么用?C++ Test使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Test函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Test1

//            10
//         /      \
//        6        14
//       /\        /\
//      4  8     12  16
void Test1()
{
    int data[] = {4, 8, 6, 12, 16, 14, 10};
    Test("Test1", data, sizeof(data)/sizeof(int), true);
}
开发者ID:brian-smith723,项目名称:DesignPatterns,代码行数:10,代码来源:063_SequenceOfBST.cpp

示例2: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
    Test(1, 1);

    Test(2, 2);
    Test(3, 3);
    Test(4, 4);
    Test(5, 5);
    Test(6, 6);
    Test(7, 8);
    Test(8, 9);
    Test(9, 10);
    Test(10, 12);
    Test(11, 15);

    Test(1500, 859963392);

    Test(0, 0);

    return 0;
}
开发者ID:1461190388,项目名称:hht,代码行数:21,代码来源:UglyNumber.cpp

示例3: main

// Test out the heap implementation -- with max heap
int main(int argc, char** argv) {
  int i, j;
  int n;
  Int* A[20];
  Int* B[20];
  Int C[10] = {73, 6, 57, 88, 60, 34, 83, 72, 48, 85};
  heap<Int*, maxIntsCompare> BH(B, 0, 20);
  heap<Int, maxIntCompare> Test(C, 10, 10);

  if (argc != 2) {
    cout << "Usage: heap <heapsize>\n";
    exit(-1);
  }

  n = atoi(argv[1]);
  if (n > 20) {
    cout << "heap size " << n << " too big.\n";
    exit(-1);
  }

  Randomize();

  for (i=0; i<n; i++)
    A[i] = new Int(i);

  permute(A, n);

  cout << "Initial values:\n";
  for (i=0; i<n; i++) {
    cout << A[i] << "  ";
    if (i == 9) cout << "\n";
  }
  cout << "\n\n";

  for (i=0; i<n; i++)
    BH.insert(A[i]);

  for (i=0; i<BH.size(); i++) {
    cout << B[i] << "  ";
    if (i == 9) cout << "\n";
  }
  cout << "\n\n";

  heap<Int*, maxIntsCompare> AH(A, n, 20);
  Int* AHval = NULL;

  for (i=0; i<AH.size(); i++) {
    cout << A[i] << "  ";
    if (i == 9) cout << "\n";
  }
  cout << "\n\n";

  AHval = AH.removefirst();
  cout << "Max value: " << AHval << "\n";

  for (i=0; i<AH.size(); i++) {
    cout << A[i] << "  ";
    if (i == 9) cout << "\n";
  }
  cout << "\n\n";

  AHval = AH.removefirst();
  cout << "Max value: " << AHval << "\n";

  for (i=0; i<AH.size(); i++) {
    cout << A[i] << "  ";
    if (i == 9) cout << "\n";
  }
  cout << "\n\n";

  AHval = AH.remove(2);
  cout << "Remove value: " << AHval << "\n";

  for (i=0; i<AH.size(); i++) {
    cout << A[i] << "  ";
    if (i == 9) cout << "\n";
  }
  cout << "\n";

  for (i=0; i<10; i++)
    cout << C[i] << "  ";
  cout << "\n";

  Int Testval;
  for (j=0; j<10; j++) {
    Testval = Test.removefirst();
    for (i=0; i<10; i++)
      cout << C[i] << "  ";
    cout << "\n";
  }

  return 0;
}
开发者ID:mjrmyke,项目名称:Cpp-tidbits,代码行数:94,代码来源:heapmain.cpp

示例4: Test4

// empty string
void Test4()
{
    Test("Test4", "", "");
}
开发者ID:brian-smith723,项目名称:DesignPatterns,代码行数:5,代码来源:091_ReverseWordsInSentence.cpp

示例5: Dot

bool IntrBox3Box3<Real>::Test (Real tmax,
    const Vector3<Real>& velocity0, const Vector3<Real>& velocity1)
{
    if (velocity0 == velocity1)
    {
        if (Test())
        {
            mContactTime = (Real)0;
            return true;
        }
        return false;
    }

    // Cutoff for cosine of angles between box axes.  This is used to catch
    // the cases when at least one pair of axes are parallel.  If this
    // happens, there is no need to include the cross-product axes for
    // separation.
    const Real cutoff = (Real)1 - Math<Real>::ZERO_TOLERANCE;
    bool existsParallelPair = false;

    // convenience variables
    const Vector3<Real>* A = mBox0->Axis;
    const Vector3<Real>* B = mBox1->Axis;
    const Real* EA = mBox0->Extent;
    const Real* EB = mBox1->Extent;
    Vector3<Real> D = mBox1->Center - mBox0->Center;
    Vector3<Real> W = velocity1 - velocity0;
    Real C[3][3];     // matrix C = A^T B, c_{ij} = Dot(A_i,B_j)
    Real AbsC[3][3];  // |c_{ij}|
    Real AD[3];       // Dot(A_i,D)
    Real AW[3];       // Dot(A_i,W)
    Real min0, max0, min1, max1, center, radius, speed;
    int i, j;

    mContactTime = (Real)0;
    Real tlast = Math<Real>::MAX_REAL;

    // axes C0+t*A[i]
    for (i = 0; i < 3; ++i)
    {
        for (j = 0; j < 3; ++j)
        {
            C[i][j] = A[i].Dot(B[j]);
            AbsC[i][j] = Math<Real>::FAbs(C[i][j]);
            if (AbsC[i][j] > cutoff)
            {
                existsParallelPair = true;
            }
        }
        AD[i] = A[i].Dot(D);
        AW[i] = A[i].Dot(W);
        min0 = -EA[i];
        max0 = +EA[i];
        radius = EB[0]*AbsC[i][0] + EB[1]*AbsC[i][1] + EB[2]*AbsC[i][2];
        min1 = AD[i] - radius;
        max1 = AD[i] + radius;
        speed = AW[i];
        if (IsSeparated(min0, max0, min1, max1, speed, tmax, tlast))
        {
            return false;
        }
    }

    // axes C0+t*B[i]
    for (i = 0; i < 3; ++i)
    {
        radius = EA[0]*AbsC[0][i] + EA[1]*AbsC[1][i] + EA[2]*AbsC[2][i];
        min0 = -radius;
        max0 = +radius;
        center = B[i].Dot(D);
        min1 = center - EB[i];
        max1 = center + EB[i];
        speed = W.Dot(B[i]);
        if (IsSeparated(min0, max0, min1, max1, speed, tmax, tlast))
        {
            return false;
        }
    }

    // At least one pair of box axes was parallel, so the separation is
    // effectively in 2D where checking the "edge" normals is sufficient for
    // the separation of the boxes.
    if (existsParallelPair)
    {
        return true;
    }

    // axis C0+t*A0xB0
    radius = EA[1]*AbsC[2][0] + EA[2]*AbsC[1][0];
    min0 = -radius;
    max0 = +radius;
    center = AD[2]*C[1][0] - AD[1]*C[2][0];
    radius = EB[1]*AbsC[0][2] + EB[2]*AbsC[0][1];
    min1 = center - radius;
    max1 = center + radius;
    speed = AW[2]*C[1][0] - AW[1]*C[2][0];
    if (IsSeparated(min0, max0, min1, max1, speed, tmax, tlast))
    {
        return false;
    }
//.........这里部分代码省略.........
开发者ID:fishxz,项目名称:omni-bot,代码行数:101,代码来源:Wm5IntrBox3Box3.cpp

示例6: main

BOOLEAN
main()
{
    return Test();
}
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:5,代码来源:utseqos.c

示例7: Test5

// Only blanks
void Test5()
{
    char input[] = "   ";
    char expected[] = "   ";
    Test("Test5", input, expected);
}
开发者ID:brian-smith723,项目名称:DesignPatterns,代码行数:7,代码来源:091_ReverseWordsInSentence.cpp

示例8: main

int main(int argc, char **argv, char **env) {
  Verilated::commandArgs(argc, argv);
  Test test = Test(argv[0]);

  Vcore_id_module* top = new Vcore_id_module;

  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should not be enabled", !top->output_enable_o);

  top->output_enable_i = 1;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should not be enabled", !top->output_enable_o);

  top->core_selection_i = 42;
  top->save_selection_i = 1;
  top->output_enable_i = 0;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should not be enabled", !top->output_enable_o);

  top->core_selection_i = 0;
  top->save_selection_i = 0;
  top->output_enable_i = 1;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should be enabled", top->output_enable_o);

  top->core_selection_i = 0;
  top->save_selection_i = 0;
  top->output_enable_i = 0;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should not be enabled", !top->output_enable_o);

  top->core_selection_i = 12;
  top->save_selection_i = 1;
  top->output_enable_i = 0;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should not be enabled", !top->output_enable_o);

  top->core_selection_i = 0;
  top->save_selection_i = 0;
  top->output_enable_i = 1;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should NOT be enabled", !top->output_enable_o);

  top->core_selection_i = 42;
  top->save_selection_i = 1;
  top->output_enable_i = 0;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should not be enabled", !top->output_enable_o);

  top->core_selection_i = 0;
  top->save_selection_i = 0;
  top->output_enable_i = 1;
  top->clk_i = 1;
  top->eval();
  top->clk_i = 0;
  top->eval();

  test.check("Core ID Output should be 42", top->core_id_o == 42);
  test.check("Output should be enabled", top->output_enable_o);

  delete top;

//.........这里部分代码省略.........
开发者ID:dankirkham,项目名称:xkcd-skein-fpga,代码行数:101,代码来源:core_id_module_test.cpp

示例9: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	Test(0, 0);
	Test(1, 1);
	Test(2, 1);
	Test(3, 2);
	Test(4, 3);
	Test(5, 5);
	Test(6, 8);
	Test(7, 13);
	Test(8, 21);
	Test(9, 34);
	Test(10, 55);
	return 0;
}
开发者ID:AppleGenius,项目名称:Codethon,代码行数:15,代码来源:09Fibonacci.cpp

示例10: Test

const boost::bimap<ribi::foam::PatchFieldType,std::string> ribi::foam::PatchFieldTypes::CreateMap()
{
  #ifndef NDEBUG
  Test();
  #endif

  boost::bimap<PatchFieldType,std::string> m;
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::advective,"advective"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::alphaSgsJayatillekeWallFunction,"alphaSgsJayatillekeWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::alphaSgsWallFunction,"alphaSgsWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::alphatJayatillekeWallFunction,"alphatJayatillekeWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::alphatWallFunction,"alphatWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::buoyantPressure,"buoyantPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::calculated,"calculated"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::codedFixedValue,"codedFixedValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::codedMixed,"codedMixed"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_epsilonWallFunction,"compressible_epsilonWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_kqRWallFunction,"compressible_kqRWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_omegaWallFunction,"compressible_omegaWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_temperatureThermoBaffle1D_constSolidThermoPhysics,"compressible_temperatureThermoBaffle1D_constSolidThermoPhysics"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_temperatureThermoBaffle1D_expoSolidThermoPhysics,"compressible_temperatureThermoBaffle1D_expoSolidThermoPhysics"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_turbulentHeatFluxTemperature,"compressible_turbulentHeatFluxTemperature"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_turbulentMixingLengthDissipationRateInlet,"compressible_turbulentMixingLengthDissipationRateInlet"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_turbulentMixingLengthFrequencyInlet,"compressible_turbulentMixingLengthFrequencyInlet"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_turbulentTemperatureCoupledBaffle,"compressible_turbulentTemperatureCoupledBaffle"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_turbulentTemperatureCoupledBaffleMixed,"compressible_turbulentTemperatureCoupledBaffleMixed"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::compressible_turbulentTemperatureRadCoupledMixed,"compressible_turbulentTemperatureRadCoupledMixed"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::cyclic,"cyclic"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::cyclicAMI,"cyclicAMI"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::cyclicSlip,"cyclicSlip"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::directionMixed,"directionMixed"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::empty,"empty"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::externalWallHeatFluxTemperature,"externalWallHeatFluxTemperature"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fan,"fan"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fanPressure,"fanPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fixedEnthalpy,"fixedEnthalpy"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fixedFluxPressure,"fixedFluxPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fixedGradient,"fixedGradient"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fixedInternalEnergy,"fixedInternalEnergy"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fixedInternalValue,"fixedInternalValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fixedPressureCompressibleDensity,"fixedPressureCompressibleDensity"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::fixedValue,"fixedValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::freestream,"freestream"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::freestreamPressure,"freestreamPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::gradientEnthalpy,"gradientEnthalpy"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::gradientInternalEnergy,"gradientInternalEnergy"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::htcConvection,"htcConvection"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::inletOutlet,"inletOutlet"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::inletOutletTotalTemperature,"inletOutletTotalTemperature"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mapped,"mapped"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mappedField,"mappedField"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mappedFixedInternalValue,"mappedFixedInternalValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mappedFixedPushedInternalValue,"mappedFixedPushedInternalValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mixed,"mixed"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mixedEnthalpy,"mixedEnthalpy"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mixedInternalEnergy,"mixedInternalEnergy"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::muSgsUSpaldingWallFunction,"muSgsUSpaldingWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::multiphaseFixedFluxPressure,"multiphaseFixedFluxPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mutLowReWallFunction,"mutLowReWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mutURoughWallFunction,"mutURoughWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mutUSpaldingWallFunction,"mutUSpaldingWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mutUWallFunction,"mutUWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mutkRoughWallFunction,"mutkRoughWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::mutkWallFunction,"mutkWallFunction"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::nonuniformTransformCyclic,"nonuniformTransformCyclic"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::oscillatingFixedValue,"oscillatingFixedValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::outletInlet,"outletInlet"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::outletMappedUniformInlet,"outletMappedUniformInlet"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::partialSlip,"partialSlip"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::patch,"patch"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::phaseHydrostaticPressure,"phaseHydrostaticPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::processor,"processor"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::processorCyclic,"processorCyclic"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::rotatingTotalPressure,"rotatingTotalPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::sliced,"sliced"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::slip,"slip"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::symmetryPlane,"symmetryPlane"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::syringePressure,"syringePressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::timeVaryingMappedFixedValue,"timeVaryingMappedFixedValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::totalFlowRateAdvectiveDiffusive,"totalFlowRateAdvectiveDiffusive"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::totalPressure,"totalPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::totalTemperature,"totalTemperature"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::turbulentInlet,"turbulentInlet"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::turbulentIntensityKineticEnergyInlet,"turbulentIntensityKineticEnergyInlet"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::uniformDensityHydrostaticPressure,"uniformDensityHydrostaticPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::uniformFixedValue,"uniformFixedValue"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::uniformTotalPressure,"uniformTotalPressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::wallHeatTransfer,"wallHeatTransfer"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::waveSurfacePressure,"waveSurfacePressure"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::waveTransmissive,"waveTransmissive"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::wedge,"wedge"));
  m.insert(boost::bimap<PatchFieldType,std::string>::value_type(PatchFieldType::zeroGradient,"zeroGradient"));
  return m;
}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:94,代码来源:openfoampatchfieldtypes.cpp

示例11: Test

std::string PropertyParser::parseType(bool SupressDiagnostics) {
    std::string Result;
    bool HasConst = Test(clang::tok::kw_const);
    bool HasVolatile = Test(clang::tok::kw_volatile);

    bool NoTemplates = true;

    Test(clang::tok::kw_enum) || Test(clang::tok::kw_class) || Test(clang::tok::kw_struct);

    if (Test(clang::tok::kw_unsigned)) {
        Result += parseUnsigned();
    } else if (Test(clang::tok::kw_signed)) {
        Result += "signed";
        while (true) {
            switch(+CurrentTok.getKind()) {
            case clang::tok::kw_int:
            case clang::tok::kw_long:
            case clang::tok::kw_short:
            case clang::tok::kw_char:
                Consume();
                Result += " " + Spelling();
                continue;
            }
            break;
        }
    } else {
        while(Test(clang::tok::kw_int)
                || Test(clang::tok::kw_long)
                || Test(clang::tok::kw_short)
                || Test(clang::tok::kw_char)
                || Test(clang::tok::kw_void)
                || Test(clang::tok::kw_bool)
                || Test(clang::tok::kw_double)
                || Test(clang::tok::kw_float)) {
            if (!Result.empty())
                Result += " ";
            Result += Spelling();
        }
    }

    if (Result.empty()) {
        clang::CXXScopeSpec SS;
        if (Test(clang::tok::coloncolon)) {
            SS.MakeGlobal(Sema.getASTContext(), OriginalLocation());
            Result += Spelling();
        } do {
            if (!Test(clang::tok::identifier)) {
                PP.getDiagnostics().Report(OriginalLocation(CurrentTok.getLocation()),
                                           PP.getDiagnostics().getCustomDiagID(clang::DiagnosticsEngine::Error,
                                           "Invalid token while parsing type"));
                return {};
            }
            Result += Spelling();

            if (Test(clang::tok::less)) {
                NoTemplates = false;
                Result += "<";
                Result += parseTemplateType();

                if (!PrevToken.is(clang::tok::greater)) {
                    PP.getDiagnostics().Report(OriginalLocation(CurrentTok.getLocation()),
                                               PP.getDiagnostics().getCustomDiagID(clang::DiagnosticsEngine::Error,
                                               "parse error in type"));
                    return {}; //error;
                }
            }

            clang::Token IdentTok = PrevToken;

            if (!Test(clang::tok::coloncolon))
                break;

            if (NoTemplates && !SupressDiagnostics) {
                if (Sema.ActOnCXXNestedNameSpecifier(Sema.getScopeForContext(RD), *IdentTok.getIdentifierInfo(),
                    OriginalLocation(IdentTok.getLocation()), OriginalLocation(CurrentTok.getLastLoc()), {}, false, SS))
                        SS.SetInvalid({OriginalLocation(IdentTok.getLocation()), OriginalLocation(CurrentTok.getLastLoc())});
            }

            Result += Spelling();
        } while (true);

        if (NoTemplates && !SupressDiagnostics) {

            IsEnum = true; // That's how moc does it.

            if (SS.isNotEmpty() && SS.isValid()) {
                Extra = llvm::dyn_cast_or_null<clang::CXXRecordDecl>(Sema.computeDeclContext(SS));

                clang::LookupResult Found(Sema, PrevToken.getIdentifierInfo(), OriginalLocation(),
                                        clang::Sema::LookupNestedNameSpecifierName);
                /*if (SS.isEmpty())
                    Sema.LookupQualifiedName(Found, RD);
                else {*/
                clang::DeclContext* DC = Sema.computeDeclContext(SS);
                Sema.LookupQualifiedName(Found, DC ? DC : RD);
                //}
                clang::EnumDecl* R = Found.getAsSingle<clang::EnumDecl>();
                /*if (!R) {
                if (clang::TypedefDecl *TD = Found.getAsSingle<clang::TypedefDecl>()) {
                    const clang::TemplateSpecializationType* TDR = TD->getUnderlyingType()->getAs<clang::TemplateSpecializationType>();
//.........这里部分代码省略.........
开发者ID:gmrehbein,项目名称:moc-ng,代码行数:101,代码来源:propertyparser.cpp

示例12: Test4

// 1
//  \
//   2
//    \
//     3
//      \
//       4
//        \
//         5
void Test4()
{
    int data[] = {5, 4, 3, 2, 1};
    Test("Test4", data, sizeof(data)/sizeof(int), true);
}
开发者ID:brian-smith723,项目名称:DesignPatterns,代码行数:14,代码来源:063_SequenceOfBST.cpp

示例13: Test3

//               5
//              /
//             4
//            /
//           3
//          /
//         2
//        /
//       1
void Test3()
{
    int data[] = {1, 2, 3, 4, 5};
    Test("Test3", data, sizeof(data)/sizeof(int), true);
}
开发者ID:brian-smith723,项目名称:DesignPatterns,代码行数:14,代码来源:063_SequenceOfBST.cpp

示例14: Test2

//           5
//          / \
//         4   7
//            /
//           6
void Test2()
{
    int data[] = {4, 6, 7, 5};
    Test("Test2", data, sizeof(data)/sizeof(int), true);
}
开发者ID:brian-smith723,项目名称:DesignPatterns,代码行数:10,代码来源:063_SequenceOfBST.cpp

示例15: main

int main(int argc, char **argv)
{
    int i;
    PRThread *thread;
    PRFileDesc *sock;
    PRNetAddr addr;

    memset(&addr, 0, sizeof(addr));
    addr.inet.family = PR_AF_INET;
    addr.inet.port = PR_htons(0);
    addr.inet.ip = PR_htonl(PR_INADDR_ANY);
    for (i = 0; i < POLL_DESC_COUNT; i++) {
        sock = PR_NewTCPSocket();
        if (sock == NULL) {
            fprintf(stderr, "PR_NewTCPSocket failed\n");
            exit(1);
        }
        if (PR_Bind(sock, &addr) == PR_FAILURE) {
            fprintf(stderr, "PR_Bind failed\n");
            exit(1);
        }
        if (PR_Listen(sock, 5) == PR_FAILURE) {
            fprintf(stderr, "PR_Listen failed\n");
            exit(1);
        }
    
        pd[i].fd = sock;
        pd[i].in_flags = PR_POLL_READ;
    }

    /* first run the test on the primordial thread */
    Test();

    /* then run the test on all three kinds of threads */
    thread = PR_CreateThread(PR_USER_THREAD, ThreadFunc, NULL,
            PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
    if (NULL == thread) {
        fprintf(stderr, "PR_CreateThread failed\n");
        exit(1);
    }
    if (PR_JoinThread(thread) == PR_FAILURE) {
        fprintf(stderr, "PR_JoinThread failed\n");
        exit(1);
    }
    thread = PR_CreateThread(PR_USER_THREAD, ThreadFunc, NULL,
            PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
    if (NULL == thread) {
        fprintf(stderr, "PR_CreateThread failed\n");
        exit(1);
    }
    if (PR_JoinThread(thread) == PR_FAILURE) {
        fprintf(stderr, "PR_JoinThread failed\n");
        exit(1);
    }
    thread = PR_CreateThread(PR_USER_THREAD, ThreadFunc, NULL,
            PR_PRIORITY_NORMAL, PR_GLOBAL_BOUND_THREAD, PR_JOINABLE_THREAD, 0);
    if (NULL == thread) {
        fprintf(stderr, "PR_CreateThread failed\n");
        exit(1);
    }
    if (PR_JoinThread(thread) == PR_FAILURE) {
        fprintf(stderr, "PR_JoinThread failed\n");
        exit(1);
    }
    for (i = 0; i < POLL_DESC_COUNT; i++) {
        if (PR_Close(pd[i].fd) == PR_FAILURE) {
            fprintf(stderr, "PR_Close failed\n");
            exit(1);
        }
    }
    PR_Cleanup();
    printf("PASS\n");
    return 0;
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:74,代码来源:prpollml.c


注:本文中的Test函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。