mirror of
https://github.com/gryf/tagbar.git
synced 2026-02-21 09:15:56 +01:00
Add tests to repository
This commit is contained in:
60
tests/vera/properties.vr
Normal file
60
tests/vera/properties.vr
Normal file
@@ -0,0 +1,60 @@
|
||||
class A {
|
||||
public integer data;
|
||||
local integer addr;
|
||||
protected integer cmd;
|
||||
static integer credits;
|
||||
task new() {
|
||||
data = 100;
|
||||
addr = 200;
|
||||
cmd = 1;
|
||||
credits = 10;
|
||||
}
|
||||
task printA() {
|
||||
printf ("value of data %0d in A\n", data);
|
||||
printf ("value of addr %0d in A\n", addr);
|
||||
printf ("value of cmd %0d in A\n", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
task printB() {
|
||||
printf ("value of data %0d in B\n", data);
|
||||
// Below line will give compile error
|
||||
//printf ("value of addr %0d in B\n", addr);
|
||||
printf ("value of cmd %0d in B\n", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
A a;
|
||||
B b;
|
||||
task new() {
|
||||
a = new();
|
||||
b = new();
|
||||
b.data = 2;
|
||||
}
|
||||
task printC() {
|
||||
printf ("value of data %0d in C\n", a.data);
|
||||
printf ("value of data %0d in C\n", b.data);
|
||||
// Below line will give compile error
|
||||
//printf ("value of addr %0d in C\n", a.addr);
|
||||
//printf ("value of cmd %0d in C\n", a.cmd);
|
||||
//printf ("value of addr %0d in C\n", b.addr);
|
||||
//printf ("value of cmd %0d in C\n", b.cmd);
|
||||
}
|
||||
}
|
||||
|
||||
program properties {
|
||||
C c = new();
|
||||
c.a.printA();
|
||||
c.b.printB();
|
||||
c.printC();
|
||||
printf("value of credits is %0d\n",c.a.credits);
|
||||
printf("value of credits is %0d\n",c.b.credits);
|
||||
c.a.credits ++;
|
||||
printf("value of credits is %0d\n",c.a.credits);
|
||||
printf("value of credits is %0d\n",c.b.credits);
|
||||
c.b.credits ++;
|
||||
printf("value of credits is %0d\n",c.a.credits);
|
||||
printf("value of credits is %0d\n",c.b.credits);
|
||||
}
|
||||
Reference in New Issue
Block a user