Last change
on this file since 100 was
81,
checked in by rosiere, 16 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Rev | Line | |
---|
[81] | 1 | #include "../include/RamLock.h" |
---|
[78] | 2 | #include <iostream> |
---|
| 3 | |
---|
| 4 | using namespace std; |
---|
[80] | 5 | using namespace environment; |
---|
| 6 | using namespace environment::ramlock; |
---|
[78] | 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 | |
---|
[81] | 26 | #ifdef SYSTEMC |
---|
| 27 | int sc_main (int argc, char * argv[]) |
---|
| 28 | #else |
---|
| 29 | int main (int argc, char * argv[]) |
---|
| 30 | #endif |
---|
[78] | 31 | { |
---|
| 32 | cout << "<main> Begin" << endl; |
---|
| 33 | |
---|
| 34 | cout << " * Create a Ramlock with a size of 70" << endl; |
---|
| 35 | |
---|
| 36 | Parameters * param = new Parameters (70); |
---|
| 37 | RamLock * my_ramlock = new RamLock("my_ramlock",param); |
---|
| 38 | |
---|
| 39 | my_ramlock->reset(); |
---|
| 40 | |
---|
| 41 | cout << *my_ramlock << endl; |
---|
| 42 | |
---|
| 43 | TEST (my_ramlock->read (10) , UNLOCK); cout << *my_ramlock << endl; |
---|
| 44 | TEST (my_ramlock->read (10) , LOCK); cout << *my_ramlock << endl; |
---|
| 45 | TEST (my_ramlock->write(10) , LOCK); cout << *my_ramlock << endl; |
---|
| 46 | TEST (my_ramlock->write(10) , UNLOCK); cout << *my_ramlock << endl; |
---|
| 47 | |
---|
| 48 | delete param ; |
---|
| 49 | delete my_ramlock ; |
---|
| 50 | |
---|
| 51 | cout << "<main> End" << endl; |
---|
| 52 | |
---|
| 53 | return EXIT_SUCCESS; |
---|
| 54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.