Beispiel #1
0
    def test_case_4_test_check_word(self):
        """
        Checls if the word is a number
        """
        text = 'Dummy_text'
        LA_ = LA(KEY_WORDS, DELIMITERS, STRING_DELIMITERS, OPERATORS, text)

        # Test case specific configuration
        word = '25'
        self.assertEqual(LA_.check_word(word), "numar")
Beispiel #2
0
    def test_case_1_test_check_word(self):
        """
        Checls if the word is a key_word
        """
        text = 'Dummy_text'
        LA_ = LA(KEY_WORDS, DELIMITERS, STRING_DELIMITERS, OPERATORS, text)

        # Test case specific configuration
        word = 'break'

        self.assertEqual(LA_.check_word(word), "cuvant cheie")
Beispiel #3
0
    def test_case_6_test_check_word_test(self):
        """
        Checls if the word is a identifier (i.e variable name)
        """
        text = 'Dummy_text'
        LA_ = LA(KEY_WORDS, DELIMITERS, STRING_DELIMITERS, OPERATORS, text)

        # Test case specific configuration
        word = 'nume_variabila'

        self.assertEqual(LA_.check_word(word), "identificator")
        print('\n')
Beispiel #4
0
    def test_case_2_get_next_word(self):
        """
        Checls if the word is a key_word
        """
        c_text = ' "sir_de_caractere" '
        LA_ = LA(KEY_WORDS, DELIMITERS, STRING_DELIMITERS, OPERATORS, c_text)

        self.assertEqual(
            str(LA_.get_next_word()),
            '"sir_de_caractere" -> constanta sir de caractere de lungime 16 la linia 1'
        )
        print('\n')
Beispiel #5
0
    def test_case_1_get_next_word(self):
        """
        Checls if the word is a key_word
        """
        c_text = 'int a=0;'
        LA_ = LA(KEY_WORDS, DELIMITERS, STRING_DELIMITERS, OPERATORS, c_text)

        self.assertEqual(str(LA_.get_next_word()),
                         "int -> cuvant cheie de lungime 3 la linia 1")
        self.assertEqual(str(LA_.get_next_word()),
                         "a -> identificator de lungime 1 la linia 1")
        self.assertEqual(str(LA_.get_next_word()),
                         "= -> operator de lungime 1 la linia 1")
        self.assertEqual(str(LA_.get_next_word()),
                         "0 -> numar de lungime 1 la linia 1")
        self.assertEqual(str(LA_.get_next_word()),
                         "; -> delimitator de lungime 1 la linia 1")