Beispiel #1
0
        public void ParseDefinition_CheckCaseSensitivityForStates()
        {
            List<string> definition = new List<string>()
            {
                "state1 STATE1",
                "INPUT_ALPHABET:"
            };

            States test_state = new States();
            test_state.load(ref definition);
            Assert.IsTrue(test_state.is_element("state1"));
            Assert.IsTrue(test_state.is_element("STATE1"));
        }
Beispiel #2
0
 public void ParseDefinition_ValidStates()
 {
     List<string> definition = new List<string>() 
     {
         //"description stuff1",
         //"description stuff2",     // Assume definition was already extracted
         "STATES: S1 S2 S3 S4",
         "INPUT_ALPHABET: a b",      // Need to have next keyword so it's detected
         //"TAPE_ALPHABET: a b x y -",
         //"TRANSITION_FUNCTION:",
         //"s0 a   s1 X R",
         //"s0 Y   s3 Y R",
         //"s1 a   s1 a R",
         //"s1 b   s2 Y L",
         //"s1 Y   s1 Y R", 
         //"s2 a   s2 a L",
         //"s2 X   s0 X R",
         //"s2 Y   s2 Y L",
         //"s3 Y   s3 Y R",
         //"s3 -   s4 - R",
         //"INITIAL_STATE: s0",
         //"BLANK_CHARACTER: -",
         //"FINAL_STATES: s4"
     };
     States states = new States();
     Assert.IsTrue(states.load(ref definition), "Failed to parse states.");
     Assert.IsTrue(states.is_element("S1"), "S1 not found");
     Assert.IsTrue(states.is_element("S2"), "S2 not found");
     Assert.IsTrue(states.is_element("S3"), "S3 not found");
     Assert.IsTrue(states.is_element("S4"), "S4 not found");
 }