Package org.openquark.cal.filter

Examples of org.openquark.cal.filter.AcceptAllQualifiedNamesFilter


        assertEquals(1, workspaceSourceMetrics.getGemReferenceFrequency(QualifiedName.make(CALPlatformTestModuleNames.SourceMetricFinder_Test_Support, "leaf7")));
    }
   
    /** Test that regular expression filtering is working */
    public void testReferenceFrequencyRegexpFiltering() {
        Map<Pair<QualifiedName, QualifiedName>, Integer> unfilteredMap = SourceMetricFinder.computeReferenceFrequencies(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false);
        Map<Pair<QualifiedName, QualifiedName>, Integer> filteredMap = SourceMetricFinder.computeReferenceFrequencies(moduleDefn, moduleTypeInfo, new RegExpBasedUnqualifiedNameFilter(".*Examples", true), false);

        int unfilteredFrequency = 0;
        int filteredFrequency = 0;
       
View Full Code Here


   
    /**
     * Check that the compositional frequency metric behaves basically as we expect.
     */
    public void testCompositionalFrequencyMetric() {
        Map<Pair<QualifiedName, QualifiedName>, Integer> compositionalFrequencies = SourceMetricFinder.computeCompositionalFrequencies(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false);
        assertEquals(1, getCompositionalFrequency(compositionalFrequencies, "callerC1", "mangleValue"));
        assertEquals(2, getCompositionalFrequency(compositionalFrequencies, "mangleValue", "callerC1"));
        assertEquals(3, getCompositionalFrequency(compositionalFrequencies, "stompValue", "callerC1"));
    }
View Full Code Here

        assertEquals(3, getCompositionalFrequency(compositionalFrequencies, "stompValue", "callerC1"));
    }
   
    /**  Check that we handle Prelude.apply in both its function and operator ($) forms */
    public void testCompositionFrequencyApplyHandling() {
        Map<Pair<QualifiedName, QualifiedName>, Integer> compositionalFrequencies = SourceMetricFinder.computeCompositionalFrequencies(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false);
        assertEquals(1, getCompositionalFrequency(compositionalFrequencies, "mangleValue", "callerC2"));
        assertEquals(1, getCompositionalFrequency(compositionalFrequencies, "callerC2", "mangleValue"));
        assertEquals(2, getCompositionalFrequency(compositionalFrequencies, "callerC2a", "mangleValue"));
    }
View Full Code Here

        assertEquals(2, getCompositionalFrequency(compositionalFrequencies, "callerC2a", "mangleValue"));
    }
   
    /**  Check that we handle Prelude.compose in both its function and operator (#) forms */
    public void testCompositionFrequencyComposeHandling() {
        Map<Pair<QualifiedName, QualifiedName>, Integer> compositionalFrequencies = SourceMetricFinder.computeCompositionalFrequencies(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false);
        assertEquals(2, getCompositionalFrequency(compositionalFrequencies, "mangleValue", "callerC3"));
        assertEquals(2, getCompositionalFrequency(compositionalFrequencies, "callerC3", "mangleValue"));
        assertEquals(1, getCompositionalFrequency(compositionalFrequencies, "callerC3", "stompValue"));
    }
View Full Code Here

        assertEquals(1, getCompositionalFrequency(compositionalFrequencies, "callerC3", "stompValue"));
    }
   
    /** Test that we deal properly with lambdas */
    public void testCompositionFrequencyLambdaHandling() {
        Map<Pair<QualifiedName, QualifiedName>, Integer> compositionalFrequencies = SourceMetricFinder.computeCompositionalFrequencies(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false);
        assertEquals(3, getCompositionalFrequency(compositionalFrequencies, "stompValue", "callerC4"));
        assertEquals(1, getCompositionalFrequency(compositionalFrequencies, "callerC4", "mangleValue"));
        assertEquals(0, getCompositionalFrequency(compositionalFrequencies, "mangleValue", "callerC4"));
    }
View Full Code Here

        assertEquals(0, getCompositionalFrequency(compositionalFrequencies, "mangleValue", "callerC4"));
    }

    /** Test regexp-filtering in compositional-frequency computation */
    public void testCompositionalFrequencyRegexpFiltering() {
        Map<Pair<QualifiedName, QualifiedName>, Integer> unfilteredFrequencies = SourceMetricFinder.computeCompositionalFrequencies(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false);
        Map<Pair<QualifiedName, QualifiedName>, Integer> filteredFrequencies = SourceMetricFinder.computeCompositionalFrequencies(moduleDefn, moduleTypeInfo, new RegExpBasedUnqualifiedNameFilter("(.*test.*)|(.*Examples.*)", true), false);

        assertEquals(1, getCompositionalFrequency(filteredFrequencies, "callerC5", "mangleValue"));
        assertEquals(3, getCompositionalFrequency(unfilteredFrequencies, "callerC5", "mangleValue"));
    }
