Skip to content

Commit

Permalink
new number format for c++ 14
Browse files Browse the repository at this point in the history
  • Loading branch information
terryyin committed Apr 19, 2022
1 parent bf58b84 commit bb8aa4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lizard_languages/code_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def _generate_tokens(source, add):
r"(?:" +
r"\/\*.*?\*\/" +
add +
r"|(?:\d+\')+\d+" +
r"|\w+" +
r"|\"(?:\\.|[^\"\\])*\"" +
r"|\'(?:\\.|[^\'\\])*?\'" +
Expand Down
7 changes: 7 additions & 0 deletions test/test_languages/testCAndCPP.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ def test_double_slash_within_string(self):
result = get_cpp_function_list("""int fun(){char *a="\\\\";}""")
self.assertEqual(1, len(result))

def test_number_with_thousands_seperator_since_cpp14(self):
result = get_cpp_function_list("""int fun(){
int a= 100'000; if(b) c; return 123'456'789;
}""")
self.assertEqual(1, len(result))
self.assertEqual(2, result[0].cyclomatic_complexity)

def test_function_with_no_param(self):
result = get_cpp_function_list("int fun(){}")
self.assertEqual(0, result[0].parameter_count)
Expand Down

0 comments on commit bb8aa4d

Please sign in to comment.