本文整理汇总了C++中CharReach::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CharReach::clear方法的具体用法?C++ CharReach::clear怎么用?C++ CharReach::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharReach
的用法示例。
在下文中一共展示了CharReach::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(ng_charreach, clear) {
CharReach cr;
ASSERT_EQ(0U, cr.count());
ASSERT_TRUE(cr.none());
ASSERT_FALSE(cr.all());
cr.set('q');
cr.set('u');
cr.set('a');
cr.set('r');
cr.set('k');
ASSERT_EQ(5U, cr.count());
cr.clear('r');
ASSERT_EQ(4U, cr.count());
ASSERT_FALSE(cr.test('r'));
cr.setall();
ASSERT_EQ(cr.size(), cr.count());
ASSERT_TRUE(cr.all());
cr.clear(0xff);
ASSERT_FALSE(cr.all());
}
示例2: truffleBuildMasks
TEST(Truffle, CompileChars) {
m128 mask1, mask2;
CharReach chars;
// test one char at a time
for (u32 c = 0; c < 256; ++c) {
mask1 = zeroes128();
mask2 = zeroes128();
chars.clear();
chars.set((u8)c);
truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
CharReach out = truffle2cr((u8 *)&mask1, (u8 *)&mask2);
ASSERT_EQ(out, chars);
}
// set all chars up to dot
for (u32 c = 0; c < 256; ++c) {
mask1 = zeroes128();
mask2 = zeroes128();
chars.set((u8)c);
truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
CharReach out = truffle2cr((u8 *)&mask1, (u8 *)&mask2);
ASSERT_EQ(out, chars);
}
// unset all chars from dot
for (u32 c = 0; c < 256; ++c) {
mask1 = zeroes128();
mask2 = zeroes128();
chars.clear((u8)c);
truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
CharReach out = truffle2cr((u8 *)&mask1, (u8 *)&mask2);
ASSERT_EQ(out, chars);
}
}