Skip to content

Commit cc1a90e

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 1865865 commit cc1a90e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/goto-checker/properties.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,15 @@ propertiest initialize_properties(const abstract_goto_modelt &goto_model)
8888
}
8989
return properties;
9090
}
91+
92+
std::size_t
93+
count_properties(const propertiest &properties, property_statust status)
94+
{
95+
std::size_t count = 0;
96+
for(const auto &property_pair : properties)
97+
{
98+
if(property_pair.second.status == status)
99+
++count;
100+
}
101+
return count;
102+
}

src/goto-checker/properties.h

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

76+
/// Return the number of properties with given \p status
77+
std::size_t count_properties(const propertiest &, property_statust);
78+
7679
#endif // CPROVER_GOTO_CHECKER_PROPERTIES_H

0 commit comments

Comments
 (0)