Skip to content

Commit e30f939

Browse files
author
Abhinav Arora
committed
node.cpp
1 parent 961e758 commit e30f939

7 files changed

+107
-10
lines changed

Model Based Testing.depend

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# depslib dependency file v1.0
2-
1334659813 source:c:\users\abhinav\desktop\btp\model based testing\main.cpp
2+
1334693982 source:c:\users\abhinav\desktop\btp\model based testing\main.cpp
33
"tinyxml.h"
44
"actorbuilder.h"
55
"messagebuilder.h"
@@ -51,12 +51,12 @@
5151
1334607295 c:\users\abhinav\desktop\btp\model based testing\actor.h
5252
<string>
5353

54-
1334653567 source:c:\users\abhinav\desktop\btp\model based testing\message.cpp
54+
1334699203 source:c:\users\abhinav\desktop\btp\model based testing\message.cpp
5555
"message.h"
5656
<string>
5757
<iostream>
5858

59-
1334653567 c:\users\abhinav\desktop\btp\model based testing\message.h
59+
1334699204 c:\users\abhinav\desktop\btp\model based testing\message.h
6060
<string>
6161

6262
1334642981 source:c:\users\abhinav\desktop\btp\model based testing\actorbuilder.cpp
@@ -72,14 +72,15 @@
7272
"actor.h"
7373
<vector>
7474

75-
1334659642 source:c:\users\abhinav\desktop\btp\model based testing\messagebuilder.cpp
75+
1334698513 source:c:\users\abhinav\desktop\btp\model based testing\messagebuilder.cpp
7676
"messagebuilder.h"
7777
<vector>
7878
<algorithm>
7979
<sstream>
8080
"tinyxml.h"
8181
"message.h"
8282
"actor.h"
83+
"node.h"
8384
<iostream>
8485

8586
1334653203 c:\users\abhinav\desktop\btp\model based testing\messagebuilder.h
@@ -89,3 +90,9 @@
8990
"message.h"
9091
"actor.h"
9192

93+
1334693413 source:c:\users\abhinav\desktop\btp\model based testing\node.cpp
94+
"node.h"
95+
96+
1334699290 c:\users\abhinav\desktop\btp\model based testing\node.h
97+
"message.h"
98+

main.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ MessageBuilder mb;
3535
mb.build(list,mlist,root);
3636
cout<<mlist.size();
3737
for(int i=0;i<mlist.size();i++,cout<<endl)
38-
mlist[i].display();
38+
{
39+
mlist[i].display();
40+
cout<<mlist[i].getType()<<endl;
41+
}
3942
//getchar();
4043
return 0;
4144
}

message.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
#include<string>
33
#include<iostream>
44
using namespace std;
5+
6+
Message::Message()
7+
{
8+
9+
}
10+
511
Message::Message(int num,string xmi_id,string name,string from, string to,int type)
612
{
713
this->num = num;

message.h

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Message
66
{
77
public:
88
/** Default constructor */
9+
Message();
910
Message(int,string,string,string,string,int);
1011
Message(const Message&);
1112
bool operator < (const Message&) const;

messagebuilder.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "tinyxml.h"
66
#include "message.h"
77
#include "actor.h"
8+
#include "node.h"
89
#include<iostream>
910
void MessageBuilder::build(vector<Actor>& actorList, vector<Message>& msgList,TiXmlElement* docEle)
1011
{
@@ -13,7 +14,7 @@ void MessageBuilder::build(vector<Actor>& actorList, vector<Message>& msgList,Ti
1314
string check = string("uml:Message");
1415
if(msg.size()>0)
1516
{
16-
for(int i = 0; i < msg.size(); i++)
17+
for(unsigned int i = 0; i < msg.size(); i++)
1718
{
1819
if(msg[i]->Attribute("xmi:type")!=NULL && msg[i]->Attribute("xmi:type") == string("uml:Message"))
1920
{
@@ -37,9 +38,9 @@ Message MessageBuilder::getMsg(TiXmlElement* mes,TiXmlElement* docEle,vector<Act
3738
string to = this->getActorName(actorList,docEle,receiveEvent);
3839
string msgtype = mes->Attribute("messageSort");
3940
if(msgtype==string("reply"))
40-
type=0;
41+
type = RETURN_MESSAGE;
4142
else
42-
type=1;
43+
type = MESSAGE;
4344

4445
vector<TiXmlElement*> n;
4546
n = mes->GetElementsByTagName("number",n);
@@ -56,13 +57,13 @@ string MessageBuilder::getActorName(vector<Actor>& actorList,TiXmlElement* docEl
5657
n = docEle->GetElementsByTagName("fragment",n);
5758
if(n.size()>0)
5859
{
59-
for(int i = 0; i<n.size(); i++)
60+
for(unsigned int i = 0; i<n.size(); i++)
6061
{
6162
string frag_id = n[i]->Attribute("xmi:id");
6263
if(frag_id==event)
6364
{
6465
string actor_id = n[i]->Attribute("covered");
65-
for(int j = 0; j<actorList.size(); j++ )
66+
for(unsigned int j = 0; j<actorList.size(); j++ )
6667
{
6768
if(actorList[j].getID()==actor_id)
6869
{

node.cpp

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include "node.h"
2+
Node::Node(int type,Message frag)
3+
{
4+
this->type = type;
5+
this->mfrag = frag;
6+
// this->cfrag = NULL;
7+
}
8+
9+
/*
10+
Node::Node(int type,CombinedFragment frag)
11+
{
12+
this->type = type;
13+
this->cfrag = frag;
14+
this->mfrag = NULL;
15+
}
16+
*/
17+
18+
int Node::getType()
19+
{
20+
return this->type;
21+
}
22+
23+
void Node::setType(int type)
24+
{
25+
this->type = type;
26+
}
27+
28+
Message Node::getmFrag()
29+
{
30+
return this->mfrag;
31+
}
32+
33+
void Node::setmFrag(Message frag)
34+
{
35+
this->mfrag = frag;
36+
// this->cfrag = NULL;
37+
}
38+
39+
/*
40+
CombinedFragment Node::getcFrag()
41+
{
42+
return this->cfrag;
43+
}
44+
45+
void Node::setcFrag(CombinedFragment frag)
46+
{
47+
this->cfrag = frag;
48+
this->mfrag = NULL;
49+
}
50+
*/

node.h

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef NODE_H
2+
#define NODE_H
3+
#include "message.h"
4+
#define RETURN_MESSAGE 0
5+
#define MESSAGE 1
6+
#define LOOP 2
7+
#define ALT 3
8+
#define OPT 4
9+
#define BREAK 5
10+
class Node
11+
{
12+
public:
13+
14+
Node(int,Message);
15+
// Node(int,CombinedFragment);
16+
int getType();
17+
void setType(int);
18+
Message getmFrag();
19+
void setmFrag(Message);
20+
// CombinedFragment getcFrag();
21+
// void setcFrag(CombinedFragment);
22+
23+
private:
24+
int type;
25+
Message mfrag;
26+
// CombinedFragment cfrag;
27+
};
28+
29+
#endif // NODE_H

0 commit comments

Comments
 (0)