move std initialization from test-.. to std
[mala.git] / tests / test-mala_stdmodule.c
blob4217e83dca303b7daf31f4a654ea13ea46d7f3f1
1 /*
2 test-mala_stdmodule.c - MaLa stdandard module test suite
4 Copyright (C) 2004, Christian Thaeter <chth@gmx.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, contact me.
19 #include <assert.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include "mala.h"
23 #include "std.h"
25 mala_actioninit my_actions[] =
27 MALA_SUBSTITUTE_PARSER("--test","HEY_TEST_SUCCEEDED"),
28 MALA_PARSER_BRIEF("--test","brief explanation of test"),
29 MALA_PARSER_HELP("--test",("--PRINTL","long help for test")),
31 MALA_EXPAND_PARSER("--testtwo",("HEY", "TEST","SUCCEEDED")),
32 MALA_PARSER_BRIEF("--testtwo","brief explanation if testtwo"),
33 MALA_PARSER_HELP("--testtwo",("--PRINTL","long help for testtwo")),
35 MALA_ACTIONS_END
38 int
39 main(int argc, char * argv[])
41 MalaEngine my_engine;
43 (void) argc;
44 (void) argv;
46 my_engine = mala_engine_new ();
47 mala_module_std_init (my_engine);
48 mala_engine_actions_register (my_engine, my_actions);
49 mala_engine_macro_define (my_engine, "--COMMANDLINE", argc - 1, argv + 1);
50 mala_engine_pushback_word (my_engine, "--COMMANDLINE");
51 mala_engine_run (my_engine);
53 mala_engine_dumpargs (my_engine, "arg: ", "\n");
54 mala_engine_dumpprogram (my_engine, "prg: ", "\n");
56 printf ("variable: %s\n", getenv ("variable"));
57 printf ("negated: %d\n", mala_engine_negated (my_engine));
58 printf ("state: %d\n", mala_engine_state_get (my_engine));
60 MALA_DEBUG("freeing engine");
62 mala_engine_free (my_engine);
63 return 0;
69 // Local Variables:
70 // mode: C
71 // c-file-style: "gnu"
72 // End:
73 // arch-tag: 56bcc0c2-d247-4a47-95dc-a460f26a444b
74 // end_of_file