本文整理汇总了C#中RevFlagSet.add方法的典型用法代码示例。如果您正苦于以下问题:C# RevFlagSet.add方法的具体用法?C# RevFlagSet.add怎么用?C# RevFlagSet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevFlagSet
的用法示例。
在下文中一共展示了RevFlagSet.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testAddTwo
public void testAddTwo() {
final RevFlag flag1 = rw.newFlag("flag_1");
final RevFlag flag2 = rw.newFlag("flag_2");
assertTrue((flag1.mask & flag2.mask) == 0);
final RevFlagSet set = new RevFlagSet();
assertTrue(set.add(flag1));
assertTrue(set.add(flag2));
assertEquals(flag1.mask | flag2.mask, set.mask);
assertEquals(2, set.size());
}
示例2: testAddOne
public void testAddOne() {
final String flagName = "flag";
final RevFlag flag = rw.newFlag(flagName);
assertTrue(0 != flag.mask);
assertSame(flagName, flag.name);
final RevFlagSet set = new RevFlagSet();
assertTrue(set.add(flag));
assertFalse(set.add(flag));
assertEquals(flag.mask, set.mask);
assertEquals(1, set.size());
final Iterator<RevFlag> i = set.iterator();
assertTrue(i.hasNext());
assertSame(flag, i.next());
assertFalse(i.hasNext());
}
示例3: testContainsAll
public void testContainsAll() {
final RevFlag flag1 = rw.newFlag("flag_1");
final RevFlag flag2 = rw.newFlag("flag_2");
final RevFlagSet set1 = new RevFlagSet();
assertTrue(set1.add(flag1));
assertTrue(set1.add(flag2));
assertTrue(set1.containsAll(set1));
assertTrue(set1.containsAll(Arrays
.asList(new RevFlag[] { flag1, flag2 })));
final RevFlagSet set2 = new RevFlagSet();
set2.add(rw.newFlag("flag_3"));
assertFalse(set1.containsAll(set2));
}
示例4: testContains
public void testContains() {
final RevFlag flag1 = rw.newFlag("flag_1");
final RevFlag flag2 = rw.newFlag("flag_2");
final RevFlagSet set = new RevFlagSet();
set.add(flag1);
assertTrue(set.contains(flag1));
assertFalse(set.contains(flag2));
assertFalse(set.contains("bob"));
}
示例5: testRemove
public void testRemove() {
final RevFlag flag1 = rw.newFlag("flag_1");
final RevFlag flag2 = rw.newFlag("flag_2");
final RevFlagSet set = new RevFlagSet();
assertTrue(set.add(flag1));
assertTrue(set.add(flag2));
assertTrue(set.remove(flag1));
assertFalse(set.remove(flag1));
assertEquals(flag2.mask, set.mask);
assertFalse(set.contains(flag1));
}
示例6: testEquals
public void testEquals() {
final RevFlag flag1 = rw.newFlag("flag_1");
final RevFlag flag2 = rw.newFlag("flag_2");
final RevFlagSet set = new RevFlagSet();
assertTrue(set.add(flag1));
assertTrue(set.add(flag2));
assertTrue(new RevFlagSet(set).equals(set));
assertTrue(new RevFlagSet(Arrays.asList(new RevFlag[] { flag1, flag2 }))
.equals(set));
}