|
Last change
on this file since 80 was
80,
checked in by rosiere, 18 years ago
|
|
Oups, Environnement is french :P
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | #include <iostream> |
|---|
| 2 | #include "../include/RamLock.h" |
|---|
| 3 | |
|---|
| 4 | using namespace std; |
|---|
| 5 | using namespace environment; |
|---|
| 6 | using namespace environment::ramlock; |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | #define TEST(x,y) \ |
|---|
| 10 | { \ |
|---|
| 11 | cout << "Line " << __LINE__ << " : "; \ |
|---|
| 12 | if (x==y) \ |
|---|
| 13 | { \ |
|---|
| 14 | cout << "Test OK"; \ |
|---|
| 15 | } \ |
|---|
| 16 | else \ |
|---|
| 17 | { \ |
|---|
| 18 | cout << "Test KO"; \ |
|---|
| 19 | exit (EXIT_FAILURE); \ |
|---|
| 20 | } \ |
|---|
| 21 | cout << endl; \ |
|---|
| 22 | } while (0) |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | int main (void) |
|---|
| 27 | { |
|---|
| 28 | cout << "<main> Begin" << endl; |
|---|
| 29 | |
|---|
| 30 | cout << " * Create a Ramlock with a size of 70" << endl; |
|---|
| 31 | |
|---|
| 32 | Parameters * param = new Parameters (70); |
|---|
| 33 | RamLock * my_ramlock = new RamLock("my_ramlock",param); |
|---|
| 34 | |
|---|
| 35 | my_ramlock->reset(); |
|---|
| 36 | |
|---|
| 37 | cout << *my_ramlock << endl; |
|---|
| 38 | |
|---|
| 39 | TEST (my_ramlock->read (10) , UNLOCK); cout << *my_ramlock << endl; |
|---|
| 40 | TEST (my_ramlock->read (10) , LOCK); cout << *my_ramlock << endl; |
|---|
| 41 | TEST (my_ramlock->write(10) , LOCK); cout << *my_ramlock << endl; |
|---|
| 42 | TEST (my_ramlock->write(10) , UNLOCK); cout << *my_ramlock << endl; |
|---|
| 43 | |
|---|
| 44 | delete param ; |
|---|
| 45 | delete my_ramlock ; |
|---|
| 46 | |
|---|
| 47 | cout << "<main> End" << endl; |
|---|
| 48 | |
|---|
| 49 | return EXIT_SUCCESS; |
|---|
| 50 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.