Skip to content

Commit d7a8156

Browse files
Add count_properties with given result
To count how many properties have a certain status. This will be used in property reporting.
1 parent 658409a commit d7a8156

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/goto-checker/properties.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,16 @@ propertiest initialize_properties(const abstract_goto_modelt &goto_model)
7878
}
7979
return properties;
8080
}
81+
82+
/// Returns the number of properties with given \p result
83+
std::size_t
84+
count_properties(const propertiest &properties, property_resultt result)
85+
{
86+
std::size_t count = 0;
87+
for(const auto &property_pair : properties)
88+
{
89+
if(property_pair.second.result == result)
90+
++count;
91+
}
92+
return count;
93+
}

src/goto-checker/properties.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,7 @@ typedef std::unordered_map<irep_idt, property_infot> propertiest;
6868
/// Returns the properties in the goto model
6969
propertiest initialize_properties(const abstract_goto_modelt &);
7070

71+
std::size_t
72+
count_properties(const propertiest &properties, property_resultt result);
73+
7174
#endif // CPROVER_GOTO_CHECKER_PROPERTIES_H

0 commit comments

Comments
 (0)