當前位置: 首頁>>代碼示例>>C++>>正文


C++ CHECK_FALSE函數代碼示例

本文整理匯總了C++中CHECK_FALSE函數的典型用法代碼示例。如果您正苦於以下問題:C++ CHECK_FALSE函數的具體用法?C++ CHECK_FALSE怎麽用?C++ CHECK_FALSE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CHECK_FALSE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ifs

bool EncoderFeatureIndex::openTagSet(const char *filename) {
  std::ifstream ifs(WPATH(filename));
  CHECK_FALSE(ifs) << "no such file or directory: " << filename;

  scoped_fixed_array<char, 8192> line;
  scoped_fixed_array<char *, 1024> column;
  size_t max_size = 0;
  std::set<std::string> candset;

  while (ifs.getline(line.get(), line.size())) {
    if (line[0] == '\0' || line[0] == ' ' || line[0] == '\t') {
      continue;
    }
    const size_t size = tokenize2(line.get(), "\t ",
                                  column.get(), column.size());
    if (max_size == 0) {
      max_size = size;
    }
    CHECK_FALSE(max_size == size)
        << "inconsistent column size: "
        << max_size << " " << size << " " << filename;
    xsize_ = size - 1;
    candset.insert(column[max_size-1]);
  }

  y_.clear();
  for (std::set<std::string>::iterator it = candset.begin();
       it != candset.end(); ++it) {
    y_.push_back(*it);
  }

  ifs.close();

  return true;
}
開發者ID:jlerouge,項目名稱:crfpp-pivaj,代碼行數:35,代碼來源:feature_index.cpp

示例2: CHECK_FALSE

  bool FeatureIndex::buildFeatures(TaggerImpl *tagger) {
    string_buffer os;
    std::vector <int> feature;

    tagger->set_feature_id(feature_cache_.size());

    for (size_t cur = 0; cur < tagger->size(); ++cur) {
      for (std::vector<char *>::const_iterator it = unigram_templs_.begin();
           it != unigram_templs_.end(); ++it) {
        CHECK_FALSE(apply_rule(&os, *it, cur, *tagger))
          << " format error: " << *it;
        ADD;
      }
      feature_cache_.add(feature);
      feature.clear();
    }

    for (size_t cur = 1; cur < tagger->size(); ++cur) {
      for (std::vector<char *>::const_iterator it = bigram_templs_.begin();
           it != bigram_templs_.end(); ++it) {
        CHECK_FALSE(apply_rule(&os, *it, cur, *tagger))
          << "format error: " << *it;
        ADD;
      }
      feature_cache_.add(feature);
      feature.clear();
    }

    return true;
  }
開發者ID:Akirato,項目名稱:postagger-english-hindi,代碼行數:30,代碼來源:feature.cpp

示例3: finalize_heap_object

value_t finalize_heap_object(value_t garbage) {
  CHECK_DOMAIN(vdHeapObject, garbage);
  value_t header = get_heap_object_header(garbage);
  CHECK_FALSE("finalizing live object", in_domain(vdMovedObject, header));
  family_behavior_t *behavior = get_species_family_behavior(header);
  garbage_value_t wrapper = {garbage};
  CHECK_FALSE("finalizing object without finalizer", behavior->finalize == NULL);
  return (behavior->finalize(wrapper));
}
開發者ID:tundra,項目名稱:neutrino,代碼行數:9,代碼來源:behavior.c

示例4: CHECK_FALSE

bool DecoderFeatureIndex::openFromArray(const char *ptr, size_t size) {
  unsigned int version_ = 0;
  const char *end = ptr + size;
  read_static<unsigned int>(&ptr, &version_);

  CHECK_FALSE(version_ / 100 == version / 100)
      << "model version is different: " << version_
      << " vs " << version;
  int type = 0;
  read_static<int>(&ptr, &type);
  read_static<double>(&ptr, &cost_factor_);
  read_static<unsigned int>(&ptr, &maxid_);
  read_static<unsigned int>(&ptr, &xsize_);

  unsigned int dsize = 0;
  read_static<unsigned int>(&ptr, &dsize);

  unsigned int y_str_size;
  read_static<unsigned int>(&ptr, &y_str_size);
  const char *y_str = read_ptr(&ptr, y_str_size);
  size_t pos = 0;
  while (pos < y_str_size) {
    y_.push_back(y_str + pos);
    while (y_str[pos++] != '\0') {}
  }

  unsigned int tmpl_str_size;
  read_static<unsigned int>(&ptr, &tmpl_str_size);
  const char *tmpl_str = read_ptr(&ptr, tmpl_str_size);
  pos = 0;
  while (pos < tmpl_str_size) {
    const char *v = tmpl_str + pos;
    if (v[0] == '\0') {
      ++pos;
    } else if (v[0] == 'U') {
      unigram_templs_.push_back(v);
    } else if (v[0] == 'B') {
      bigram_templs_.push_back(v);
    } else {
      CHECK_FALSE(true) << "unknown type: " << v;
    }
    while (tmpl_str[pos++] != '\0') {}
  }

  make_templs(unigram_templs_, bigram_templs_, &templs_);

  da_.set_array(const_cast<char *>(ptr));
  ptr += dsize;

  alpha_float_ = reinterpret_cast<const float *>(ptr);
  ptr += sizeof(alpha_float_[0]) * maxid_;

  CHECK_FALSE(ptr == end) << "model file is broken.";

  return true;
}
開發者ID:jlerouge,項目名稱:crfpp-pivaj,代碼行數:56,代碼來源:feature_index.cpp

