Fixed Unit Tests

This commit is contained in:
Speiger 2022-12-07 08:22:45 +01:00
parent aa580c1772
commit 4c52636c23
5 changed files with 15 additions and 18 deletions

View File

@ -59,8 +59,8 @@ public class MapModule extends BaseModule
} }
if(implementations && isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE"); if(implementations && isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE");
if(implementations && isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE"); if(implementations && isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE");
if(hashMap) addFlag("HASH_MAP_FEATURE"); if(hashMap) addFlag("MAP_FEATURE");
if(customHashMap) addFlag("CUSTOM_HASH_MAP_FEATURE"); if(customHashMap) addFlag("CUSTOM_MAP_FEATURE");
if(enumMap) addFlag("ENUM_MAP_FEATURE"); if(enumMap) addFlag("ENUM_MAP_FEATURE");
} }
@ -104,7 +104,7 @@ public class MapModule extends BaseModule
//Test Classes //Test Classes
addBlockedFiles("TestMap", "MapTests", "MapTestSuiteBuilder", "MapConstructorTests", "TestMapGenerator", "SimpleMapTestGenerator", "DerivedMapGenerators", "AbstractMapTester"); addBlockedFiles("TestMap", "MapTests", "MapTestSuiteBuilder", "MapConstructorTests", "TestMapGenerator", "SimpleMapTestGenerator", "DerivedMapGenerators", "AbstractMapTester");
addBlockedFiles("TestSortedMapGenerator", "NavigableMapTestSuiteBuilder", "SortedMapTestSuiteBuilder"); addBlockedFiles("TestSortedMapGenerator", "OrderedMapTestSuiteBuilder", "NavigableMapTestSuiteBuilder", "SortedMapTestSuiteBuilder");
addBlockedFiles("TestOrderedMapGenerator"); addBlockedFiles("TestOrderedMapGenerator");
addBlockedFilter(T -> T.endsWith("Tester") && (T.startsWith("Map") || T.startsWith("OrderedMap") || T.startsWith("SortedMap") || T.startsWith("NavigableMap"))); addBlockedFilter(T -> T.endsWith("Tester") && (T.startsWith("Map") || T.startsWith("OrderedMap") || T.startsWith("SortedMap") || T.startsWith("NavigableMap")));
} }

View File

@ -90,10 +90,11 @@ public class SetModule extends BaseModule
addBlockedFiles("Set", "Sets", "AbstractSet", "OpenHashSet", "OpenCustomHashSet", "ImmutableOpenHashSet"); addBlockedFiles("Set", "Sets", "AbstractSet", "OpenHashSet", "OpenCustomHashSet", "ImmutableOpenHashSet");
//Test Classes //Test Classes
addBlockedFiles("SetTests", "SetTestSuiteBuilder"); addBlockedFiles("SetTests", "SetTestSuiteBuilder", "TestSetGenerator");
addBlockedFiles("OrderedSetTestSuiteBuilder", "TestOrderedSetGenerator", "OrderedSetMoveTester", "OrderedSetNavigationTester", "OrderedSetIterationTester"); addBlockedFiles("OrderedSetTestSuiteBuilder", "TestOrderedSetGenerator", "OrderedSetMoveTester", "OrderedSetNavigationTester", "OrderedSetIterationTester");
addBlockedFiles("SortedSetTestSuiteBuilder", "TestSortedSetGenerator", "SortedSetNaviationTester", "SortedSetSubsetTestSetGenerator", "SortedSetIterationTester", "SortedSetNaviationTester"); addBlockedFiles("SortedSetTestSuiteBuilder", "TestSortedSetGenerator", "SortedSetNaviationTester", "SortedSetSubsetTestSetGenerator", "SortedSetIterationTester", "SortedSetNaviationTester");
addBlockedFiles("NavigableSetTestSuiteBuilder", "TestNavigableSetGenerator", "NavigableSetNavigationTester"); addBlockedFiles("NavigableSetTestSuiteBuilder", "TestNavigableSetGenerator", "NavigableSetNavigationTester");
addBlockedFiles("MinimalSet", "AbstractSetTester", "SetAddAllTester", "SetAddTester", "SetCreationTester", "SetEqualsTester", "SetRemoveTester");
} }
} }

View File

