aboutsummaryrefslogtreecommitdiff
path: root/test cases/common/16 configure file
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/common/16 configure file')
-rw-r--r--test cases/common/16 configure file/dumpprog.c33
-rw-r--r--test cases/common/16 configure file/meson.build15
2 files changed, 48 insertions, 0 deletions
diff --git a/test cases/common/16 configure file/dumpprog.c b/test cases/common/16 configure file/dumpprog.c
new file mode 100644
index 0000000..e0c9868
--- /dev/null
+++ b/test cases/common/16 configure file/dumpprog.c
@@ -0,0 +1,33 @@
+#define SHOULD_BE_UNDEFINED 1
+
+#include"config3.h"
+#include<string.h>
+#include<stdio.h>
+
+#ifdef SHOULD_BE_UNDEFINED
+#error Token did not get undefined.
+#endif
+
+#ifndef SHOULD_BE_DEFINED
+#error Token did not get defined
+#endif
+
+int main(int argc, char **argv) {
+ if(strcmp(SHOULD_BE_STRING, "string") != 0) {
+ printf("String token defined wrong.\n");
+ return 1;
+ }
+ if(SHOULD_BE_ONE != 1) {
+ printf("One defined incorrectly.\n");
+ return 1;
+ }
+ if(SHOULD_BE_ZERO != 0) {
+ printf("Zero defined incorrectly.\n");
+ return 1;
+ }
+ if(strcmp(SHOULD_BE_QUOTED_ONE, "1") != 0) {
+ printf("Quoted number defined incorrectly.\n");
+ return 1;
+ }
+ SHOULD_BE_RETURN 0;
+}
diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build
index 8dec8fe..e1bdff3 100644
--- a/test cases/common/16 configure file/meson.build
+++ b/test cases/common/16 configure file/meson.build
@@ -30,3 +30,18 @@ command : [genprog, scriptfile, ifile, ofile],
install_dir : 'share/appdir')
test('inctest2', executable('prog2', 'prog2.c'))
+
+# Generate a conf file without an input file.
+
+dump = configuration_data()
+dump.set('SHOULD_BE_STRING', '"string"')
+dump.set('SHOULD_BE_RETURN', 'return')
+dump.set('SHOULD_BE_DEFINED', true)
+dump.set('SHOULD_BE_UNDEFINED', false)
+dump.set('SHOULD_BE_ONE', 1)
+dump.set('SHOULD_BE_ZERO', 0)
+dump.set('SHOULD_BE_QUOTED_ONE', '"1"')
+configure_file(output : 'config3.h',
+ configuration : dump)
+
+test('Configless.', executable('dumpprog', 'dumpprog.c'))