示例5: TEST

TEST(Systick, Systick_CTRL_CLK_SRC) {
  // Check initial state is 0
  CHECK_FALSE(TM4C123GH6PM::SYSTICK::CTRL::CLK_SRC::test());
  // Set
  TM4C123GH6PM::SYSTICK::CTRL::CLK_SRC::set();
  CHECK(TM4C123GH6PM::SYSTICK::CTRL::CLK_SRC::test());
  // Reset
  TM4C123GH6PM::SYSTICK::CTRL::CLK_SRC::reset();
  CHECK_FALSE(TM4C123GH6PM::SYSTICK::CTRL::CLK_SRC::test());
}
開發者ID:amilendra,項目名稱:tiva-launchpad,代碼行數:10,代碼來源:systickTest.cpp

示例6: TEST

TEST(SlimUtil, StringStartsWith)
{
    CHECK(CSlim_StringStartsWith("", ""));
    CHECK_FALSE(CSlim_StringStartsWith("", "a"));
    CHECK_FALSE(CSlim_StringStartsWith("a", "ab"));
    CHECK(CSlim_StringStartsWith("a", ""));
    CHECK(CSlim_StringStartsWith("a", "a"));
    CHECK(CSlim_StringStartsWith("ab", "a"));
    CHECK_FALSE(CSlim_StringStartsWith("a", "b"));
    CHECK(CSlim_StringStartsWith("abc", "ab"));
    CHECK_FALSE(CSlim_StringStartsWith("abc", "ac"));
}
開發者ID:dougbradbury,項目名稱:cslim,代碼行數:12,代碼來源:SlimUtilTest.cpp

示例7: IMPLEMENT_TEST

