项目:cidr-ip-trie
文件:TestPatriciaTrieWithGuava.java
public Test testsForPatriciaTrie() {
return MapTestSuiteBuilder
.using(new TestStringMapGenerator() {
@Override
protected Map<String,String> create(
final Entry<String,String>[] entries) {
return populate(new PatriciaTrie<String>(),entries);
}
})
.named("PatriciaTrie")
.withFeatures(
MapFeature.GENERAL_PURPOSE,MapFeature.ALLOWS_NULL_ENTRY_QUERIES,MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,CollectionFeature.SUPPORTS_IteraTOR_REMOVE,// Assumes Insertion Order if you don't implement SortedMap
// CollectionFeature.KNowN_ORDER,CollectionFeature.SERIALIZABLE,CollectionSize.ANY)
.suppressing(suppressForPatriciaTrie())
.createTestSuite();
}
public static TestSuite suite() throws Exception {
return MapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<String,String> create(Map.Entry<String,String>[] entries) {
ParetoHashMap m = new ParetoHashMap();
//
for (Map.Entry<String,String> entry : entries) {
if (entry == null)
m.put(null,null);
else
m.put(entry.getKey(),entry.getValue());
}
return m;
}
}
).named("ParetoHashMap"
).withFeatures(MapFeature.GENERAL_PURPOSE,CollectionSize.ANY,MapFeature.ALLOWS_NULL_VALUES,MapFeature.ALLOWS_NULL_KEYS
).createTestSuite();
}
项目:PauselessHashMap
文件:PauselessHashMapGuavaTest.java
public Test testsForPauselessHashMap() {
return MapTestSuiteBuilder
.using(new TestStringMapGenerator() {
@Override
protected Map<String,String> create(
Map.Entry<String,String>[] entries) {
return toHashMap(entries);
}
})
.named("HashMap")
.withFeatures(
MapFeature.GENERAL_PURPOSE,MapFeature.ALLOWS_NULL_KEYS,MapFeature.ALLOWS_ANY_NULL_QUERIES,CollectionSize.ANY)
.suppressing(suppressForHashMap())
.createTestSuite();
}
public static TestSuite suite() {
return MapTestSuiteBuilder
.using(new TestStringMapGenerator() {
@Override
protected Map<String,String>[] entries) {
MapBox<String,String> inner = new MapBox<String,String>(MapBoxTest.class,"map").init();
for (Map.Entry<String,String> entry : entries) {
if (entry != null) {
inner.put(entry.getKey(),entry.getValue());
}
}
MapBox<String,String> outer = new MapBox<String,String>(
BoxFamily.getInstance(MapBoxTest.class,"map"));
outer.set(inner);
return outer;
}
})
.named("MapBox")
.withFeatures(
CollectionFeature.ALLOWS_NULL_QUERIES,CollectionFeature.DESCENDING_VIEW,CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,CollectionFeature.SUBSET_VIEW,CollectionFeature.SUPPORTS_REMOVE,MapFeature.GENERAL_PURPOSE,MapFeature.SUPPORTS_PUT,MapFeature.SUPPORTS_REMOVE
).createTestSuite();
}
public static TestSuite suite() {
return MapTestSuiteBuilder
.using(new TestStringMapGenerator() {
@Override
protected Map<String,String>[] entries) {
BoxesMap<String,String> map = new BoxesMap<String,String>().allowBoxlessKeys();
for (Map.Entry<String,String> entry : entries) {
if (entry != null) {
map.put(entry.getKey(),entry.getValue());
}
}
return map;
}
})
.named("BoxesMap")
.withFeatures(
CollectionFeature.ALLOWS_NULL_QUERIES,MapFeature.SUPPORTS_REMOVE
).createTestSuite();
}
public static TestSuite suite() throws Exception {
return MapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<String,String>[] entries) {
ParetoLinkedHashMap m = new ParetoLinkedHashMap();
//
for (Map.Entry<String,String> entry : entries) {
m.put(entry.getKey(),entry.getValue());
}
return m;
}
}).named("ParetoHashMap")
.withFeatures(MapFeature.GENERAL_PURPOSE,MapFeature.ALLOWS_NULL_VALUES)
.createTestSuite();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。