View Full Code Here

        assertEquals(3, getCompositionalFrequency(unfilteredFrequencies, "callerC5", "mangleValue"));
    }
   
    /** Test redundant-lambda detection */
    public void testLintWalkerRedundantLambdas() {
        List<LintWarning> warningList = SourceMetricFinder.computeLintWarnings(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false, false, true, false, false, false);
       
        assertTrue(functionFlagged("l1", LintWarning.WarningType.REDUNDANT_LAMBDA, warningList));
        assertTrue(functionFlagged("l2", LintWarning.WarningType.REDUNDANT_LAMBDA, warningList));
       
        assertFalse(functionFlagged("l3", LintWarning.WarningType.REDUNDANT_LAMBDA, warningList));
View Full Code Here

        assertFalse(functionFlagged("l7", LintWarning.WarningType.REDUNDANT_LAMBDA, warningList));
    }
   
    /** Test unplinged-primitive-arg detection */
    public void testLintWalkerUnplingedPrimitveArgs() {
        List<LintWarning> warningList = SourceMetricFinder.computeLintWarnings(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false, true, false, false, false, false);
       
        assertTrue(functionFlagged("fullyUnplingedPrimitives", LintWarning.WarningType.UNPLINGED_PRIMITIVE_ARG, warningList));
        assertTrue(functionFlagged("partiallyUnplingedPrimitives1", LintWarning.WarningType.UNPLINGED_PRIMITIVE_ARG, warningList));
        assertTrue(functionFlagged("partiallyUnplingedPrimitives2", LintWarning.WarningType.UNPLINGED_PRIMITIVE_ARG, warningList));
        assertTrue(functionFlagged("partiallyUnplingedPrimitives3", LintWarning.WarningType.UNPLINGED_PRIMITIVE_ARG, warningList));
View Full Code Here

        assertFalse(functionFlagged("fullyUnplingedAlgebraic", LintWarning.WarningType.UNPLINGED_PRIMITIVE_ARG, warningList));
    }
   
    /** Test unreferenced-private-function detection */
    public void testLintWalkerUnusedPrivates() {
        List<LintWarning> warningList = SourceMetricFinder.computeLintWarnings(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false, false, false, true, false, false);
       
        assertFalse(functionFlagged("unreferencedPublicFunction", LintWarning.WarningType.UNUSED_PRIVATE_FUNCTION, warningList));
        assertFalse(functionFlagged("referenced1", LintWarning.WarningType.UNUSED_PRIVATE_FUNCTION, warningList));
        assertFalse(functionFlagged("referenced2", LintWarning.WarningType.UNUSED_PRIVATE_FUNCTION, warningList));
        assertFalse(functionFlagged("referenced3", LintWarning.WarningType.UNUSED_PRIVATE_FUNCTION, warningList));
View Full Code Here

        assertTrue(functionFlagged("unreferencedPrivate2", LintWarning.WarningType.UNUSED_PRIVATE_FUNCTION, warningList));
    }
   
    /** Test mismatched-plings-on-alias-functions detection */
    public void testLintWalkerMismatchedAliasPlings() {
        List<LintWarning> warningList = SourceMetricFinder.computeLintWarnings(moduleDefn, moduleTypeInfo, new AcceptAllQualifiedNamesFilter(), false, false, false, false, true, false);
       
        assertFalse(functionFlagged("alias1", LintWarning.WarningType.MISMATCHED_ALIAS_PLINGS, warningList));
        assertFalse(functionFlagged("alias2", LintWarning.WarningType.MISMATCHED_ALIAS_PLINGS, warningList));
        assertFalse(functionFlagged("alias3", LintWarning.WarningType.MISMATCHED_ALIAS_PLINGS, warningList));
        assertFalse(functionFlagged("alias4", LintWarning.WarningType.MISMATCHED_ALIAS_PLINGS, warningList));
View Full Code Here

TOP

Related Classes of org.openquark.cal.filter.AcceptAllQualifiedNamesFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.