IMPLEMENT_TEST(AnnotationGroupUnitTest, groupHierarchy) {
    const U2DbiRef dbiRef(getDbiRef());
    SharedAnnotationData anData = createTestAnnotationData();
    const QString groupName1 = "subgroup1";
    const QString groupName2 = "subgroup1/subgroup11";
    const QString groupName3 = "subgroup2/subgroup21";

    AnnotationTableObject ft("aname_table", dbiRef);
    ft.addAnnotations(QList<SharedAnnotationData>() << anData, groupName1);
    ft.addAnnotations(QList<SharedAnnotationData>() << anData, groupName2);
    ft.addAnnotations(QList<SharedAnnotationData>() << anData, groupName3);

    AnnotationGroup *rootGroup = ft.getRootGroup();
    CHECK_FALSE(rootGroup->isTopLevelGroup(), "Unexpected top level group");
    CHECK_EQUAL(1, rootGroup->getGroupDepth(), "Root group's depth");
    CHECK_EQUAL(QString(), rootGroup->getGroupPath(), "Root group's path");

    const QList<AnnotationGroup *> subgroups = rootGroup->getSubgroups();
    CHECK_EQUAL(2, subgroups.size(), "Count of subgroups");

    QBitArray groupMatches(2, false);
    foreach (AnnotationGroup *subgroup, subgroups) {
        CHECK_TRUE(subgroup->isTopLevelGroup(), "Unexpected top level group");
        CHECK_TRUE(rootGroup->isParentOf(subgroup), "Unexpected parent group");
        CHECK_EQUAL(2, subgroup->getGroupDepth(), "Subgroup's depth");

        U2OpStatusImpl os;
        const U2Feature f = U2FeatureUtils::getFeatureById(subgroup->id, dbiRef, os);
        CHECK_NO_ERROR(os);
        AnnotationGroup *secondLevelSubgroup = subgroup;
        if ("subgroup1" == f.name) {
            groupMatches.setBit(0, true);
            CHECK_EQUAL("subgroup1", subgroup->getGroupPath(), "Subgroup's path");

            const QList<AnnotationGroup *> secondLevelSubgroups = subgroup->getSubgroups();
            CHECK_EQUAL(1, secondLevelSubgroups.size(), "Count of 2nd level subgroups");

            secondLevelSubgroup = secondLevelSubgroups.first();
            CHECK_EQUAL("subgroup1/subgroup11", secondLevelSubgroup->getGroupPath(), "Subgroup's path");
        } else if ("subgroup2" == f.name) {
            groupMatches.setBit(1, true);
            CHECK_EQUAL("subgroup2", subgroup->getGroupPath(), "Subgroup's path");

            const QList<AnnotationGroup *> secondLevelSubgroups = subgroup->getSubgroups();
            CHECK_EQUAL(1, secondLevelSubgroups.size(), "Count of 2nd level subgroups");

            secondLevelSubgroup = secondLevelSubgroups.first();
            CHECK_EQUAL("subgroup2/subgroup21", secondLevelSubgroup->getGroupPath(), "Subgroup's path");
        }
        CHECK_FALSE(secondLevelSubgroup->isTopLevelGroup(), "Unexpected top level group");
        CHECK_TRUE(subgroup->isParentOf(secondLevelSubgroup), "Unexpected parent group");
        CHECK_EQUAL(3, secondLevelSubgroup->getGroupDepth(), "Subgroup's depth");
    }
開發者ID:m-angelov,項目名稱:ugene,代碼行數:53,代碼來源:AnnotationGroupUnitTests.cpp

示例8: TEST

    TEST(Logging, CheckBool)
    {
        bool b1 = true;
        bool b2 = false;
        char const * message = "message";

        CHECK_TRUE(b1) << message;
        CHECK_FALSE(b2) << message;

        EXPECT_THROW(CHECK_TRUE(b2) << message, Logging::CheckException);
        EXPECT_THROW(CHECK_FALSE(b1) << message, Logging::CheckException);
    }
開發者ID:BitFunnel,項目名稱:BitFunnel,代碼行數:12,代碼來源:CheckTest.cpp

示例9: IMPLEMENT_TEST

IMPLEMENT_TEST(SQLiteObjectDbiUnitTests, canUndoRedo_noAction) {
    U2OpStatusImpl os;
    U2ObjectDbi* objDbi = SQLiteObjectDbiTestData::getSQLiteObjectDbi();

    // Create test msa
    U2DataId msaId = SQLiteObjectDbiTestData::createTestMsa(true, os);
    CHECK_NO_ERROR(os);

    // Verify canUndo/canRedo
    bool undoState = objDbi->canUndo(msaId, os); CHECK_NO_ERROR(os);
    bool redoState = objDbi->canRedo(msaId, os); CHECK_NO_ERROR(os);
    CHECK_FALSE(undoState, "undo state");
    CHECK_FALSE(redoState, "redo state");
}
開發者ID:ggrekhov,項目名稱:ugene,代碼行數:14,代碼來源:SQLiteObjectDbiUnitTests.cpp

示例10: TEST

TEST(GameOfLifeEngine, IsCellAliveReturnsFalseForInvalidCells)
{
  int noOfXCells = 2;
  int noOfYCells = 3;
  int NoOfCellsChecked = 0;

  GameOfLife game(noOfXCells,noOfYCells);

  for (int y = 0; y < noOfYCells; y++)
  {
    CHECK_FALSE(game.IsCellAlive(-1,y));
    CHECK_FALSE(game.IsCellAlive(noOfXCells+1,y));
    NoOfCellsChecked+=2;;
  }
  for (int x = 0; x < noOfXCells; x++)
  {
    CHECK_FALSE(game.IsCellAlive(x,-1));
    CHECK_FALSE(game.IsCellAlive(x,noOfYCells+1));
    NoOfCellsChecked+=2;
  }
  CHECK_FALSE(game.IsCellAlive(-1,-1));
  CHECK_FALSE(game.IsCellAlive(noOfXCells + 1 , noOfYCells + 1));
  CHECK_FALSE(game.IsCellAlive(noOfXCells + 1 , -1));
  CHECK_FALSE(game.IsCellAlive(-1 , noOfYCells + 1));
  NoOfCellsChecked+=4;

  //Ensure every adjacent boundary cell was checked;
  LONGS_EQUAL((noOfXCells*2+ noOfYCells*2 + 4), NoOfCellsChecked);
}
開發者ID:aiktat,項目名稱:TDDExercise,代碼行數:29,代碼來源:TestGameOfLifeEngine.cpp

示例11: TEST

TEST(BitManip, IfBitNumber_False)
{
  eightBit = 0xff;
  eightBit &= ~(1<<4);

  CHECK_FALSE(IF_BIT_NUMBER(eightBit, 4));
}
開發者ID:KevinWMatthews,項目名稱:Project,代碼行數:7,代碼來源:Test_BitManip.cpp

示例12: object_tracker_to_safe_value

safe_value_t object_tracker_to_safe_value(object_tracker_t *handle) {
  value_t target = handle->value;
  safe_value_t s_result;
  s_result.as_value.encoded = ((address_arith_t) handle) + get_value_domain(target);
  CHECK_FALSE("cast into condition", safe_value_is_immediate(s_result));
  return s_result;
}
開發者ID:plesner,項目名稱:neutrino,代碼行數:7,代碼來源:safe.c

示例13: TEST

TEST(filter, match_false){
	char * filter_str = my_strdup("(&(test_attr1=attr1)(&(test_attr2=attr2)(test_attr3=attr3)))");
	filter_pt filter = filter_create(filter_str);
	properties_pt props = properties_create();
	char * key = my_strdup("test_attr1");
	char * val = my_strdup("attr1");
	char * key2 = my_strdup("test_attr2");
	char * val2 = my_strdup("attr2");
	properties_set(props, key, val);
	properties_set(props, key2, val2);

	bool result = true;
	filter_match(filter, props, &result);
	CHECK_FALSE(result);

	//cleanup
	properties_destroy(props);
	filter_destroy(filter);
	free(filter_str);
	free(key);
	free(key2);
	free(val);
	free(val2);

	mock().checkExpectations();
}
開發者ID:ErjanAltena,項目名稱:celix,代碼行數:26,代碼來源:filter_test.cpp

示例14: functionThatReturnsAValue

static int functionThatReturnsAValue()
{
    CHECK(0 == 0);
    CHECK_TEXT(0 == 0, "Shouldn't fail");
    CHECK_TRUE(0 == 0);
    CHECK_TRUE_TEXT(0 == 0, "Shouldn't fail");
    CHECK_FALSE(0 != 0);
    CHECK_FALSE_TEXT(0 != 0, "Shouldn't fail");
    LONGS_EQUAL(1,1);
    LONGS_EQUAL_TEXT(1, 1, "Shouldn't fail");
    BYTES_EQUAL(0xab,0xab);
    BYTES_EQUAL_TEXT(0xab, 0xab, "Shouldn't fail");
    CHECK_EQUAL(100,100);
    CHECK_EQUAL_TEXT(100, 100, "Shouldn't fail");
    STRCMP_EQUAL("THIS", "THIS");
    STRCMP_EQUAL_TEXT("THIS", "THIS", "Shouldn't fail");
    DOUBLES_EQUAL(1.0, 1.0, .01);
    DOUBLES_EQUAL_TEXT(1.0, 1.0, .01, "Shouldn't fail");
    POINTERS_EQUAL(0, 0);
    POINTERS_EQUAL_TEXT(0, 0, "Shouldn't fail");
    MEMCMP_EQUAL("THIS", "THIS", 5);
    MEMCMP_EQUAL_TEXT("THIS", "THIS", 5, "Shouldn't fail");
    BITS_EQUAL(0x01, (unsigned char )0x01, 0xFF);
    BITS_EQUAL(0x0001, (unsigned short )0x0001, 0xFFFF);
    BITS_EQUAL(0x00000001, (unsigned long )0x00000001, 0xFFFFFFFF);
    BITS_EQUAL_TEXT(0x01, (unsigned char )0x01, 0xFF, "Shouldn't fail");
    return 0;
}
開發者ID:Andne,項目名稱:cpputest,代碼行數:28,代碼來源:TestUTestMacro.cpp

示例15: TEST

TEST(Handle, Validity)
{
  gfx::Handle invalid;
  gfx::Handle valid(1, 2, 3);

  CHECK_FALSE(invalid.isValid());
  CHECK_TRUE(valid.isValid());
}
開發者ID:whztt07,項目名稱:xogre,代碼行數:8,代碼來源:TestHandle.cpp


注:本文中的CHECK_FALSE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。