1 | /* |
---|
2 | * $Id: main.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Generic/Sort/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define NB_PARAMS 6 |
---|
11 | |
---|
12 | void usage (int argc, char * argv[]) |
---|
13 | { |
---|
14 | err (_("<Usage> %s name_instance list_params.\n"),argv[0]); |
---|
15 | err (_("list_params is :\n")); |
---|
16 | err (_(" * nb_input (uint32_t)\n")); |
---|
17 | err (_(" * nb_output (uint32_t)\n")); |
---|
18 | err (_(" * ascending (bool )\n")); |
---|
19 | err (_(" * size_data (uint32_t)\n")); |
---|
20 | err (_(" * have_port_index_out (bool )\n")); |
---|
21 | err (_(" * have_port_data_out (bool )\n")); |
---|
22 | |
---|
23 | exit (1); |
---|
24 | } |
---|
25 | |
---|
26 | #ifndef SYSTEMC |
---|
27 | int main (int argc, char * argv[]) |
---|
28 | #else |
---|
29 | int sc_main (int argc, char * argv[]) |
---|
30 | #endif |
---|
31 | { |
---|
32 | if (argc != static_cast<int>(2+NB_PARAMS)) |
---|
33 | usage (argc, argv); |
---|
34 | |
---|
35 | uint32_t x = 1; |
---|
36 | |
---|
37 | string name = argv[x++]; |
---|
38 | |
---|
39 | uint32_t _nb_input = fromString<uint32_t>(argv[x++]); |
---|
40 | uint32_t _nb_output = fromString<uint32_t>(argv[x++]); |
---|
41 | bool _ascending = fromString<bool >(argv[x++]); |
---|
42 | uint32_t _size_data = fromString<uint32_t>(argv[x++]); |
---|
43 | bool _have_port_index_out = fromString<bool >(argv[x++]); |
---|
44 | bool _have_port_data_out = fromString<bool >(argv[x++]); |
---|
45 | |
---|
46 | int _return = EXIT_SUCCESS; |
---|
47 | |
---|
48 | try |
---|
49 | { |
---|
50 | morpheo::behavioural::generic::sort::Parameters * param = new morpheo::behavioural::generic::sort::Parameters |
---|
51 | (_nb_input , |
---|
52 | _nb_output , |
---|
53 | _ascending , |
---|
54 | _size_data , |
---|
55 | _have_port_index_out, |
---|
56 | _have_port_data_out ); |
---|
57 | |
---|
58 | msg(_("%s"),param->print(1).c_str()); |
---|
59 | |
---|
60 | test (name,param); |
---|
61 | } |
---|
62 | catch (morpheo::ErrorMorpheo & error) |
---|
63 | { |
---|
64 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
65 | _return = EXIT_FAILURE; |
---|
66 | } |
---|
67 | catch (...) |
---|
68 | { |
---|
69 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
70 | _return = EXIT_FAILURE; |
---|
71 | } |
---|
72 | |
---|
73 | return (_return); |
---|
74 | } |
---|