本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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;
}
示例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());
}
示例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"));
}
示例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");
}
示例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);
}
示例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");
}
示例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);
}
示例11: TEST
TEST(BitManip, IfBitNumber_False)
{
eightBit = 0xff;
eightBit &= ~(1<<4);
CHECK_FALSE(IF_BIT_NUMBER(eightBit, 4));
}
示例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;
}
示例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();
}
示例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;
}
示例15: TEST
TEST(Handle, Validity)
{
gfx::Handle invalid;
gfx::Handle valid(1, 2, 3);
CHECK_FALSE(invalid.isValid());
CHECK_TRUE(valid.isValid());
}