ADTast-experimental
Last change
on this file since 9f1beb4 was
1950837,
checked in by caparsons <caparson@…>, 20 months ago
|
added virtual dtor test to actor test suite, updated other relevant tests accordingly
|
-
Property mode set to
100644
|
File size:
992 bytes
|
Rev | Line | |
---|
[858350a] | 1 | #include <actor.hfa> |
---|
| 2 | #include <fstream.hfa> |
---|
| 3 | #include <stdlib.hfa> |
---|
| 4 | #include <string.h> |
---|
| 5 | #include <stdio.h> |
---|
| 6 | |
---|
[1950837] | 7 | struct Server { int val; inline actor; }; |
---|
| 8 | |
---|
| 9 | void ?{}( Server & this ) { this.val = 999; } |
---|
| 10 | void ^?{}( Server & this ) { this.val = 777; } |
---|
[858350a] | 11 | |
---|
| 12 | int main() { |
---|
| 13 | sout | "Start"; |
---|
| 14 | |
---|
| 15 | sout | "Finished"; |
---|
| 16 | { |
---|
[1950837] | 17 | start_actor_system(); |
---|
| 18 | Server s[10]; |
---|
| 19 | for ( i; 10 ) { |
---|
| 20 | s[i] << FinishedMsg; |
---|
| 21 | } |
---|
| 22 | stop_actor_system(); |
---|
[858350a] | 23 | } |
---|
| 24 | |
---|
| 25 | sout | "Delete"; |
---|
| 26 | { |
---|
[1950837] | 27 | start_actor_system(); |
---|
| 28 | for ( i; 10 ) { |
---|
| 29 | Server * s = alloc(); |
---|
| 30 | (*s){}; |
---|
| 31 | (*s) << DeleteMsg; |
---|
| 32 | } |
---|
| 33 | stop_actor_system(); |
---|
[858350a] | 34 | } |
---|
| 35 | |
---|
| 36 | sout | "Destroy"; |
---|
| 37 | { |
---|
[1950837] | 38 | start_actor_system(); |
---|
| 39 | Server s[10]; |
---|
| 40 | for ( i; 10 ) |
---|
| 41 | s[i] << DestroyMsg; |
---|
| 42 | stop_actor_system(); |
---|
| 43 | for ( i; 10 ) |
---|
| 44 | if (s[i].val != 777) |
---|
| 45 | sout | "Error: dtor not called correctly."; |
---|
[858350a] | 46 | } |
---|
| 47 | |
---|
| 48 | sout | "Done"; |
---|
| 49 | return 0; |
---|
| 50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.