Skip to content

Commit ee67669

Browse files
Sindhu1143Sivasindhura Mule
authored andcommitted
RIC-1051:Added new testcase to handle method signatures of abstarct capsule (#52)
* Added new testcase to handle method signatures of abstarct capsule * minor change * Removed unnecessary changes --------- Co-authored-by: Sivasindhura Mule <sivasindhura.mule@prod.hclpnp.com>
1 parent 9ef606a commit ee67669

4 files changed

Lines changed: 78 additions & 0 deletions

File tree

art-comp-test/art-comp-test.code-workspace

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
{
66
"path": "tests/abstract_capsule"
77
},
8+
{
9+
"path": "tests/abstract_capsule_method_signatures"
10+
},
811
{
912
"path": "tests/build_variants"
1013
},
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
abstract capsule AbstarctCapsule {
2+
[[rt::decl]]
3+
`
4+
public:
5+
virtual int abstract_show() = 0;
6+
virtual int abstract_show(bool b) = 0;
7+
virtual int abstract_show(bool b, int i) = 0;
8+
`
9+
statemachine {
10+
state S;
11+
abstract_initial : initial -> S;
12+
};
13+
};
14+
capsule CapsuleExtendsAbstract : AbstarctCapsule {
15+
[[rt::impl_preface]]
16+
`
17+
#include "testlib.art.h"
18+
`
19+
[[rt::decl]]
20+
`
21+
public:
22+
virtual int abstract_show() override;
23+
int child_show(bool b);
24+
void foo();
25+
26+
`
27+
[[rt::impl]]
28+
`
29+
int CapsuleExtendsAbstract::child_show(bool b) {return 2;};
30+
int CapsuleExtendsAbstract::abstract_show() {return 1;};
31+
`
32+
statemachine {
33+
redefine abstract_initial : initial -> S;
34+
};
35+
36+
};
37+
38+
capsule Top : CapsuleExtendsAbstract {
39+
[[rt::impl_preface]]
40+
`
41+
#include "testlib.art.h"
42+
`
43+
[[rt::decl]]
44+
`
45+
public:
46+
virtual int abstract_show(bool b) override;
47+
virtual int abstract_show() override;
48+
virtual int abstract_show(bool b, int i) override;
49+
50+
`
51+
[[rt::impl]]
52+
`
53+
int Top::abstract_show(bool b) {return 2;};
54+
int Top::abstract_show() {return 3;};
55+
int Top::abstract_show(bool b, int i) {return 4;};
56+
`
57+
statemachine {
58+
59+
redefine abstract_initial : initial -> S
60+
`
61+
ASSERT(4 == abstract_show(true, 4), "Failed to call abstract_show(bool b, int i)");
62+
PASS();
63+
`
64+
;
65+
};
66+
67+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
group: cpp_code_generation
3+
---
4+
Checking signatures of pure virtual functions for analysis of abstract while extending.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let tc = TCF.define(TCF.CPP_TRANSFORM);
2+
tc.topCapsule = 'Top';
3+
tc.prerequisites = ["../../TestUtils/testlib.tcjs"];
4+
tc.targetFolder = 'abstract_capsule_method_signatures_target';

0 commit comments

Comments
 (0)