Exemplo n.º 1
0
        public void ComputeMaximalNonzeroEquivalenceClassRepresentativesStartingAt_OnClassicWeaklyButNotStronglyCancellativeExample_IndicatesCancellativityCorrectly()
        {
            var qp = UsefulQPs.GetClassicNonCancellativeQP();

            DoSetup(qp, out var ruleTree);

            if (Computer.SupportsNonCancellativityDetection)
            {
                var settings = GetSettings(CancellativityTypes.Cancellativity);
                var result   = Computer.ComputeMaximalNonzeroEquivalenceClassRepresentativesStartingAt(qp.Quiver, 1, ruleTree, settings);
                Assert.That(result.CancellativityFailureDetected, Is.True);
            }

            if (Computer.SupportsNonWeakCancellativityDetection)
            {
                var settings = GetSettings(CancellativityTypes.WeakCancellativity);
                var result   = Computer.ComputeMaximalNonzeroEquivalenceClassRepresentativesStartingAt(qp.Quiver, 1, ruleTree, settings);
                Assert.That(result.WeakCancellativityFailureDetected, Is.True);
            }

            if (Computer.SupportsNonCancellativityDetection && Computer.SupportsNonWeakCancellativityDetection)
            {
                var settings = GetSettings(CancellativityTypes.WeakCancellativity | CancellativityTypes.Cancellativity);
                var result   = Computer.ComputeMaximalNonzeroEquivalenceClassRepresentativesStartingAt(qp.Quiver, 1, ruleTree, settings);
                Assert.That(result.CancellativityFailureDetected, Is.True);
                Assert.That(result.WeakCancellativityFailureDetected, Is.True);
            }
        }
        public void Analyze_IndicatesCancellativityCorrectly_ForClassicNonCancellativeQP()
        {
            var qp       = UsefulQPs.GetClassicNonCancellativeQP();
            var analyzer = CreateAnalyzer();

            var settings = CreateSettings(CancellativityTypes.Cancellativity);
            var results  = analyzer.Analyze(qp, settings);

            Assert.That(
                results.MainResults.HasFlag(QPAnalysisMainResults.NotCancellative),
                $"The main result was {results.MainResults}, which does not indicate that the QP fails to be cancellative.");

            settings = CreateSettings(CancellativityTypes.WeakCancellativity);
            results  = analyzer.Analyze(qp, settings);
            Assert.That(
                results.MainResults.HasFlag(QPAnalysisMainResults.NotWeaklyCancellative),
                $"The main result was {results.MainResults}, which does not indicate that the QP fails to be weakly cancellative.");

            settings = CreateSettings(CancellativityTypes.Cancellativity | CancellativityTypes.WeakCancellativity);
            results  = analyzer.Analyze(qp, settings);
            Assert.That(
                results.MainResults.HasFlag(QPAnalysisMainResults.NotCancellative),
                $"The main result was {results.MainResults}, which does not indicate that the QP fails to be cancellative.");
            Assert.That(
                results.MainResults.HasFlag(QPAnalysisMainResults.NotWeaklyCancellative),
                $"The main result was {results.MainResults}, which does not indicate that the QP fails to be weakly cancellative.");
        }
Exemplo n.º 3
0
        public void ComputeMaximalNonzeroEquivalenceClassRepresentativesStartingAt_OnClassicNonCancellativeExample_IndicatesNotStronglyCancellative()
        {
            if (!Computer.SupportsNonCancellativityDetection)
            {
                return;
            }

            var settings = GetSettings(detectNonCancellativity: true);
            var qp       = UsefulQPs.GetClassicNonCancellativeQP();

            DoSetup(qp, out var ruleTree);
            var result = Computer.ComputeMaximalNonzeroEquivalenceClassRepresentativesStartingAt(qp.Quiver, 1, ruleTree, settings);

            Assert.That(result.CancellativityFailureDetected, Is.True);
        }