@ -7,7 +7,9 @@ import com.google.common.collect.testing.features.CollectionSize;
import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.COLLECTION;
import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.lists.ARRAY_LIST;
import speiger.src.testers.PACKAGE.tests.base.ABSTRACT_LIST_TESTER; import speiger.src.testers.PACKAGE.tests.base.ABSTRACT_LIST_TESTER;
#if !TYPE_BOOLEAN
import speiger.src.testers.PACKAGE.utils.MINIMAL_SET; import speiger.src.testers.PACKAGE.utils.MINIMAL_SET;
#endif
@Ignore @Ignore
@SuppressWarnings("javadoc") @SuppressWarnings("javadoc")
@ -38,8 +40,10 @@ public class FILE_KEY_TYPEListEqualsTester KEY_GENERIC_TYPE extends ABSTRACT_LIS
COLLECTION KEY_GENERIC_TYPE moreElements = getSampleElements(getNumElements() + 1); COLLECTION KEY_GENERIC_TYPE moreElements = getSampleElements(getNumElements() + 1);
assertFalse("Lists of different sizes should not be equal.", getList().equals(new ARRAY_LISTBRACES(moreElements))); assertFalse("Lists of different sizes should not be equal.", getList().equals(new ARRAY_LISTBRACES(moreElements)));
} }
#if !TYPE_BOOLEAN
public void testEquals_set() { public void testEquals_set() {
assertFalse("A List should never equal a Set.", getList().equals(MINIMAL_SET.of(getList()))); assertFalse("A List should never equal a Set.", getList().equals(MINIMAL_SET.of(getList())));
} }
#endif
} }

View File

@ -94,22 +94,14 @@ public class PAIRTester KEY_VALUE_GENERIC_TYPE extends TestCase
@Test @Test
public void testKeyMatching() { public void testKeyMatching() {
#if TYPE_OBJECT PAIR KEY_VALUE_GENERIC_TYPE pair = keyConstructor.apply(getKey());
PAIR KEY_VALUE_GENERIC_TYPE pair = keyConstructor.getObject(getKey());
#else
PAIR KEY_VALUE_GENERIC_TYPE pair = keyConstructor.GET_VALUE(getKey());
#endif
assertEquals(getKey(), pair.ENTRY_KEY()); assertEquals(getKey(), pair.ENTRY_KEY());
assertEquals(EMPTY_VALUE, pair.ENTRY_VALUE()); assertEquals(EMPTY_VALUE, pair.ENTRY_VALUE());
} }
@Test @Test
public void testValueMatching() { public void testValueMatching() {
#if VALUE_OBJECT PAIR KEY_VALUE_GENERIC_TYPE pair = valueConstructor.apply(getValue());
PAIR KEY_VALUE_GENERIC_TYPE pair = valueConstructor.getObject(getValue());
#else
PAIR KEY_VALUE_GENERIC_TYPE pair = valueConstructor.get(getValue());
#endif
assertEquals(EMPTY_KEY_VALUE, pair.ENTRY_KEY()); assertEquals(EMPTY_KEY_VALUE, pair.ENTRY_KEY());
assertEquals(getValue(), pair.ENTRY_VALUE()); assertEquals(getValue(), pair.ENTRY_VALUE());
} }

View File

@ -9,7 +9,7 @@ import org.junit.Ignore;
import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.CollectionSize;
import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.COLLECTION;
import speiger.src.collections.PACKAGE.utils.SETS; import speiger.src.collections.PACKAGE.utils.COLLECTIONS;
import speiger.src.testers.PACKAGE.tests.base.ABSTRACT_QUEUE_TESTER; import speiger.src.testers.PACKAGE.tests.base.ABSTRACT_QUEUE_TESTER;
@Ignore @Ignore
@ -24,7 +24,7 @@ public class FILE_KEY_TYPEQueueFilterTester KEY_GENERIC_TYPE extends ABSTRACT_QU
@CollectionSize.Require(absent = CollectionSize.ZERO) @CollectionSize.Require(absent = CollectionSize.ZERO)
#endignore #endignore
public void testQueueFilter_filterElement() { public void testQueueFilter_filterElement() {
assertFalse(expectMissing(SETS.singleton(e0()), queue.filter(T -> KEY_EQUALS(T, e0())).pourAsList().TO_ARRAY())); assertFalse(expectMissing(COLLECTIONS.singleton(e0()), queue.filter(T -> KEY_EQUALS(T, e0())).pourAsList().TO_ARRAY()));
} }
#ignore #ignore
@ -38,7 +38,7 @@ public class FILE_KEY_TYPEQueueFilterTester KEY_GENERIC_TYPE extends ABSTRACT_QU
@CollectionSize.Require(CollectionSize.SEVERAL) @CollectionSize.Require(CollectionSize.SEVERAL)
#endignore #endignore
public void testQueueFilter_filterSeveral() { public void testQueueFilter_filterSeveral() {
assertTrue(expectMissing(SETS.singleton(e1()), queue.filter(T -> KEY_EQUALS_NOT(T, e1())).pourAsList().TO_ARRAY())); assertTrue(expectMissing(COLLECTIONS.singleton(e1()), queue.filter(T -> KEY_EQUALS_NOT(T, e1())).pourAsList().TO_ARRAY()));
} }
protected boolean expectMissing(COLLECTION KEY_GENERIC_TYPE result, KEY_OBJECT_TYPE...elements) protected boolean expectMissing(COLLECTION KEY_GENERIC_TYPE result, KEY_OBJECT_TYPE...elements)