[112] | 1 | /* |
---|
| 2 | * $Id: main.cpp 113 2009-04-14 18:39:12Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Comparator/SelfTest/include/test.h" |
---|
| 9 | #include "Behavioural/include/Selftest.h" |
---|
| 10 | |
---|
| 11 | #define NB_PARAMS 3 |
---|
| 12 | |
---|
| 13 | void usage (int argc, char * argv[]) |
---|
| 14 | { |
---|
| 15 | err (_("<Usage> %s name_instance list_params.\n"),argv[0]); |
---|
| 16 | err (_("list_params is :\n")); |
---|
| 17 | err (_(" * size_data (uint32_t )\n")); |
---|
| 18 | err (_(" * is_signed (bool )\n")); |
---|
| 19 | err (_(" * type (Tcomparator_scheme_t)\n")); |
---|
| 20 | |
---|
| 21 | exit (1); |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | #ifndef SYSTEMC |
---|
| 25 | int main (int argc, char * argv[]) |
---|
| 26 | #else |
---|
| 27 | int sc_main (int argc, char * argv[]) |
---|
| 28 | #endif |
---|
| 29 | { |
---|
| 30 | if (argc != static_cast<int>(2+NB_PARAMS)) |
---|
| 31 | usage (argc, argv); |
---|
| 32 | |
---|
| 33 | uint32_t x = 1; |
---|
| 34 | |
---|
[113] | 35 | string name = argv[x++]; |
---|
[112] | 36 | uint32_t _size_data; |
---|
| 37 | bool _is_signed; |
---|
| 38 | Tcomparator_scheme_t _type; |
---|
| 39 | |
---|
| 40 | SELFTEST0(_size_data,uint32_t ,argv,x); |
---|
| 41 | SELFTEST0(_is_signed,bool ,argv,x); |
---|
| 42 | SELFTEST0(_type ,Tcomparator_scheme_t,argv,x); |
---|
| 43 | |
---|
| 44 | int _return = EXIT_SUCCESS; |
---|
| 45 | try |
---|
| 46 | { |
---|
| 47 | morpheo::behavioural::generic::comparator::Parameters * param = new morpheo::behavioural::generic::comparator::Parameters |
---|
| 48 | ( |
---|
| 49 | _size_data, |
---|
| 50 | _is_signed, |
---|
| 51 | _type , |
---|
| 52 | true //is_toplevel |
---|
| 53 | ); |
---|
| 54 | |
---|
| 55 | msg(_("%s"),param->print(0).c_str()); |
---|
| 56 | |
---|
| 57 | test (name,param); |
---|
| 58 | } |
---|
| 59 | catch (morpheo::ErrorMorpheo & error) |
---|
| 60 | { |
---|
| 61 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 62 | _return = EXIT_FAILURE; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | try |
---|
| 66 | { |
---|
| 67 | if (_return == EXIT_SUCCESS) |
---|
| 68 | TEST_OK("Comparator : no error"); |
---|
| 69 | else |
---|
| 70 | TEST_KO("Comparator : a lot of error"); |
---|
| 71 | } |
---|
| 72 | catch (morpheo::ErrorMorpheo & error) |
---|
| 73 | { |
---|
| 74 | // msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 75 | _return = EXIT_FAILURE; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | return (_return); |
---|
| 79 | } |
---|