source: trunk/IPs/systemC/hierarchy_memory/ramlock/main.cpp @ 19

Last change on this file since 19 was 2, checked in by kane, 18 years ago

Import Morpheo

File size: 850 bytes
Line 
1#include "ramlock.h"
2#include <iostream>
3
4using namespace hierarchy_memory::ramlock;
5using namespace std;
6
7void test_ko (int val)
8{
9  cout << "***** Test(" << val << ") KO *****" << endl;
10  exit (val);
11}
12
13void test_ok ()
14{
15  cout << "***** Test OK *****" << endl;
16  exit (0);
17}
18
19int main ()
20{
21  cout << "<main> Test de \"Ramlock\"" << endl;
22 
23  cout << "  * Create a Ramlock with a size of 70" << endl;
24
25  Ramlock my_ramlock = Ramlock(param_t("my_ramlock",70));
26  my_ramlock.reset();
27
28  cout << my_ramlock << endl;
29
30  if (my_ramlock.read (10) != UNLOCK) test_ko(1);  cout << my_ramlock << endl;
31  if (my_ramlock.read (10) !=   LOCK) test_ko(2);  cout << my_ramlock << endl;
32  if (my_ramlock.write(10) !=   LOCK) test_ko(3);  cout << my_ramlock << endl;
33  if (my_ramlock.write(10) != UNLOCK) test_ko(4);  cout << my_ramlock << endl;
34
35  test_ok ();
36}
Note: See TracBrowser for help on using the repository browser.