root / pobysoC-4.0 / src / test-pobyso-is-constant-expression.c @ 138
Historique | Voir | Annoter | Télécharger (1,37 ko)
1 | 138 | storres | /** @file test-pobyso-is-constant-expression.c
|
---|---|---|---|
2 | 136 | storres | * Name & purpose
|
3 | 136 | storres | *
|
4 | 138 | storres | * @author S. T.
|
5 | 138 | storres | * @date 2014-11-14
|
6 | 136 | storres | *
|
7 | 136 | storres | * @details Verbosity manipulation are performed to make sur that verbosity
|
8 | 136 | storres | * suppression is correctly managed in pobyso_is_constant_expression()
|
9 | 136 | storres | * function.
|
10 | 136 | storres | */
|
11 | 136 | storres | /******************************************************************************/
|
12 | 136 | storres | /* Headers, applying the "particular to general" convention.*/
|
13 | 136 | storres | |
14 | 136 | storres | #include "pobyso.h" |
15 | 136 | storres | |
16 | 136 | storres | /* includes of local headers */
|
17 | 136 | storres | |
18 | 136 | storres | /* includes of project headers */
|
19 | 136 | storres | |
20 | 136 | storres | /* includes of system headers */
|
21 | 136 | storres | |
22 | 136 | storres | /* Other declarations */
|
23 | 136 | storres | |
24 | 136 | storres | /* Internal prototypes */
|
25 | 136 | storres | |
26 | 136 | storres | /* Types, constants and macros definitions */
|
27 | 136 | storres | |
28 | 136 | storres | /* Global variables */
|
29 | 136 | storres | |
30 | 136 | storres | /* Functions */
|
31 | 136 | storres | |
32 | 136 | storres | int
|
33 | 136 | storres | main(int argc, char** argv) |
34 | 136 | storres | { |
35 | 138 | storres | pobyso_func_exp_t funcExpSo = NULL;
|
36 | 138 | storres | int outcome = 1; |
37 | 136 | storres | |
38 | 136 | storres | sollya_lib_init(); |
39 | 136 | storres | |
40 | 138 | storres | /* No command line argument test the function with the NULL argument. */
|
41 | 138 | storres | if (argc == 1) |
42 | 136 | storres | { |
43 | 138 | storres | outcome = pobyso_is_constant_expression(funcExpSo); |
44 | 138 | storres | sollya_lib_close(); |
45 | 138 | storres | return ! outcome;
|
46 | 136 | storres | } |
47 | 136 | storres | |
48 | 138 | storres | pobyso_set_canonical_on(); |
49 | 138 | storres | funcExpSo = pobyso_parse_string(argv[1]);
|
50 | 138 | storres | if (funcExpSo != NULL) |
51 | 136 | storres | { |
52 | 138 | storres | fprintf(stdout, "Sollya expression: ");
|
53 | 138 | storres | pobyso_autoprint(funcExpSo); |
54 | 136 | storres | } |
55 | 136 | storres | else
|
56 | 136 | storres | { |
57 | 138 | storres | fprintf(stdout, "NULL expression");
|
58 | 136 | storres | } |
59 | 138 | storres | if (pobyso_is_constant_expression(funcExpSo))
|
60 | 136 | storres | { |
61 | 138 | storres | sollya_lib_close(); |
62 | 138 | storres | return 0; |
63 | 136 | storres | } |
64 | 136 | storres | else
|
65 | 136 | storres | { |
66 | 138 | storres | sollya_lib_close(); |
67 | 136 | storres | return 1; |
68 | 136 | storres | } |
69 | 136 | storres | } /* End main */ |