From 4c52636c23e17b01a545bc29220c5ab72b2f229c Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 08:22:45 +0100 Subject: [PATCH] Fixed Unit Tests --- .../java/speiger/src/builder/modules/MapModule.java | 6 +++--- .../java/speiger/src/builder/modules/SetModule.java | 3 ++- .../templates/tests/list/ListEqualsTester.template | 6 +++++- .../testers/templates/tests/misc/PairTester.template | 12 ++---------- .../tests/queue/iterators/QueueFilterTester.template | 6 +++--- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index f325adc2..5f162d5a 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -59,8 +59,8 @@ public class MapModule extends BaseModule } if(implementations && isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE"); if(implementations && isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE"); - if(hashMap) addFlag("HASH_MAP_FEATURE"); - if(customHashMap) addFlag("CUSTOM_HASH_MAP_FEATURE"); + if(hashMap) addFlag("MAP_FEATURE"); + if(customHashMap) addFlag("CUSTOM_MAP_FEATURE"); if(enumMap) addFlag("ENUM_MAP_FEATURE"); } @@ -104,7 +104,7 @@ public class MapModule extends BaseModule //Test Classes addBlockedFiles("TestMap", "MapTests", "MapTestSuiteBuilder", "MapConstructorTests", "TestMapGenerator", "SimpleMapTestGenerator", "DerivedMapGenerators", "AbstractMapTester"); - addBlockedFiles("TestSortedMapGenerator", "NavigableMapTestSuiteBuilder", "SortedMapTestSuiteBuilder"); + addBlockedFiles("TestSortedMapGenerator", "OrderedMapTestSuiteBuilder", "NavigableMapTestSuiteBuilder", "SortedMapTestSuiteBuilder"); addBlockedFiles("TestOrderedMapGenerator"); addBlockedFilter(T -> T.endsWith("Tester") && (T.startsWith("Map") || T.startsWith("OrderedMap") || T.startsWith("SortedMap") || T.startsWith("NavigableMap"))); } diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index 6e06b98b..0617e175 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -90,10 +90,11 @@ public class SetModule extends BaseModule addBlockedFiles("Set", "Sets", "AbstractSet", "OpenHashSet", "OpenCustomHashSet", "ImmutableOpenHashSet"); //Test Classes - addBlockedFiles("SetTests", "SetTestSuiteBuilder"); + addBlockedFiles("SetTests", "SetTestSuiteBuilder", "TestSetGenerator"); addBlockedFiles("OrderedSetTestSuiteBuilder", "TestOrderedSetGenerator", "OrderedSetMoveTester", "OrderedSetNavigationTester", "OrderedSetIterationTester"); addBlockedFiles("SortedSetTestSuiteBuilder", "TestSortedSetGenerator", "SortedSetNaviationTester", "SortedSetSubsetTestSetGenerator", "SortedSetIterationTester", "SortedSetNaviationTester"); addBlockedFiles("NavigableSetTestSuiteBuilder", "TestNavigableSetGenerator", "NavigableSetNavigationTester"); + addBlockedFiles("MinimalSet", "AbstractSetTester", "SetAddAllTester", "SetAddTester", "SetCreationTester", "SetEqualsTester", "SetRemoveTester"); } } diff --git a/src/builder/resources/speiger/assets/testers/templates/tests/list/ListEqualsTester.template b/src/builder/resources/speiger/assets/testers/templates/tests/list/ListEqualsTester.template index 7fbb35e7..bfc0b521 100644 --- a/src/builder/resources/speiger/assets/testers/templates/tests/list/ListEqualsTester.template +++ b/src/builder/resources/speiger/assets/testers/templates/tests/list/ListEqualsTester.template @@ -7,7 +7,9 @@ import com.google.common.collect.testing.features.CollectionSize; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.testers.PACKAGE.tests.base.ABSTRACT_LIST_TESTER; +#if !TYPE_BOOLEAN import speiger.src.testers.PACKAGE.utils.MINIMAL_SET; +#endif @Ignore @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); assertFalse("Lists of different sizes should not be equal.", getList().equals(new ARRAY_LISTBRACES(moreElements))); } - + +#if !TYPE_BOOLEAN public void testEquals_set() { assertFalse("A List should never equal a Set.", getList().equals(MINIMAL_SET.of(getList()))); } +#endif } diff --git a/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template b/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template index d9575c33..ce052a1f 100644 --- a/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template +++ b/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template @@ -94,22 +94,14 @@ public class PAIRTester KEY_VALUE_GENERIC_TYPE extends TestCase @Test public void testKeyMatching() { -#if TYPE_OBJECT - PAIR KEY_VALUE_GENERIC_TYPE pair = keyConstructor.getObject(getKey()); -#else - PAIR KEY_VALUE_GENERIC_TYPE pair = keyConstructor.GET_VALUE(getKey()); -#endif + PAIR KEY_VALUE_GENERIC_TYPE pair = keyConstructor.apply(getKey()); assertEquals(getKey(), pair.ENTRY_KEY()); assertEquals(EMPTY_VALUE, pair.ENTRY_VALUE()); } @Test public void testValueMatching() { -#if VALUE_OBJECT - PAIR KEY_VALUE_GENERIC_TYPE pair = valueConstructor.getObject(getValue()); -#else - PAIR KEY_VALUE_GENERIC_TYPE pair = valueConstructor.get(getValue()); -#endif + PAIR KEY_VALUE_GENERIC_TYPE pair = valueConstructor.apply(getValue()); assertEquals(EMPTY_KEY_VALUE, pair.ENTRY_KEY()); assertEquals(getValue(), pair.ENTRY_VALUE()); } diff --git a/src/builder/resources/speiger/assets/testers/templates/tests/queue/iterators/QueueFilterTester.template b/src/builder/resources/speiger/assets/testers/templates/tests/queue/iterators/QueueFilterTester.template index 94f5b5e5..f77f3f95 100644 --- a/src/builder/resources/speiger/assets/testers/templates/tests/queue/iterators/QueueFilterTester.template +++ b/src/builder/resources/speiger/assets/testers/templates/tests/queue/iterators/QueueFilterTester.template @@ -9,7 +9,7 @@ import org.junit.Ignore; import com.google.common.collect.testing.features.CollectionSize; 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; @Ignore @@ -24,7 +24,7 @@ public class FILE_KEY_TYPEQueueFilterTester KEY_GENERIC_TYPE extends ABSTRACT_QU @CollectionSize.Require(absent = CollectionSize.ZERO) #endignore 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 @@ -38,7 +38,7 @@ public class FILE_KEY_TYPEQueueFilterTester KEY_GENERIC_TYPE extends ABSTRACT_QU @CollectionSize.Require(CollectionSize.SEVERAL) #endignore 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)