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


C++ FileStore::nfiles方法代码示例

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


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

示例1: initTester

//---------------------------------------------------------------------------
int FileStore_T :: testEverything()
{
   TestUtil  initTester(   "FileStore", "initialization", __FILE__, __LINE__ );
   TestUtil  sizeTester(   "FileStore", "size",           __FILE__, __LINE__ );
   TestUtil  nfilesTester( "FileStore", "nfiles",         __FILE__, __LINE__ );
   TestUtil  clearTester(  "FileStore", "clear",          __FILE__, __LINE__ );
   TestUtil  getTester(    "FileStore", "getFilenames",   __FILE__, __LINE__ );
   TestUtil  addTester(    "FileStore", "addFile",        __FILE__, __LINE__ );
   TestUtil  headerTester( "FileStore", "getHeader",      __FILE__, __LINE__ );

   try   // default initialization
   {
      FileStore<TestHeaderType>  store;
      initTester.assert( true, "unexpected exception", __LINE__ );
   }
   catch (...)
   {
      initTester.assert( false, "unexpected exception", __LINE__ );
   }

   FileStore<TestHeaderType>  store;  // Use this for the remaining tests

   try   // empty store (size)
   {      
      sizeTester.assert( (0 == store.size() ), "empty store expected", __LINE__ );
   }
   catch (...)
   {
      sizeTester.assert( false, "unexpected exception", __LINE__ );
   }

   try   // empty store (nfiles)
   {
      nfilesTester.assert( (0 == store.nfiles() ), "empty store expected", __LINE__ );
   }
   catch (...)
   {
      nfilesTester.assert( false, "unexpected exception", __LINE__ );
   }

   try   // empty store (getFilenames)
   {
      getTester.assert( (0 == store.getFileNames().size() ), "empty store expected", __LINE__ );
   }
   catch (...)
   {
      getTester.assert( false, "unexpected exception", __LINE__ );
   }

   try   // empty store (clear)
   {
      store.clear();
      clearTester.assert( true, "unexpected exception", __LINE__ );
   }
   catch (...)
   {
      clearTester.assert( false, "unexpected exception", __LINE__ );
   }

   try   // empty store (getHeader)
   {
      const TestHeaderType&  header = store.getHeader("filename");
      headerTester.assert( false, "expected exception", __LINE__ );
   }
   catch (InvalidRequest& ire)
   {
      headerTester.assert( true, "expected exception", __LINE__ );
   }
   catch (...)
   {
      headerTester.assert( false, "unexpected exception", __LINE__ );
   }

   try   // empty store (addFile)
   {
      TestHeaderType  header(1);
      store.addFile("testfile1", header);

      addTester.assert( true, "unexpected exception", __LINE__ );
      sizeTester.assert( (1 == store.size() ), "single file expected", __LINE__ );
      nfilesTester.assert( (1 == store.nfiles() ), "single file expected", __LINE__ );

      std::vector<std::string>  filenames = store.getFileNames();
      getTester.assert( (1 == filenames.size() ), "single file expected", __LINE__ );
      if (filenames.size() > 0)
      {
         getTester.assert( (0 == filenames[0].compare("testfile1") ), "unexpected filename", __LINE__ );
      }
   }
   catch (...)
   {
      addTester.assert( false, "unexpected exception", __LINE__ );
   }

   try   // non-empty store (getHeader, present)
   {
      const TestHeaderType&  header = store.getHeader("testfile1");
      headerTester.assert( true, "unexpected exception", __LINE__ );
      headerTester.assert( (1 == header.value), "unexpected header", __LINE__ );
//.........这里部分代码省略.........
开发者ID:PPNav,项目名称:GPSTk,代码行数:101,代码来源:FileStore_T.cpp


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