Package pl.edu.amu.wmi.daut.base

Examples of pl.edu.amu.wmi.daut.base.NondeterministicAutomatonByThompsonApproach


     * Test najprostszego automatu.
     */
    public void testcreateSimpleFixedAutomaton() {

        NumericalRangeOperator spec = new NumericalRangeOperator(101, 101);
        NondeterministicAutomatonByThompsonApproach automaton =
                new NondeterministicAutomatonByThompsonApproach(spec.createFixedAutomaton());

        assertTrue(automaton.accepts("101"));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("1"));
        assertFalse(automaton.accepts("100"));
        assertFalse(automaton.accepts("102"));
        assertFalse(automaton.accepts("a101b"));
        assertFalse(automaton.accepts("   101  "));
    }
View Full Code Here


     * Test ciekawszego automatu.
     */
    public final void testcreateFixedAutomaton() {
        NumericalRangeOperator spec = new NumericalRangeOperator(3, 88);
        NondeterministicAutomatonByThompsonApproach automaton =
                new NondeterministicAutomatonByThompsonApproach(spec.createFixedAutomaton());
        assertTrue(automaton.accepts("3"));
        assertTrue(automaton.accepts("4"));
        assertTrue(automaton.accepts("88"));
        assertTrue(automaton.accepts("87"));
        assertTrue(automaton.accepts("60"));
        assertTrue(automaton.accepts("44"));
        assertTrue(automaton.accepts("29"));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("2"));
        assertFalse(automaton.accepts("89"));
        assertFalse(automaton.accepts("100"));
        assertFalse(automaton.accepts("0"));
    }
View Full Code Here

     * Test automatu od 0 do 13.
     */
    public final void testcreateFixedAutomatonFrom0() {
        NumericalRangeOperator spec = new NumericalRangeOperator(0, 13);
        NondeterministicAutomatonByThompsonApproach automaton =
                new NondeterministicAutomatonByThompsonApproach(spec.createFixedAutomaton());
        assertTrue(automaton.accepts("0"));
        assertTrue(automaton.accepts("1"));
        assertTrue(automaton.accepts("13"));
        assertTrue(automaton.accepts("12"));
        assertTrue(automaton.accepts("10"));
        assertTrue(automaton.accepts("5"));
        assertTrue(automaton.accepts("7"));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("14"));
        assertFalse(automaton.accepts("100"));
        assertFalse(automaton.accepts("113"));
        assertFalse(automaton.accepts("  0  "));
    }
View Full Code Here

     * Test zakresu od 10 do 11.
     */
    public final void testcreateFixedAutomatonFrom10To11() {
        NumericalRangeOperator spec = new NumericalRangeOperator(10, 11);
        NondeterministicAutomatonByThompsonApproach automaton =
                new NondeterministicAutomatonByThompsonApproach(spec.createFixedAutomaton());
        assertTrue(automaton.accepts("10"));
        assertTrue(automaton.accepts("11"));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("9"));
        assertFalse(automaton.accepts("12"));
        assertFalse(automaton.accepts("0"));
        assertFalse(automaton.accepts("  10"));
    }
View Full Code Here

     * Test znaku ucieczki "\a".
     */
    public void testEscapeOperatorA() {
        EscapeOperator operator = new EscapeOperator('a');
        AutomatonSpecification automaton = operator.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result =
                new NondeterministicAutomatonByThompsonApproach(automaton);

        assertFalse(automaton.isEmpty());
        assertTrue(result.accepts("\7"));
        assertFalse(result.accepts("\\7"));
        assertFalse(result.accepts("\6"));
        assertFalse(result.accepts("c"));
    }
View Full Code Here

     */
    public void testEscapeOperatorN() {

        EscapeOperator operator1 = new EscapeOperator('n');
        AutomatonSpecification automaton1 = operator1.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result1 =
                new NondeterministicAutomatonByThompsonApproach(automaton1);

        assertFalse(automaton1.isEmpty());
        assertTrue(result1.accepts("\n"));
        assertFalse(result1.accepts("\\nn"));
        assertFalse(result1.accepts("n"));

    }
View Full Code Here

     */
    public void testEscapeOperatorT() {

        EscapeOperator operator2 = new EscapeOperator('t');
        AutomatonSpecification automaton2 = operator2.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result2 =
                new NondeterministicAutomatonByThompsonApproach(automaton2);

        assertFalse(automaton2.isEmpty());
        assertTrue(result2.accepts("\t"));
        assertFalse(result2.accepts("\\tt"));
        assertFalse(result2.accepts("t"));
    }
View Full Code Here

     */
    public void testEscapeOperatorF() {

        EscapeOperator operator3 = new EscapeOperator('f');
        AutomatonSpecification automaton3 = operator3.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result3 =
                new NondeterministicAutomatonByThompsonApproach(automaton3);

        assertFalse(automaton3.isEmpty());
        assertTrue(result3.accepts("\f"));
        assertFalse(result3.accepts("\\ff"));
        assertFalse(result3.accepts("f"));
    }
View Full Code Here

     */
    public void testEscapeOperatorR() {

        EscapeOperator operator4 = new EscapeOperator('r');
        AutomatonSpecification automaton4 = operator4.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result4 =
                new NondeterministicAutomatonByThompsonApproach(automaton4);

        assertFalse(automaton4.isEmpty());
        assertTrue(result4.accepts("\r"));
        assertFalse(result4.accepts("\\rr"));
        assertFalse(result4.accepts("r"));
    }
View Full Code Here

     */
    public void testEscapeOperatorI() {

        EscapeOperator operator5 = new EscapeOperator('i');
        AutomatonSpecification automaton5 = operator5.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result5 =
                new NondeterministicAutomatonByThompsonApproach(automaton5);

        assertFalse(automaton5.isEmpty());
        assertTrue(result5.accepts("i"));
        assertFalse(result5.accepts("\\ii"));
        assertFalse(result5.accepts("\\i"));
    }
View Full Code Here

TOP

Related Classes of pl.edu.amu.wmi.daut.base.NondeterministicAutomatonByThompsonApproach

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.