[67] | 1 | /* |
---|
| 2 | * $Id: main.cpp 101 2009-01-15 17:19:08Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Queue/SelfTest/include/test.h" |
---|
| 9 | |
---|
[101] | 10 | #define NB_PARAMS 5 |
---|
[67] | 11 | |
---|
| 12 | void usage (int argc, char * argv[]) |
---|
| 13 | { |
---|
| 14 | cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl |
---|
| 15 | << "list_params is :" << endl |
---|
[101] | 16 | << " - size_queue (uint32_t)" << endl |
---|
| 17 | << " - size_data (uint32_t)" << endl |
---|
| 18 | << " - nb_port_slot (uint32_t)" << endl |
---|
| 19 | << " - have_port_write (bool )" << endl |
---|
| 20 | << " - have_port_read (bool )" << endl |
---|
[67] | 21 | << "" << endl; |
---|
| 22 | |
---|
| 23 | for (int i=0; i<argc; i++) |
---|
| 24 | cerr << argv[i] << " "; |
---|
| 25 | cerr << endl; |
---|
| 26 | |
---|
| 27 | exit (1); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | #ifndef SYSTEMC |
---|
| 31 | int main (int argc, char * argv[]) |
---|
| 32 | #else |
---|
| 33 | int sc_main (int argc, char * argv[]) |
---|
| 34 | #endif |
---|
| 35 | { |
---|
| 36 | if (argc != 2+NB_PARAMS) |
---|
| 37 | usage (argc, argv); |
---|
| 38 | |
---|
| 39 | uint32_t x = 1; |
---|
| 40 | |
---|
[101] | 41 | const string name = argv[x++]; |
---|
| 42 | const uint32_t size_queue = fromString<uint32_t>(argv[x++]); |
---|
| 43 | const uint32_t size_data = fromString<uint32_t>(argv[x++]); |
---|
| 44 | const uint32_t nb_port_slot = fromString<uint32_t>(argv[x++]); |
---|
| 45 | const bool have_port_write = fromString<bool>(argv[x++]); |
---|
| 46 | const bool have_port_read = fromString<bool>(argv[x++]); |
---|
[67] | 47 | try |
---|
| 48 | { |
---|
| 49 | morpheo::behavioural::generic::queue::Parameters * param = new morpheo::behavioural::generic::queue::Parameters |
---|
| 50 | (size_queue, |
---|
[100] | 51 | size_data , |
---|
[101] | 52 | nb_port_slot, |
---|
| 53 | have_port_write, |
---|
| 54 | have_port_read |
---|
[67] | 55 | ); |
---|
| 56 | |
---|
| 57 | cout << param->print(1); |
---|
| 58 | |
---|
| 59 | test (name,param); |
---|
| 60 | } |
---|
| 61 | catch (morpheo::ErrorMorpheo & error) |
---|
| 62 | { |
---|
| 63 | cout << "<" << name << "> : " << error.what (); |
---|
| 64 | exit (EXIT_FAILURE); |
---|
| 65 | } |
---|
| 66 | catch (...) |
---|
| 67 | { |
---|
| 68 | cerr << "<" << name << "> : This test must generate a error" << endl; |
---|
| 69 | exit (EXIT_FAILURE); |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | return (EXIT_SUCCESS); |
---|
| 73 | } |
---|
| 74 | |
---|