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


C++ Pipeline::clear方法代码示例

本文整理汇总了C++中Pipeline::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Pipeline::clear方法的具体用法?C++ Pipeline::clear怎么用?C++ Pipeline::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pipeline的用法示例。


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

示例1: strlen

void
Simple_Command_Parse_Test::test_parse_numeric_arg_1 ()
{
  Pipeline p;

  size_t errorc = 0;

  Simple_Command *c[] = { 0, 0 };

  std::vector<Argument *> *va[] = { 0, 0 };
  Argument *a[] = { 0, 0, 0 };

  const char *pipelinev[] = {
    "filter1 15 5 | filter2 0700",
    "filter1 15 5 2>&1 | filter2 0700 &> filter2.out"
   };

  const char *pipelinevp = 0;

  for (uint idx = 0; idx < 2; idx++)
    {
      try
        {
          pipelinevp = pipelinev[idx];

          p._charc = strlen (pipelinevp);
          p._startp = pipelinevp;
          p._endp = pipelinevp + p._charc;

          p.parse (pipelinevp);

          c[0] = static_cast<Simple_Command *> (p._cmdv.at (0));
          c[1] = static_cast<Simple_Command *> (p._cmdv.at (1));

          va[0] = c[0]->arguments ();
          va[1] = c[1]->arguments ();

          ASSERT_IDX (va[0]->size() == 2);
          ASSERT_IDX (va[1]->size() == 1);

          a[0] = va[0]->at (0);
          a[1] = va[0]->at (1);
          a[2] = va[1]->at (0);

          ASSERT_IDX (Util::strEqu ( a[0]->value(), "15"));
          ASSERT_IDX (Util::strEqu ( a[1]->value(), "5"));
          ASSERT_IDX (Util::strEqu ( a[2]->value(), "0700"));

          p.clear ();
        }
      CATCH_ERROR_PCHAR;
    }
  ASSERT_NO_ERROR;
}
开发者ID:karekoho,项目名称:pipeline,代码行数:54,代码来源:simple_command_parse_unit_test.cpp

示例2: strlen

void
Pipeline_Parse_Test::test_parse_exit_logical_not ()
{
  Pipeline p;

  uint errorc = 0;

  Simple_Command *f[] = { 0, 0, 0 };

  const char *pipelinev[] = {
     "!filter1 | filter2",
     "   !   filter1 | filter2"
   };

  const char *pipelinevp = 0;

  for (uint idx = 0; idx < 2; idx++)
    {
      try
        {
          // p._charc = strlen (pipelinev[idx]);
          // p.__parse (pipelinev[idx]);

          pipelinevp = pipelinev[idx];

          p._charc = strlen (pipelinevp);
          p._startp = pipelinevp;
          p._endp = pipelinevp + p._charc;

          p.parse (pipelinevp);

          // f[0] = p._filters.at (0);
          f[0] = static_cast<Simple_Command *> (p._cmdv.at (0));

          p._exit_status = EXIT_FAILURE;

          CPPUNIT_ASSERT (p._exit_not == true);
          CPPUNIT_ASSERT (p.exit_status () == EXIT_SUCCESS);

          p._exit_status = 2;

          CPPUNIT_ASSERT (p.exit_status () == EXIT_SUCCESS);
          CPPUNIT_ASSERT (Util::strEqu (f[0]->_file, "filter1"));

          p.clear ();
        }
      CATCH_ERROR_PCHAR;
    }

  CPPUNIT_ASSERT (errorc == 0);
}
开发者ID:karekoho,项目名称:pipeline,代码行数:51,代码来源:pipeline_parse_unit_test.cpp


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