diyorsattarov / 2

open-source 2
Other
1 stars 0 forks source link

Additional Lexer Test Cases #4

Closed diyorsattarov closed 1 year ago

diyorsattarov commented 1 year ago

This issue is created to propose additional test cases for the Lexer component of the Compilator C++ Compiler project. These test cases aim to further enhance the test coverage and ensure the correctness of the Lexer's functionality.

Test Case 1: Different Operators

Test Case 2: Keywords

Test Case 3: String and Character Literals

std::string greeting = "Hello, World!";
char ch = 'A';

Expected Tokens:

Test Case 4: Comments

// This is a single-line comment

/*
   This is a
   multi-line
   comment
*/

Expected Tokens:

Test Case 5: Identifiers with Digits cpp var123 = x42 + a1b2c3; Expected Tokens:

Test Case 6: Special Characters @variable $amount %value &name Expected Tokens: (All characters should be treated as errors)

Test Case 7: Empty Input (empty string) Expected Tokens:

Test Case 8: Non-ASCII Characters

你好, 世界
αβγδε

Expected Tokens: (All characters should be treated as errors)

Test Case 9: File with Line Endings Line 1\r\nLine 2\nLine 3 Expected Tokens: (List of tokens for each line) TokenType::END_OF_FILE

Test Case 10: Large Numbers

int bigNumber = 12345678901234567890;

Expected Tokens:

Test Case 11: Escaped Characters

std::string message = "Hello\nWorld";

Expected Tokens:

diyorsattarov commented 1 year ago

b6fcd264c9a5d79113cb3903a9ac2f53870830a9 https://github.com/diyooor/compilator/pull/5#issue-1900120621