Skip to content
Snippets Groups Projects
Commit d81ff700 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Enable comparison of OEDFB

parent 6a51c2e4
No related branches found
No related tags found
No related merge requests found
...@@ -130,6 +130,9 @@ def compare_lines(f_line, c_line, config, line_num=0, num_len=1, log_file=None): ...@@ -130,6 +130,9 @@ def compare_lines(f_line, c_line, config, line_num=0, num_len=1, log_file=None):
c_starts.append(ci.start()) c_starts.append(ci.start())
c_ends.append(ci.end()) c_ends.append(ci.end())
c_groups.append(ci.group()) c_groups.append(ci.group())
if (len(f_groups) == len(c_groups)):
#INDENT
severities = mismatch_severities(f_groups, c_groups, config) severities = mismatch_severities(f_groups, c_groups, config)
if log_file is not None: if log_file is not None:
num_format = " <div><pre><code>{0:0%dd}"%num_len num_format = " <div><pre><code>{0:0%dd}"%num_len
...@@ -157,10 +160,12 @@ def compare_lines(f_line, c_line, config, line_num=0, num_len=1, log_file=None): ...@@ -157,10 +160,12 @@ def compare_lines(f_line, c_line, config, line_num=0, num_len=1, log_file=None):
log_line + "</code><span style=\"font-weight: bold; color: rgb(255,0,0)\"><code>" log_line + "</code><span style=\"font-weight: bold; color: rgb(255,0,0)\"><code>"
+ c_groups[si] + "</code></span><code>" + c_line[c_ends[si]:c_starts[si + 1]] + c_groups[si] + "</code></span><code>" + c_line[c_ends[si]:c_starts[si + 1]]
) )
if (len(severities) > 1):
if (severities[-1] == 1): noisy += 1 if (severities[-1] == 1): noisy += 1
elif (severities[-1] == 2): warnings += 1 elif (severities[-1] == 2): warnings += 1
elif (severities[-1] == 3): errors += 1 elif (severities[-1] == 3): errors += 1
if log_file is not None: if log_file is not None:
if (len(severities) > 1):
if (severities[-1] == 0): if (severities[-1] == 0):
log_line = ( log_line = (
log_line + c_groups[-1] + c_line[c_ends[-1]:len(c_line) - 2] log_line + c_groups[-1] + c_line[c_ends[-1]:len(c_line) - 2]
...@@ -181,6 +186,15 @@ def compare_lines(f_line, c_line, config, line_num=0, num_len=1, log_file=None): ...@@ -181,6 +186,15 @@ def compare_lines(f_line, c_line, config, line_num=0, num_len=1, log_file=None):
+ c_groups[-1] + "</code></span><code>" + c_line[c_ends[-1]:len(c_line) - 2] + c_groups[-1] + "</code></span><code>" + c_line[c_ends[-1]:len(c_line) - 2]
) )
log_file.write(log_line + "</code></pre></div>\n") log_file.write(log_line + "</code></pre></div>\n")
#END INDENT
else:
if (log_file is not None):
log_line = (
log_line + "</code><span style=\"font-weight: bold; color: rgb(255,0,0)\"><code>"
+ c_line + "</code></span><code>"
)
log_file.write(log_line + "</code></pre></div>\n")
errors += 1
return (errors, warnings, noisy) return (errors, warnings, noisy)
## \brief Determine the severity of a numerical mismatch. ## \brief Determine the severity of a numerical mismatch.
...@@ -203,6 +217,7 @@ def mismatch_severities(str_f_values, str_c_values, config): ...@@ -203,6 +217,7 @@ def mismatch_severities(str_f_values, str_c_values, config):
if (str_f_values[i] != str_c_values[i]): if (str_f_values[i] != str_c_values[i]):
f_values = [float(str_f_values[j]) for j in range(len(str_f_values))] f_values = [float(str_f_values[j]) for j in range(len(str_f_values))]
c_values = [float(str_c_values[j]) for j in range(len(str_c_values))] c_values = [float(str_c_values[j]) for j in range(len(str_c_values))]
if (len(f_values) != len(c_values)): return []
f_log_values = [0.0 for j in range(len(f_values))] f_log_values = [0.0 for j in range(len(f_values))]
c_log_values = [0.0 for j in range(len(c_values))] c_log_values = [0.0 for j in range(len(c_values))]
max_f_log = -1.0e12 max_f_log = -1.0e12
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment