|
From: <ma...@us...> - 2011-08-11 14:37:55
|
Revision: 1180
http://scstudio.svn.sourceforge.net/scstudio/?rev=1180&view=rev
Author: madzin
Date: 2011-08-11 14:37:48 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
Fix test empty_neg_pat.mpr
Modified Paths:
--------------
trunk/src/membership/membership_additional.cpp
trunk/src/membership/membership_additional.h
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_base.h
trunk/tests/membership/CMakeLists.txt
trunk/tests/membership/empty_pos_pat.mpr
Added Paths:
-----------
trunk/tests/membership/empty_neg_pat.mpr.result
trunk/tests/membership/empty_pos_pat.mpr.result
Modified: trunk/src/membership/membership_additional.cpp
===================================================================
--- trunk/src/membership/membership_additional.cpp 2011-08-11 14:09:08 UTC (rev 1179)
+++ trunk/src/membership/membership_additional.cpp 2011-08-11 14:37:48 UTC (rev 1180)
@@ -136,22 +136,6 @@
return true;
}
-bool look_at_checked_conf(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr b)
-{
- const std::set<ConfigurationPtr> checked_conf = c->find_checked_conf(node->get_msc()->get_label());
-
- if (!checked_conf.empty())
- {
- std::set<ConfigurationPtr>::const_iterator conf_it;
-
- for (conf_it = checked_conf.begin(); conf_it != checked_conf.end(); conf_it++)
- if (b->compare(*conf_it))
- return false;
- }
-
- return true;
-}
-
//TODO I don't like the time of increasing max id
void set_identification(MembershipContext* c, Event* node_e, Event* b_e)
{
Modified: trunk/src/membership/membership_additional.h
===================================================================
--- trunk/src/membership/membership_additional.h 2011-08-11 14:09:08 UTC (rev 1179)
+++ trunk/src/membership/membership_additional.h 2011-08-11 14:37:48 UTC (rev 1180)
@@ -37,9 +37,6 @@
void compare_events_attribute_diff(MembershipContext* c, Event* spec_e, Event* flow_e);
-//! tries to find configuration into map of seared configuration
-bool look_at_checked_conf(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr b);
-
/**
* \brief in case events are send events, adds attribute to both events and to both receive event in case messages are complete
*
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2011-08-11 14:09:08 UTC (rev 1179)
+++ trunk/src/membership/membership_alg.cpp 2011-08-11 14:37:48 UTC (rev 1180)
@@ -374,14 +374,6 @@
return false;
}
- //checks if this node with this configuration was checked
- if (!look_at_checked_conf(c, node, b))
- {
- c->top_pop_path();
- c->pop_time_stacks();
- return false;
- }
-
ConfigurationPtr old_config_I, old_config_II;
old_config_I = new Configuration(b);
@@ -809,22 +801,6 @@
}
/*
- * Add checked branch to map of checked branches
- */
-void add_checked_branch(MembershipContext* c, ReferenceNodePtr ref_node, ConfigurationPtr conf)
-{
- BMscPtr bmsc = ref_node->get_bmsc();
-
- if(bmsc == NULL)
- {
- throw std::runtime_error("Unexpected behaviour.");
- return;
- }
-
- c->add_checked_conf(bmsc->get_label(), conf);
-}
-
-/*
* Tries finding bMSC in bMSC
*
* bmsc - where the bmsc_f is looking for
@@ -1031,6 +1007,24 @@
*/
bool check_node(MembershipContext* c, ReferenceNodePtr node, enum check_type type, ConfigurationPtr conf)
{
+ //in case membership checking mod, the algorithm checks whether the reference node have already
+ //been checked with the same flow configuration.
+ if(type == membership)
+ {
+ std::set<ConfigurationPtr> checked_configs = c->find_checked_conf(node);
+ std::set<ConfigurationPtr>::iterator checked_conf_it;
+
+ for(checked_conf_it = checked_configs.begin(); checked_conf_it != checked_configs.end(); checked_conf_it++)
+ {
+ if(conf->compare(*checked_conf_it))
+ return false;
+ }
+
+ //add this configuration among checked configurations
+ ConfigurationPtr old_conf = new Configuration(conf);
+ c->add_checked_conf(node, old_conf);
+ }
+
//get msc from the node
ConfigurationPtr old_conf = new Configuration(conf);
c->set_processed_ref_node(node);
@@ -1083,10 +1077,7 @@
continue; //remember position and continue in cycle
if (!check_instance(c, node_instance, type, *position_it))
- {
- add_checked_branch(c, node, old_conf);
return false;
- }
}
return true;
Modified: trunk/src/membership/membership_base.h
===================================================================
--- trunk/src/membership/membership_base.h 2011-08-11 14:09:08 UTC (rev 1179)
+++ trunk/src/membership/membership_base.h 2011-08-11 14:37:48 UTC (rev 1180)
@@ -264,7 +264,7 @@
std::vector<std::wstring> focused_instances; //! name of instances on which a user is focused on
std::map<CoregionAreaPtr, SnapshotContextPtr> snapshots; //! snapshots of context for each coregion
std::vector<Event*> attributed_events; //! events with attribute
- std::map<std::wstring, std::set<ConfigurationPtr> > checked_conf; //! map of bmsc names and configurations which were checked
+ std::map<ReferenceNodePtr, std::set<ConfigurationPtr> > checked_conf; //! map of reference nodes and configurations which were checked
std::map<TimeRelationRefNodePtr, ConfigurationPtr> top_time_references; //! the start of time interval is connected on top
std::map<TimeRelationRefNodePtr, ConfigurationPtr> bottom_time_references; //! the start of time interval is connected on bottom
std::map<CoregionAreaPtr, std::vector<CoregionOrderingPtr> > checked_orderings; //! checked possibilities of coregion ordering
@@ -419,14 +419,14 @@
attributed_events.clear();
}
- const std::set<ConfigurationPtr> find_checked_conf(std::wstring name)
+ const std::set<ConfigurationPtr> find_checked_conf(ReferenceNodePtr ref_node)
{
- return checked_conf[name];
+ return checked_conf[ref_node];
}
- void add_checked_conf(std::wstring name, ConfigurationPtr conf)
+ void add_checked_conf(ReferenceNodePtr ref_node, ConfigurationPtr conf)
{
- checked_conf[name].insert(conf);
+ checked_conf[ref_node].insert(conf);
}
void add_top_time_ref(TimeRelationRefNodePtr rel, ConfigurationPtr conf)
@@ -877,13 +877,9 @@
if(events.size() != a->get_events().size()) return false;
std::vector<Event*>::iterator it;
- Event* b;
-
for(it=events.begin(); it!=events.end(); it++)
{
- b = a->find_event(*it);
-
- if(b == NULL || !this->compare_events(*it, b))
+ if(a->find_event(*it) == NULL)
return false;
}
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2011-08-11 14:09:08 UTC (rev 1179)
+++ trunk/tests/membership/CMakeLists.txt 2011-08-11 14:37:48 UTC (rev 1180)
@@ -111,7 +111,8 @@
ADD_MEMBER_TEST(cycle_neg_hmsc.mpr cycle_neg_pat.mpr 0)
ADD_MEMBER_TEST(cycle_pos_hmsc.mpr cycle_pos_pat.mpr 1)
ADD_MEMBER_TEST(cycleWithEmpty_pos_hmsc.mpr cycleWithEmpty_pos_pat.mpr 1)
-ADD_MEMBER_TEST(empty_pos_hmsc.mpr empty_pos_pat.mpr 0)
+ADD_MEMBER_TEST(empty_pos_hmsc.mpr empty_pos_pat.mpr 1)
+ADD_MEMBER_TEST(empty_neg_hmsc.mpr empty_neg_pat.mpr 0)
ADD_MEMBER_TEST(hard_neg_hmsc.mpr hard_neg_pat.mpr 0)
ADD_MEMBER_TEST(hard_pos_hmsc.mpr hard_pos_pat.mpr 1)
Added: trunk/tests/membership/empty_neg_pat.mpr.result
===================================================================
--- trunk/tests/membership/empty_neg_pat.mpr.result (rev 0)
+++ trunk/tests/membership/empty_neg_pat.mpr.result 2011-08-11 14:37:48 UTC (rev 1180)
@@ -0,0 +1 @@
+Flow "Page_1" not found.
Modified: trunk/tests/membership/empty_pos_pat.mpr
===================================================================
--- trunk/tests/membership/empty_pos_pat.mpr 2011-08-11 14:09:08 UTC (rev 1179)
+++ trunk/tests/membership/empty_pos_pat.mpr 2011-08-11 14:37:48 UTC (rev 1180)
@@ -1,5 +1,5 @@
mscdocument empty_pos_pat.vsd;
-msc Page-1;
+msc Page1;
inst p;
inst q;
p: instance;
Added: trunk/tests/membership/empty_pos_pat.mpr.result
===================================================================
--- trunk/tests/membership/empty_pos_pat.mpr.result (rev 0)
+++ trunk/tests/membership/empty_pos_pat.mpr.result 2011-08-11 14:37:48 UTC (rev 1180)
@@ -0,0 +1,109 @@
+Flow "Page1" found.
+Diagram with found flow highlighted.
+mscdocument empty_pos_hmsc;
+msc Page_1;
+/* PATH */
+initial connect/* PATH */
+ L0;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 2] */
+L0: reference bMSC1/* PATH */
+/* PATH */
+ connect/* PATH */
+ L0,/* PATH */
+ L1, L2, L3;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L1: reference empty1/* PATH */
+ connect L4,/* PATH */
+ L5;
+L2: reference bMSC2 connect L1;
+L3: reference bMSC3 connect L5;
+L4: reference empty2 connect L6;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L5: reference empty4/* PATH */
+ connect L5,/* PATH */
+ L7;
+L6: reference empty3 connect L1;
+/* PATH */
+/* ATTRIBUTES: [membership_counter 1] */
+L7: reference bMSC4/* PATH */
+ connect/* PATH */
+ L8;
+/* PATH */
+L8: final/* PATH */
+;
+endmsc;
+msc bMSC1;
+inst p;
+inst q;
+p: instance;
+out a,0 to q;
+endinstance;
+q: instance;
+in a,0 from p;
+endinstance;
+endmsc;
+msc empty1;
+inst p;
+inst q;
+p: instance;
+endinstance;
+q: instance;
+endinstance;
+endmsc;
+msc bMSC2;
+inst p;
+inst q;
+p: instance;
+out a,0 to q;
+endinstance;
+q: instance;
+in a,0 from p;
+endinstance;
+endmsc;
+msc bMSC3;
+inst p;
+inst q;
+p: instance;
+out a,0 to q;
+endinstance;
+q: instance;
+in a,0 from p;
+endinstance;
+endmsc;
+msc empty2;
+inst p;
+inst q;
+p: instance;
+endinstance;
+q: instance;
+endinstance;
+endmsc;
+msc empty4;
+inst p;
+inst q;
+p: instance;
+endinstance;
+q: instance;
+endinstance;
+endmsc;
+msc empty3;
+inst p;
+inst q;
+p: instance;
+endinstance;
+q: instance;
+endinstance;
+endmsc;
+msc bMSC4;
+inst p;
+inst q;
+p: instance;
+in b,0 from q;
+endinstance;
+q: instance;
+out b,0 to p;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|