summaryrefslogtreecommitdiff
path: root/auto
diff options
context:
space:
mode:
authorjbj <jbj>2010-03-13 02:40:44 +0000
committerjbj <jbj>2010-03-13 02:40:44 +0000
commite35527f2d479025e9eda29fda7e96b0ea018ea1e (patch)
tree010cac96eb2cc997d3684846db6893ea2eabb3cc /auto
parent9509ef20d15a35cc22e9f65b006b2e7381859308 (diff)
downloadlibpopt-e35527f2d479025e9eda29fda7e96b0ea018ea1e.tar.gz
- improve specialized types in unit tests.
Diffstat (limited to 'auto')
-rw-r--r--auto/types.in106
1 files changed, 82 insertions, 24 deletions
diff --git a/auto/types.in b/auto/types.in
index df24f5a..e446b67 100644
--- a/auto/types.in
+++ b/auto/types.in
@@ -2,15 +2,83 @@
<collection>
<spec_type>
- <kind>
- common_param
- </kind>
- <name>
- poptBits
- </name>
- <data_type>
- poptBits
- </data_type>
+ <kind> common_env </kind>
+ <global_code>
+ static int aVal = 141421;
+ static unsigned int aFlag = 0x8aceU;
+
+ static short aShort = (short)4523;
+ static int aInt = 271828;
+ static long aLong = 738905609L;
+ static long long aLongLong = 738905609LL;
+ static float aFloat = 3.1415926535;
+ static double aDouble = 9.86960440108935861883;
+ static const char ** aArgv = NULL;
+
+ static struct poptOption optionsTable[] = {
+ { "val", '\0', POPT_ARG_VAL | POPT_ARGFLAG_SHOW_DEFAULT, &aVal, 125992,
+ "POPT_ARG_VAL: 125992 141421", 0},
+ { "int", 'i', POPT_ARG_INT | POPT_ARGFLAG_SHOW_DEFAULT, &aInt, 0,
+ "POPT_ARG_INT: 271828", NULL },
+ { "short", 's', POPT_ARG_SHORT | POPT_ARGFLAG_SHOW_DEFAULT, &aShort, 0,
+ "POPT_ARG_SHORT: 4523", NULL },
+ { "long", 'l', POPT_ARG_LONG | POPT_ARGFLAG_SHOW_DEFAULT, &aLong, 0,
+ "POPT_ARG_LONG: 738905609", NULL },
+ { "longlong", 'L', POPT_ARG_LONGLONG | POPT_ARGFLAG_SHOW_DEFAULT, &aLongLong, 0,
+ "POPT_ARG_LONGLONG: 738905609", NULL },
+ { "float", 'f', POPT_ARG_FLOAT | POPT_ARGFLAG_SHOW_DEFAULT, &aFloat, 0,
+ "POPT_ARG_FLOAT: 3.14159", NULL },
+ { "double", 'd', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT, &aDouble, 0,
+ "POPT_ARG_DOUBLE: 9.8696", NULL },
+ { "argv", '\0', POPT_ARG_ARGV, &aArgv, 0,
+ "POPT_ARG_ARGV: append string to argv array (can be used multiple times)","STRING"},
+ POPT_AUTOALIAS
+ POPT_AUTOHELP
+ POPT_TABLEEND
+ };
+ </global_code>
+</spec_type>
+
+<spec_type>
+ <kind> common_param </kind>
+ <data_type> poptContext </data_type>
+ <value> poptGetContext(argv[0], argc, argv, optionsTable, 0) </value>
+ <final_code>
+ $0 = poptFreeContext($0);
+ </final_code>
+ <associating>
+ <except>
+ poptAddItem <!-- FIXME -->
+ poptFreeContext
+ poptFini
+ </except>
+ </associating>
+</spec_type>
+
+<spec_type>
+ <kind> common_param </kind>
+ <data_type> struct poptAlias </data_type>
+ <value> _alias </value>
+ <global_code>
+ #include <malloc.h>
+ static struct poptAlias _alias = {
+ .longName = "longName",
+ .shortName = 'l',
+ .argc = 0,
+ .argv = NULL
+ };
+ </global_code>
+ <init_code>
+ $0.argc = 1;
+ $0.argv = calloc($0.argc + 1, sizeof(*$0.argv));
+ $0.argv[0] = strdup("arg1");
+ </init_code>
+</spec_type>
+
+<spec_type>
+ <kind> common_param </kind>
+ <name> poptBits </name>
+ <data_type> poptBits </data_type>
<value>
create_poptBits()
</value>
@@ -27,15 +95,9 @@
</spec_type>
<spec_type>
- <kind>
- normal
- </kind>
- <data_type>
- const char ***
- </data_type>
- <value>
- &av
- </value>
+ <kind> normal </kind>
+ <data_type> const char *** </data_type>
+ <value> &av </value>
<global_code>
#include <malloc.h>
</global_code>
@@ -47,12 +109,8 @@
free(av);
</final_code>
<associating>
- <interfaces>
- poptSaveString
- </interfaces>
- <links>
- param1
- </links>
+ <interfaces> poptSaveString </interfaces>
+ <links> param1 </links>
</associating>
</spec_type>