public void NoPoint1()
        {
            StringAutomaton f = StringAutomaton.Zero();

            f.Start.AddTransition('a', Weight.FromValue(0.5)).AddTransition('b', Weight.FromValue(0.5), f.Start).EndWeight = Weight.One;
            Assert.Null(f.TryComputePoint());
        }
Exemple #2
0
        public void NoPoint2()
        {
            StringAutomaton f     = StringAutomaton.Zero();
            var             state = f.Start.AddTransition('a', Weight.FromValue(0.5));

            state.SetEndWeight(Weight.One);
            state.AddTransition('b', Weight.FromValue(0.5), f.Start);
            Assert.Null(f.TryComputePoint());
        }
Exemple #3
0
        public static void TestAutomatonPropertyPreservation(StringAutomaton automaton, Func <StringAutomaton, StringAutomaton> testedOperation)
        {
            var automatonWithClearProperties = automaton
                                               .WithLogValueOverride(null)
                                               .WithPruneStatesWithLogEndWeightLessThan(null);

            var outputForClearProperties = testedOperation(automatonWithClearProperties);

            Assert.Null(outputForClearProperties.LogValueOverride);
            Assert.Null(outputForClearProperties.PruneStatesWithLogEndWeightLessThan);

            var automatonWithSetProperties = automaton
                                             .WithLogValueOverride(-1)
                                             .WithPruneStatesWithLogEndWeightLessThan(-128);

            var outputForSetProperties = testedOperation(automatonWithSetProperties);

            Assert.Equal(automatonWithSetProperties.LogValueOverride, outputForSetProperties.LogValueOverride);
            Assert.Equal(automatonWithSetProperties.PruneStatesWithLogEndWeightLessThan, outputForSetProperties.PruneStatesWithLogEndWeightLessThan);
        }
        public void NoPointZero()
        {
            StringAutomaton f = StringAutomaton.Zero();

            Assert.Null(f.TryComputePoint());
        }